@libxai/board 0.17.236 → 0.17.237

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'),pc=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),Cu=require('react-markdown'),Tu=require('remark-gfm'),Du=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var pc__default=/*#__PURE__*/_interopDefault(pc);var Cu__default=/*#__PURE__*/_interopDefault(Cu);var Tu__default=/*#__PURE__*/_interopDefault(Tu);var Du__default=/*#__PURE__*/_interopDefault(Du);var Go=(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 _o=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 [_o.Translate.toString(e),_o.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function y(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Vo(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 $p(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Zn(e,t){return e.length===0?1e3:t===0?Vo(null,e[0].position):t>=e.length?Vo(e[e.length-1].position,null):Vo(e[t-1].position,e[t].position)}function gl(e,t=100){return e>t}var Up=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 Wp(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function jo(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:l=Up,onRetry:p}=t,m,n=0;for(let d=1;d<=a;d++){n=d;try{return {data:await e(),attempts:n,success:!0}}catch(c){if(m=c,d===a||!l(m,d))return {error:m,attempts:n,success:false};let u=Wp(d,r,o,s);if(p)try{p(m,d,u);}catch(f){console.error("Error in retry callback:",f);}await new Promise(f=>setTimeout(f,u));}}return {error:m||new Error("Unknown error"),attempts:n,success:false}}function Hp(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 Gp(e,t={}){return async(...a)=>jo(()=>e(...a),t)}var Qn=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 fl=(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))(fl||{}),kr=class kr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...l}=t,p=`[${a}] [${r}] [${s}]`,m=Object.keys(l).length>0;switch(r){case "DEBUG":console.debug(p,o,m?l:"");break;case "INFO":console.info(p,o,m?l:"");break;case "WARN":console.warn(p,o,m?l:"");break;case "ERROR":console.error(p,o,m?l:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...kr.globalOptions};}static configure(t){kr.globalOptions={...kr.globalOptions,...t};}child(t){return new kr({...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 Ko((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Ko(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:fl[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};kr.globalOptions={};var es=kr,Ko=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}},hl=new es;function Vp(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 jp(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 l=e.columns.find(p=>p.id===s.columnId);return [s.id,ts(s.title),ts(s.description||""),ts(l?.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 Kp(e,t,a){let r=t;if(!r){let l=document.querySelector(".asakaa-board");l&&(r=l.parentElement||l);}if(r)try{let l=await pc__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),p=l.toDataURL("image/png"),m=297,n=210,d=l.width/l.height,c=m-20,i=c/d;i>n-20&&(i=n-20,c=i*d);let u=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});u.setFontSize(16),u.setTextColor(255,255,255),u.setFillColor(10,10,10),u.rect(0,0,m,15,"F"),u.text(e.title||"Kanban Board",10,10);let f=(m-c)/2;return u.addImage(p,"PNG",f,20,c,i),u}catch(l){console.error("Error capturing board:",l);}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(l=>{let p=e.cards.filter(m=>m.columnId===l.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(l.title,20,s),s+=8,p.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):p.forEach(m=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(m.title,25,s),s+=6,m.description){o.setFontSize(9),o.setFont("helvetica","normal");let d=o.splitTextToSize(m.description,160);o.text(d,25,s),s+=d.length*5;}let n=[];if(m.priority&&n.push(`Priority: ${m.priority}`),m.labels&&m.labels.length>0&&n.push(`Labels: ${m.labels.join(", ")}`),m.assignedUserIds&&m.assignedUserIds.length>0&&n.push(`Assigned: ${m.assignedUserIds.length} user(s)`),m.startDate||m.endDate){let d=[];m.startDate&&d.push(`Start: ${m.startDate}`),m.endDate&&d.push(`End: ${m.endDate}`),n.push(d.join(" \u2192 "));}n.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(n.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function ts(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function yl(e,t,a,r){switch(t){case "json":return Vp(e,r);case "csv":return jp(e);case "pdf":return await Kp(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function vl(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let d=`${r}.pdf`;e.save(d);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]}`,l={json:"application/json",csv:"text/csv",pdf:"application/pdf"},p=new Blob([e],{type:l[t]}),m=URL.createObjectURL(p),n=document.createElement("a");n.href=m,n.download=s,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(m);}function Yp(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 qp(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=xl(t[0]),r=[],o=new Map,s=[];for(let l=1;l<t.length;l++)try{let p=xl(t[l]||"");if(p.length>a.length){s.push(`Line ${l+1}: Too many columns`);continue}if(a.length-p.length>3){s.push(`Line ${l+1}: Column count mismatch (expected ${a.length}, got ${p.length})`);continue}for(;p.length<a.length;)p.push("");let n={};a.forEach((u,f)=>{n[u]=p[f]||"";});let d=n.Column||"Unnamed";o.has(d)||o.set(d,{id:`col-${o.size+1}`,title:d,position:o.size+1,cardIds:[]});let c=o.get(d),i={id:n["Card ID"]||`card-${l}`,title:n.Title||"Untitled",description:n.Description?n.Description:void 0,columnId:c.id,position:c.cardIds.length+1,priority:n.Priority||void 0,labels:n.Labels?n.Labels.split(";").filter(Boolean):void 0,assignedUserIds:n["Assigned Users"]?n["Assigned Users"].split(";").filter(Boolean):void 0,startDate:n["Start Date"]?n["Start Date"]:void 0,endDate:n["End Date"]?n["End Date"]:void 0,createdAt:n["Created At"]?n["Created At"]:void 0,updatedAt:n["Updated At"]?n["Updated At"]:void 0};r.push(i),c.cardIds.push(i.id);}catch(p){s.push(`Line ${l+1}: ${p instanceof Error?p.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 xl(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],l=e[o+1];s==='"'&&r&&l==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function kl(e,t){switch(t){case "json":return Yp(e);case "csv":return qp(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function wl(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 as=react.createContext(null);function Cl(){return react.useContext(as)}var Tl=react.createContext(null);function Dl({children:e,themeName:t}){return jsxRuntime.jsx(Tl.Provider,{value:{themeName:t},children:e})}function Hr(){return react.useContext(Tl)}function nt({children:e,container:t}){let[a,r]=react.useState(false),o=Cl(),s=Hr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let l=t||(typeof document<"u"?document.body:null);if(!l)return null;if(o){let{theme:p,themeName:m}=o,n={"--asakaa-color-background-primary":p.bgPrimary,"--asakaa-color-background-secondary":p.bgSecondary,"--asakaa-color-background-card":p.bgGrid,"--asakaa-color-background-hover":p.hoverBg,"--asakaa-color-text-primary":p.textPrimary,"--asakaa-color-text-secondary":p.textSecondary,"--asakaa-color-text-tertiary":p.textTertiary,"--asakaa-color-text-inverse":p.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":p.border,"--asakaa-color-border-hover":p.borderLight,"--asakaa-color-border-subtle":p.borderLight,"--asakaa-color-interactive-primary":p.accent,"--asakaa-color-interactive-primaryHover":p.accentHover,"--asakaa-color-interactive-primaryBorder":`${p.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${p.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${p.accent}33`,"--asakaa-color-status-success":p.statusCompleted,"--asakaa-color-status-warning":p.milestone,"--asakaa-color-status-error":p.criticalPath,"--asakaa-color-danger":p.criticalPath,"--asakaa-color-danger-border":`${p.criticalPath}4D`,"--asakaa-color-danger-background":`${p.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${p.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":m,"data-gantt-portal":"true",style:n,children:e}),l)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),l):reactDom.createPortal(e,l)}var Ml={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},rm="#BDC3C7",om=({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,l]=react.useState({top:0,left:0}),p=react.useRef(null),m=react.useRef(null),n=()=>{if(!m.current)return;let u=m.current.getBoundingClientRect(),f=window.innerHeight,h=window.innerWidth,g=160,w=220,b=4,v=u.right-g;v<10&&(v=u.left),v+g>h-10&&(v=h-g-10);let x=f-u.bottom,T=u.top,D;x>=w+b?D=u.bottom+b:T>=w+b?D=u.top-w-b:D=x>=T?u.bottom+b:Math.max(10,u.top-w-b),l({top:D,left:v}),o(true);};react.useEffect(()=>{let u=f=>{p.current&&!p.current.contains(f.target)&&!m.current?.contains(f.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),react.useEffect(()=>{let u=f=>{f.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let d=u=>{t(u),o(false);},c=e?Ml[e]:null,i=c?.color||rm;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>r?o(false):n(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${i}10`:"transparent",boxShadow:e?`0 0 0 2px ${i}30 inset`:"none"},title:c?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:i,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(nt,{children:jsxRuntime.jsxs("div",{ref:p,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(Ml).map(([u,f])=>jsxRuntime.jsxs("button",{onClick:()=>d(u),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:f.color,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(om,{color:f.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:f.label}),e===u&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},u)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>d(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:u=>{u.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:u=>{u.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var nm=[{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 go({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[l,p]=react.useState({top:0,left:0}),m=react.useRef(null),n=react.useRef(null),i=(Hr()?.themeName||"dark")==="dark",u=()=>{if(!n.current)return;let v=n.current.getBoundingClientRect(),x=window.innerHeight,T=window.innerWidth,D=320,M=380,k=4,B=v.left;B+D>T-10&&(B=T-D-10),B<10&&(B=10);let N=x-v.bottom,C=v.top,H;N>=M+k?H=v.bottom+k:C>=M+k?H=v.top-M-k:H=N>=C?v.bottom+k:Math.max(10,v.top-M-k),p({top:H,left:B}),s(true);};react.useEffect(()=>{let v=x=>{m.current&&!m.current.contains(x.target)&&!n.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),react.useEffect(()=>{let v=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let f=v=>{let x=new Date,T=B=>{let N=B.getFullYear(),C=String(B.getMonth()+1).padStart(2,"0"),H=String(B.getDate()).padStart(2,"0");return `${N}-${C}-${H}`},D=T(x),M=new Date(x);M.setDate(M.getDate()+v);let k=T(M);a(D,k),s(false);},h=()=>{if(!e||!t)return "Set date";let v=M=>{if(M instanceof Date)return M;if(typeof M!="string"||!M.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=M.split("-").map(Number);if(k.length!==3||k.some(H=>isNaN(H)))return null;let B=k[0],N=k[1],C=k[2];return B===void 0||N===void 0||C===void 0?null:new Date(B,N-1,C)},x=v(e),T=v(t);if(!x||!T||isNaN(x.getTime())||isNaN(T.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[x.getMonth()]} ${x.getDate()} \u2013 ${D[T.getMonth()]} ${T.getDate()}`},g=e&&t,b=(()=>{if(!t)return false;let v=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),v<x})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o?s(false):u(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:g?`${h()}`:"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:h()})]}),o&&jsxRuntime.jsx(nt,{children:jsxRuntime.jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,background:i?"#1A1D25":"#FFFFFF",border:`1px solid ${i?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:i?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:i?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:nm.map(v=>jsxRuntime.jsx("button",{onClick:()=>f(v.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:v.label},v.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:v=>a(v.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:v=>a(e,v.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Tr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,l]=react.useState(false),[p,m]=react.useState(""),[n,d]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),u=()=>{if(!i.current)return;let b=i.current.getBoundingClientRect(),v=window.innerHeight,x=window.innerWidth,T=300,D=380,M=4,k=b.right-T;k<10&&(k=b.left),k+T>x-10&&(k=x-T-10);let B=v-b.bottom,N=b.top,C;B>=D+M?C=b.bottom+M:N>=D+M?C=b.top-D-M:C=B>=N?b.bottom+M:Math.max(10,b.top-D-M),d({top:C,left:k}),l(true);};react.useEffect(()=>{let b=v=>{c.current&&!c.current.contains(v.target)&&!i.current?.contains(v.target)&&(l(false),m(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=v=>{v.key==="Escape"&&(l(false),m(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let f=b=>{let v=e.some(x=>x.id===b.id);a(v?e.filter(x=>x.id!==b.id):[...e,b]);},h=t.filter(b=>b.name.toLowerCase().includes(p.toLowerCase())),g=e.slice(0,o),w=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>s?l(false):u(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[g.map(b=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),w>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",w]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(nt,{children:jsxRuntime.jsxs("div",{ref:c,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:p,onChange:b=>m(b.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:h.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"}):h.map(b=>{let v=e.some(x=>x.id===b.id);return jsxRuntime.jsxs("button",{onClick:()=>f(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:b.color,color:"#fff"},children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:b.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:v?"#3b82f6":"transparent"},children:v?"\u2713":""})]},b.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),l(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Yo(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let n=m.dependencies.map(d=>{if(typeof d=="string")return d;let c=d;return c.taskId||c.targetId||""}).filter(Boolean);r.set(m.id,n);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,l=new Set,p=m=>{if(!s.has(m)){s.add(m),l.add(m);let n=r.get(m)||[];for(let d of n){if(!s.has(d)&&p(d))return true;if(l.has(d))return true}}return l.delete(m),false};return p(a)}function ho({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:l}){let[p,m]=react.useState(false),[n,d]=react.useState(""),[c,i]=react.useState(t.length>0),[u,f]=react.useState({top:0,left:0}),[h,g]=react.useState(null),w=react.useRef(null),b=react.useRef(null),v=()=>{if(!b.current)return;let k=b.current.getBoundingClientRect(),B=window.innerHeight,N=window.innerWidth,C=300,H=c?380:120,I=4,K=k.right-C;K<10&&(K=k.left),K+C>N-10&&(K=N-C-10);let j=B-k.bottom,$=k.top,Z;j>=H+I?Z=k.bottom+I:$>=H+I?Z=k.top-H-I:Z=j>=$?k.bottom+I:Math.max(10,k.top-H-I),f({top:Z,left:K}),m(true);};react.useEffect(()=>{if(!p||!b.current)return;let k=b.current.getBoundingClientRect(),B=window.innerHeight,N=window.innerWidth,C=300,H=c?380:120,I=4,K=k.right-C;K<10&&(K=k.left),K+C>N-10&&(K=N-C-10);let j=B-k.bottom,$=k.top,Z;j>=H+I?Z=k.bottom+I:$>=H+I?Z=k.top-H-I:Z=j>=$?k.bottom+I:Math.max(10,k.top-H-I),f({top:Z,left:K});},[c,p]),react.useEffect(()=>{let k=B=>{w.current&&!w.current.contains(B.target)&&!b.current?.contains(B.target)&&(m(false),d(""));};if(p)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[p]),react.useEffect(()=>{let k=B=>{B.key==="Escape"&&(m(false),d(""));};if(p)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[p]);let x=k=>{let B=t.includes(k),N=a.find(C=>C.id===k);if(g(null),B){let C=t.filter(H=>H!==k);r(C),C.length===0&&i(false);}else {if(s&&Yo(a,k,e)){let H=`Cannot add "${N?.title||k}" as dependency - would create circular reference`;g(H),l?.(k,N?.title||k),setTimeout(()=>g(null),3e3);return}r([...t,k]),i(true);}},T=()=>{let k=!c;i(k),k||r([]);},D=a.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(n.toLowerCase())||k.id.toLowerCase().includes(n.toLowerCase())),M=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:b,onClick:()=>p?m(false):v(),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:M,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:M},children:t.length})]}),p&&jsxRuntime.jsx(nt,{children:jsxRuntime.jsxs("div",{ref:w,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${u.top}px`,left:`${u.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[h&&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:h})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:T,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:c?"#3b82f6":"transparent",borderColor:c?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:c&&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"})]})}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:n,onChange:k=>d(k.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:D.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):D.map(k=>{let B=t.includes(k.id);return jsxRuntime.jsxs("button",{onClick:()=>x(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:N=>{N.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:N=>{N.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:B?"#3b82f6":"transparent",borderColor:B?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:B&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:k.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:k.id})]})]},k.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),i(false),m(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var ja=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:l,availableUsers:p=[],allCards:m=[]})=>{let{attributes:n,listeners:d,setNodeRef:c,transform:i,transition:u,isDragging:f}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),h={transform:_o.Transform.toString(i),transition:u};if(t)return jsxRuntime.jsx("div",{ref:c,style:h,...n,...d,onClick:()=>a?.(e),children:t(e)});let g=p.filter(x=>e.assignedUserIds?.includes(x.id)),w=e.progress===100,b=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),v={...h,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:c,style:v,className:y("asakaa-card",f&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...n,...d,onClick:x=>{x.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:x=>{x.currentTarget.style.display="none";}})}),b.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:b.length===1&&b[0]?jsxRuntime.jsx("img",{src:b[0].url,alt:b[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:b.slice(0,4).map((x,T)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:D=>{D.currentTarget.style.display="none";}}),T===3&&b.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:["+",b.length-4]})})]},x.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:w?"line-through":"none",opacity:w?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(wr,{priority:e.priority,onChange:x=>l?.(e.id,{priority:x})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(go,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(x,T)=>l?.(e.id,{startDate:x,endDate:T})})}),p.length>0&&jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Tr,{assignedUsers:g,availableUsers:p,onChange:x=>l?.(e.id,{assignedUserIds:x.map(T=>T.id)})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(ho,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:m,onChange:x=>l?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsxRuntime.jsx("span",{className:"asakaa-label",children:x},x))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));ja.displayName="Card";var qo={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"}},Ul=({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 Wl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[l,p]=react.useState({top:0,left:0}),m=react.useRef(null),n=react.useRef(null),d=[...Object.entries(qo).map(([g,w])=>({id:g,label:w.label,color:w.color,icon:w.icon})),...r.filter(g=>!Object.keys(qo).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],c=()=>{let g=qo[e];if(g)return {...g,id:e};let w=r.find(b=>b.id===e);return w?{id:w.id,label:w.title,color:w.color||"#8B5CF6",icon:"circle-dot"}:{...qo.todo,id:"todo"}},i=()=>{if(!n.current)return;let g=n.current.getBoundingClientRect(),w=window.innerHeight,b=window.innerWidth,v=180,x=280,T=4,D=g.right-v;D<10&&(D=g.left),D+v>b-10&&(D=b-v-10);let M=w-g.bottom,k=g.top,B;M>=x+T?B=g.bottom+T:k>=x+T?B=g.top-x-T:B=M>=k?g.bottom+T:Math.max(10,g.top-x-T),p({top:B,left:D}),s(true);};react.useEffect(()=>{let g=w=>{m.current&&!m.current.contains(w.target)&&!n.current?.contains(w.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=w=>{w.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let u=g=>{t(g),s(false);},f=c(),h=f.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:n,onClick:()=>o?s(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${h}10`,boxShadow:`0 0 0 2px ${h}30 inset`},title:f.label,children:jsxRuntime.jsx(Ul,{icon:f.icon,color:h})}),o&&jsxRuntime.jsx(nt,{children:jsxRuntime.jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:d.map(g=>jsxRuntime.jsxs("button",{onClick:()=>u(g.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:g.color,background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Ul,{icon:g.icon,color:g.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:g.label}),e===g.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"})})]},g.id))})]})})]})}function Hl({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,l]=react.useState(false),[p,m]=react.useState(false),[n,d]=react.useState(e),[c,i]=react.useState({top:0,left:0}),u=react.useRef(null),f=react.useRef(null),h=react.useRef(null);react.useEffect(()=>{if(s&&f.current){let v=f.current.getBoundingClientRect();i({top:v.bottom+window.scrollY+8,left:v.left+window.scrollX});}},[s]),react.useEffect(()=>{let v=x=>{u.current&&!u.current.contains(x.target)&&!f.current?.contains(x.target)&&(l(false),m(false));};if(s)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[s]),react.useEffect(()=>{let v=x=>{x.key==="Escape"&&(l(false),m(false),d(e));};if(s)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[s,e]),react.useEffect(()=>{p&&h.current&&(h.current.focus(),h.current.select());},[p]);let g=()=>{m(true),d(e);},w=()=>{let v=n.trim();v&&v!==e&&t(v),m(false),l(false),d(e);},b=v=>{v.key==="Enter"?w():v.key==="Escape"&&(m(false),d(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:f,onClick:()=>l(!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(nt,{children:jsxRuntime.jsx("div",{ref:u,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${c.top}px`,left:`${c.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:p?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:h,type:"text",value:n,onChange:v=>d(v.target.value),onKeyDown:b,onBlur:w,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:g,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),l(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var Vr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:l,onCardUpdate:p,availableUsers:m,allCards:n,enableVirtualization:d,cardHeight:c=120,isCollapsed:i,onToggleCollapse:u,onColumnRename:f,onColumnDelete:h,isDeletable:g=false,className:w})=>{let{setNodeRef:b,isOver:v}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),x=react.useRef(null),T=d??gl(t.length),D=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>c,enabled:T});if(a)return jsxRuntime.jsx("div",{ref:b,className:w,children:a(e,t)});let k=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let C=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:C}:C>=80?{state:"warning",percentage:C}:C>=60?{state:"approaching",percentage:C}:{state:"ok",percentage:C}})(),B=k.state==="exceeded",N=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:b,className:y("asakaa-column",v&&"ring-2 ring-asakaa-accent-blue",B&&"ring-2 ring-asakaa-accent-red",w),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:y(N()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&k.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${k.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[k.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),k.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),k.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),k.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(f||h)&&jsxRuntime.jsx(Hl,{columnTitle:e.title,onRename:C=>f?.(e.id,C),onDelete:h?()=>h(e.id):void 0,isDeletable:g}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":i?"Expand column":"Collapse column",children:i?"\u25B6":"\u25BC"})]})]}),!i&&jsxRuntime.jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:T?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(C=>C.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):T?jsxRuntime.jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(C=>{let H=t[C.index];return H?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${C.start}px)`},children:jsxRuntime.jsx(ja,{card:H,render:r,onClick:l,onUpdate:p,availableUsers:m,allCards:n})},H.id):null})}):t.map(C=>jsxRuntime.jsx(ja,{card:C,render:r,onClick:l,onUpdate:p,availableUsers:m,allCards:n},C.id))})})]})});Vr.displayName="Column";function is({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,l]=react.useState(e),p=react.useRef(null);react.useEffect(()=>{r&&p.current&&(p.current.focus(),p.current.select());},[r]);let m=()=>{let d=s.trim();d&&d!==e?t(d):l(e),o(false);},n=d=>{d.key==="Enter"?m():d.key==="Escape"&&(l(e),o(false));};return r?jsxRuntime.jsx("input",{ref:p,type:"text",value:s,onChange:d=>l(d.target.value),onBlur:m,onKeyDown:n,className:y("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:y("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}var Qo=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function sr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:l=true}){let[p,m]=react.useState(false),[n,d]=react.useState(""),[c,i]=react.useState(false),[u,f]=react.useState(Qo[10]||"#3B82F6"),[h,g]=react.useState({top:0,left:0}),w=react.useRef(null),b=react.useRef(null),v=react.useRef(null),x=react.useRef(null),T=t.filter(C=>C.name.toLowerCase().includes(n.toLowerCase())),D=t.some(C=>C.name.toLowerCase()===n.toLowerCase());react.useEffect(()=>{if(p&&b.current){let C=b.current.getBoundingClientRect();g({top:C.bottom+6,left:C.left});}},[p]),react.useEffect(()=>{let C=H=>{let I=H.target,K=w.current?.contains(I),j=v.current?.contains(I);!K&&!j&&(m(false),d(""),i(false));};if(p)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[p]),react.useEffect(()=>{p&&x.current&&x.current.focus();},[p]);let M=C=>{let H=e.some(I=>I.id===C.id);a(H?e.filter(I=>I.id!==C.id):[...e,C]);},k=async()=>{if(!(!r||!n.trim())){i(true);try{let C=await r(n.trim(),u);C&&(a([...e,C]),d(""),f(Qo[Math.floor(Math.random()*Qo.length)]||"#3B82F6"));}finally{i(false);}}},B=(C,H)=>{H.stopPropagation(),a(e.filter(I=>I.id!==C));},N={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:w,className:"relative",children:[jsxRuntime.jsxs("button",{ref:b,type:"button",onClick:()=>!s&&m(!p),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:N,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(C=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${C.color}20`,color:C.color},children:C.name},C.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:v,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:h.top,left:h.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:x,type:"text",value:n,onChange:C=>d(C.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:C=>{C.key==="Enter"&&n.trim()&&!D&&r&&k();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(C=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${C.color}20`,color:C.color},onClick:H=>B(C.id,H),children:[C.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},C.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:T.length>0?T.map(C=>{let H=e.some(I=>I.id===C.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>M(C),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:H?`${C.color}15`:"transparent",color:o.textPrimary},onMouseEnter:I=>{H||(I.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:I=>{H||(I.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:C.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:C.name}),H&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:C.color}})]},C.id)}):n.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"})}),n.trim()&&!D&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Qo.map(C=>jsxRuntime.jsx("button",{type:"button",onClick:()=>f(C),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:C,outline:u===C?`2px solid ${C}`:"none",outlineOffset:"2px"}},C))}),jsxRuntime.jsxs("button",{type:"button",onClick:k,disabled:c,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:u,color:"#FFFFFF",opacity:c?.7:1},children:[c?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 "',n.trim(),'"']})]})]})}),document.body)]})}function ds({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 jl({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(ds,{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]})]})}function Yl(e){if("title"in e&&!("name"in e)){let t=e,a=(t.assignedUserIds||[]).map(r=>({name:r,initials:r.substring(0,2).toUpperCase(),color:"#6366F1"}));return {id:t.id,name:t.title,startDate:t.startDate?new Date(t.startDate):void 0,endDate:t.endDate?new Date(t.endDate):void 0,progress:t.progress||0,status:t.columnId,priority:t.priority?.toLowerCase(),assignees:a,dependencies:Array.isArray(t.dependencies)?t.dependencies.map(r=>typeof r=="string"?r:r.taskId):[],tags:t.tags,subtasks:t.subtasks?.map(r=>({id:r.id,name:r.title,progress:r.completed?100:0,startDate:new Date,endDate:new Date})),color:t.color,description:t.description}}return e}function Wm(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 ms({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:l="es",availableUsers:p=[],availableTags:m=[],onCreateTag:n}){let d=s==="dark",c={textTertiary:d?"#6B7280":"#9CA3AF",textSecondary:d?"#9CA3AF":"#6B7280",textPrimary:d?"#FFFFFF":"#111827",borderLight:d?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:d?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:d?"#1A1D25":"#FFFFFF",bgSecondary:d?"#0F1117":"#F9FAFB",hoverBg:d?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},i=e&&"title"in e&&!("name"in e),u=e,[f,h]=react.useState(e?Yl(e):null),[g,w]=react.useState(false),[b,v]=react.useState(false),[x,T]=react.useState(null),[D,M]=react.useState(new Date),[k,B]=react.useState(false);react.useEffect(()=>{e&&h(Yl(e));},[e?.id]);let N=react.useCallback($=>{h($),i&&o&&u?o(Wm($,u)):r&&r($);},[i,u,o,r]),C=react.useCallback(()=>{w(false),v(false),T(null);},[]),H=react.useCallback(($,Z)=>{if(!f)return;let ce={...f,[$]:Z};N(ce);},[f,N]),I=react.useCallback($=>{if(!f)return;let Z=f.progress||0;$==="completed"?Z=100:$==="in-progress"&&Z===0?Z=10:$==="todo"&&(Z=0);let ce={...f,status:$,progress:Z};N(ce),w(false);},[f,N]),K=react.useCallback(($,Z)=>{if(!f)return;let ce={...f,startDate:$,endDate:Z};N(ce);},[f,N]),j=react.useCallback(()=>{let $=D.getFullYear(),Z=D.getMonth(),ce=new Date($,Z,1),R=new Date($,Z+1,0).getDate(),A=ce.getDay(),O=[],P=new Date($,Z,0).getDate();for(let Y=A-1;Y>=0;Y--)O.push({date:new Date($,Z-1,P-Y),isCurrentMonth:false});for(let Y=1;Y<=R;Y++)O.push({date:new Date($,Z,Y),isCurrentMonth:true});let X=42-O.length;for(let Y=1;Y<=X;Y++)O.push({date:new Date($,Z+1,Y),isCurrentMonth:false});return O},[D]);return !t||!f?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:y("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",d?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:y("px-6 py-3 border-b flex items-center gap-3",d?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:y("w-4 h-4",d?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:y("text-xs px-2 py-0.5 rounded",d?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[l==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:y("text-xs font-mono",d?"text-[#6B7280]":"text-gray-400"),children:f.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:y("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",d?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:y("p-1.5 rounded transition-colors",d?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:y("p-1.5 rounded transition-colors",d?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:a,className:y("p-1.5 rounded transition-colors",d?"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.progress===100?0:100,ce={...f,progress:$,status:$===100?"completed":"todo"};N(ce);},className:y("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",f.progress===100?"bg-green-500 border-green-500":d?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:f.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:y("text-xl font-semibold flex-1",f.progress===100?"line-through text-[#6B7280]":d?"text-white":"text-gray-900"),children:f.name})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:y("w-4 h-4",d?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",d?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{C(),w(!g);},className:y("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.progress===100||f.status==="completed"?"bg-green-500/20 text-green-400":f.progress&&f.progress>0||f.status==="in-progress"?"bg-blue-500/20 text-blue-400":d?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:f.progress===100||f.status==="completed"?l==="es"?"COMPLETADO":"DONE":f.progress&&f.progress>0||f.status==="in-progress"?l==="es"?"EN PROGRESO":"IN PROGRESS":l==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:g&&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:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",d?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:l==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:l==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:l==="es"?"Completado":"Done",color:"bg-green-500"}].map($=>jsxRuntime.jsxs("button",{onClick:()=>I($.id),className:y("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",d?"hover:bg-white/5":"hover:bg-gray-50",f.status===$.id&&(d?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:y("w-2 h-2 rounded-full",$.color)}),jsxRuntime.jsx("span",{className:d?"text-white":"text-gray-900",children:$.label})]},$.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:y("w-4 h-4",d?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",d?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Asignados":"Assignees"}),f.assignees&&f.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[f.assignees.slice(0,3).map(($,Z)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:$.color||"#8B5CF6"},title:$.name,children:$.initials||$.name.slice(0,2).toUpperCase()},Z)),f.assignees.length>3&&jsxRuntime.jsxs("span",{className:y("text-xs",d?"text-[#6B7280]":"text-gray-400"),children:["+",f.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:y("text-sm",d?"text-[#6B7280]":"text-gray-400"),children:l==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:y("w-4 h-4",d?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",d?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{T(x?null:"start"),M(f.startDate||new Date);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",d?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[f.startDate?.toLocaleDateString(l==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(l==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:y("mx-1",d?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),f.endDate?.toLocaleDateString(l==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(l==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>T(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:y("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",d?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:$=>$.stopPropagation(),children:[jsxRuntime.jsx("div",{className:y("w-44 py-2 border-r",d?"border-white/10":"border-gray-200"),children:(()=>{let $=new Date,Z=new Date($);Z.setDate($.getDate()+1);let ce=new Date($);ce.setDate($.getDate()+7);let he=new Date($);return he.setDate($.getDate()+14),[{label:l==="es"?"Hoy":"Today",date:$},{label:l==="es"?"Ma\xF1ana":"Tomorrow",date:Z},{label:l==="es"?"Pr\xF3xima semana":"Next week",date:ce},{label:l==="es"?"2 semanas":"2 weeks",date:he}].map((R,A)=>jsxRuntime.jsxs("button",{className:y("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",d?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x==="start"?(K(R.date,f.endDate),T("end")):(K(f.startDate,R.date),T(null));},children:[jsxRuntime.jsx("span",{children:R.label}),jsxRuntime.jsx("span",{className:y("text-xs",d?"text-[#6B7280]":"text-gray-400"),children:R.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]},A))})()}),jsxRuntime.jsxs("div",{className:"p-4 w-[280px]",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:y("text-sm font-medium",d?"text-white":"text-gray-900"),children:x==="start"?l==="es"?"Fecha inicio":"Start date":l==="es"?"Fecha fin":"End date"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>M(new Date(D.getFullYear(),D.getMonth()-1)),className:y("p-1 rounded",d?"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("span",{className:y("text-sm min-w-[100px] text-center",d?"text-white":"text-gray-900"),children:D.toLocaleDateString(l==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>M(new Date(D.getFullYear(),D.getMonth()+1)),className:y("p-1 rounded",d?"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:(l==="es"?["L","M","M","J","V","S","D"]:["S","M","T","W","T","F","S"]).map(($,Z)=>jsxRuntime.jsx("div",{className:y("text-xs text-center py-1",d?"text-[#6B7280]":"text-gray-400"),children:$},Z))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:j().map(($,Z)=>{let ce=$.date.toDateString()===new Date().toDateString(),he=f.startDate?.toDateString()===$.date.toDateString(),R=f.endDate?.toDateString()===$.date.toDateString(),A=f.startDate&&f.endDate&&$.date>=f.startDate&&$.date<=f.endDate;return jsxRuntime.jsx("button",{onClick:()=>{x==="start"?(K($.date,f.endDate&&$.date>f.endDate?$.date:f.endDate),T("end")):(K(f.startDate&&$.date<f.startDate?$.date:f.startDate,$.date),T(null));},className:y("w-8 h-8 text-xs rounded-lg transition-colors",!$.isCurrentMonth&&(d?"text-[#4B5563]":"text-gray-300"),$.isCurrentMonth&&(d?"text-white":"text-gray-900"),ce&&"ring-1 ring-blue-500",(he||R)&&"bg-blue-500 text-white",A&&!he&&!R&&(d?"bg-blue-500/20":"bg-blue-100"),d?"hover:bg-white/10":"hover:bg-gray-100"),children:$.date.getDate()},Z)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:y("w-4 h-4",d?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",d?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{C(),v(!b);},className:y("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",f.priority==="high"||f.priority==="urgent"?"bg-red-500/20 text-red-400":f.priority==="medium"?"bg-yellow-500/20 text-yellow-400":f.priority==="low"?"bg-green-500/20 text-green-400":d?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:f.priority?f.priority==="high"||f.priority==="urgent"?l==="es"?"Alta":"High":f.priority==="medium"?l==="es"?"Media":"Medium":l==="es"?"Baja":"Low":l==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>v(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",d?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:l==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:l==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:l==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:l==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:l==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map($=>jsxRuntime.jsxs("button",{onClick:()=>{H("priority",$.id),v(false);},className:y("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",d?"hover:bg-white/5":"hover:bg-gray-50",f.priority===$.id&&(d?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:y("w-2 h-2 rounded-full",$.color)}),jsxRuntime.jsx("span",{className:d?"text-white":"text-gray-900",children:$.label})]},$.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:y("w-4 h-4",d?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",d?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:y("text-sm",d?"text-white":"text-gray-900"),children:f.startDate&&f.endDate?`${Math.ceil((f.endDate.getTime()-f.startDate.getTime())/(1e3*60*60*24))} ${l==="es"?"d\xEDas":"days"}`:l==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:y("w-4 h-4 rounded-full border-2",d?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",d?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[k?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress||0,onChange:$=>{let Z=parseInt($.target.value),ce=f.status;Z===100?ce="completed":Z>0?ce="in-progress":ce="todo";let he={...f,progress:Z,status:ce};N(he);},onBlur:()=>B(false),className:y("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",d?"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:()=>B(true),className:y("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",d?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:y("h-full rounded-full transition-all",f.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${f.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:y("text-sm font-medium min-w-[40px]",d?"text-white":"text-gray-900"),children:[f.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:y("w-4 h-4",d?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",d?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(sr,{selectedTags:f.tags||[],availableTags:m,onChange:$=>{H("tags",$);},onCreateTag:n,theme:c})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:y("w-4 h-4",d?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",d?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:y("text-sm",d?"text-[#6B7280]":"text-gray-400"),children:f.dependencies&&f.dependencies.length>0?`${f.dependencies.length} ${l==="es"?"dependencias":"dependencies"}`:l==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",d?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:y("flex items-center gap-2 text-sm transition-colors",d?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),l==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:y("flex items-center gap-2 text-sm mt-2 transition-colors",d?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),l==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",d?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold mb-3",d?"text-white":"text-gray-900"),children:l==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",d?"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"}),l==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",d?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold mb-3",d?"text-white":"text-gray-900"),children:l==="es"?"Subtareas":"Subtasks"}),f.subtasks&&f.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:f.subtasks.map($=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:y("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",$.progress===100?"bg-green-500 border-green-500":d?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:$.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:y("text-sm",$.progress===100?"line-through text-[#6B7280]":d?"text-white":"text-gray-900"),children:$.name})]},$.id))}),jsxRuntime.jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",d?"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"}),l==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",d?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold",d?"text-white":"text-gray-900"),children:l==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:y("p-1 rounded transition-colors",d?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",d?"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"}),l==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",d?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold mb-3",d?"text-white":"text-gray-900"),children:l==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:y("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",d?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:y("w-6 h-6 mx-auto mb-2",d?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:y("text-sm",d?"text-[#9CA3AF]":"text-gray-500"),children:l==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED para ",jsxRuntime.jsx("span",{className:"underline",children:"subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here to ",jsxRuntime.jsx("span",{className:"underline",children:"upload"})]})})]})]})]})]}),jsxRuntime.jsxs("div",{className:y("w-80 border-l flex flex-col",d?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:y("px-4 py-3 border-b",d?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("h3",{className:y("text-sm font-semibold",d?"text-white":"text-gray-900"),children:l==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:y("w-10 h-10 mb-3",d?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:y("text-sm",d?"text-[#6B7280]":"text-gray-500"),children:l==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:y("p-4 border-t",d?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:y("flex items-center gap-2 px-3 py-2 rounded-lg",d?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",placeholder:l==="es"?"Escribe un comentario...":"Write a comment...",className:y("flex-1 bg-transparent text-sm outline-none",d?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")}),jsxRuntime.jsx("button",{className:y("p-1.5 rounded transition-colors",d?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]})})]})]})]})})}function gs(){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 lr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:l,style:p,isLoading:m,error:n,children:d,availableTags:c=[],onCreateTag:i}){let[u,f]=gs(),[h,g]=react.useState(null),w=o?.theme||"dark",b=w==="dark"||w==="neutral",v=b?"dark":"",x=react.useCallback((j,$)=>{t.onCardUpdate?.(j,$);},[t]),T=react.useCallback((j,$)=>{t.onColumnUpdate?.(j,{title:$});},[t]),D=react.useCallback(j=>{t.onColumnDelete?.(j);},[t]),M=["todo","in-progress","completed"],k=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),B=react.useMemo(()=>{let j=new Map;return e.columns.forEach($=>{let Z=$.cardIds.map(ce=>e.cards.find(he=>he.id===ce)).filter(ce=>ce!==void 0).sort((ce,he)=>ce.position-he.position);j.set($.id,Z);}),j},[e.cards,e.columns]),N=react.useCallback(j=>{let{active:$}=j,Z=e.cards.find(ce=>ce.id===$.id);Z&&f({isDragging:true,draggedCardId:Z.id,sourceColumnId:Z.columnId,targetColumnId:Z.columnId});},[e.cards,f]),C=react.useCallback(j=>{let{active:$,over:Z}=j;if(!Z||!e.cards.find(R=>R.id===$.id))return;let he=null;Z.data.current?.type==="column"?he=Z.id:Z.data.current?.type==="card"&&(he=e.cards.find(A=>A.id===Z.id)?.columnId||null),he&&he!==u.targetColumnId&&f({...u,targetColumnId:he});},[e.cards,u,f]),H=react.useCallback(async j=>{let{active:$,over:Z}=j;if(f({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!Z)return;let ce=e.cards.find(O=>O.id===$.id);if(!ce)return;let he,R;if(Z.data.current?.type==="column"){he=Z.id;let O=B.get(he)||[];R=Zn(O,0);}else {let O=e.cards.find(Y=>Y.id===Z.id);if(!O)return;he=O.columnId;let P=B.get(he)||[],X=P.findIndex(Y=>Y.id===Z.id);R=Zn(P,X);}let A=e.columns.find(O=>O.id===he);if(A&&A.wipLimit&&A.wipLimitType==="hard"){let O=B.get(he)||[];if(ce.columnId!==he&&O.length>=A.wipLimit){t.onWipLimitExceeded?.(A,ce);return}}(ce.columnId!==he||ce.position!==R)&&await t.onCardMove?.(ce.id,he,R);},[e.cards,e.columns,B,t,f]),I=react.useCallback(j=>{g(j),a?.(j);},[a]),K=react.useCallback(j=>{t.onCardUpdate?.(j.id,j),g(j);},[t]);return m?jsxRuntime.jsx("div",{className:y("asakaa-board",v,l),style:p,children:jsxRuntime.jsx(eu,{columnCount:3})}):n?jsxRuntime.jsx("div",{className:y("asakaa-board",v,l),style:p,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof n=="string"?n:n.message})]})})}):jsxRuntime.jsxs(Dl,{themeName:w,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:k,collisionDetection:core$1.closestCorners,onDragStart:N,onDragOver:C,onDragEnd:H,children:[jsxRuntime.jsxs("div",{className:y("asakaa-board",v,l),style:p,"data-theme":w,children:[e.columns.sort((j,$)=>j.position-$.position).map(j=>{let $=B.get(j.id)||[],Z=!M.includes(j.id);return jsxRuntime.jsx(Vr,{column:j,cards:$,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:I,onCardUpdate:x,onColumnRename:T,onColumnDelete:D,isDeletable:Z,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},j.id)}),d]}),jsxRuntime.jsx(core$1.DragOverlay,{children:u.draggedCardId?jsxRuntime.jsx(ja,{card:e.cards.find(j=>j.id===u.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(ms,{task:h,isOpen:!!h,onClose:()=>g(null),onCardUpdate:K,theme:b?"dark":"light",locale:o?.locale==="es"?"es":"en",availableTags:c,onCreateTag:i})]})}function eu({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 nu={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)"},su={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)"},iu={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},lu={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function du({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,l]=react.useState(false),p=react.useRef(null);react.useEffect(()=>{let n=d=>{p.current&&!p.current.contains(d.target)&&l(false);};return s&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[s]);let m=n=>{t(n),l(false);};return jsxRuntime.jsxs("div",{ref:p,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((n,d)=>n.position-d.position).map((n,d)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(n.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:d<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:d*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:n.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:n.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[n.cardIds.length," ",n.cardIds.length===1?"tarea":"tareas"]})]})]},n.id))]})})})]})}function cu({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,l]=react.useState(false),[p,m]=react.useState(null),n=react.useRef(null);if(react.useEffect(()=>{let u=f=>{n.current&&!n.current.contains(f.target)&&l(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),!(a||r||o))return null;let c=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(u=>u.handler),i=async(u,f)=>{if(f){m(u);try{await f();}catch(h){console.error(`Export ${u} failed:`,h);}finally{m(null),l(false);}}};return jsxRuntime.jsxs("div",{ref:n,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(!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:c.map((u,f)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(u.id,u.handler),disabled:p!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:f<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:p===u.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):u.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:u.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:u.description})]})]},u.id))})})})]})}function pu({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 hs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:l,onExportJSON:p,onExportExcel:m,translations:n}){let d=r==="dark"?nu:su,c={...o==="es"?iu:lu,...n},i=l||p||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:d.bgGrid,borderColor:d.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(cu,{theme:d,t:c,onExportCSV:l,onExportJSON:p,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),t&&(s?jsxRuntime.jsx(du,{columns:e,onSelect:t,theme:d,t:c,createTaskLabel:a}):jsxRuntime.jsx(pu,{onClick:()=>t(),label:a||c.newTask}))]})})}function ys({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,l]=react.useState(false),[p,m]=react.useState(""),n=react.useCallback(()=>{let i=p.trim();i&&(e(i),m(""),l(false));},[p,e]),d=react.useCallback(i=>{i.key==="Enter"?(i.preventDefault(),n()):i.key==="Escape"&&(m(""),l(false));},[n]),c=react.useCallback(()=>{setTimeout(()=>{p.trim()||l(false);},150);},[p]);return s?jsxRuntime.jsx("div",{className:y("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:p,onChange:i=>m(i.target.value),onKeyDown:d,onBlur:c,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:n,disabled:!p.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{m(""),l(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:y("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>l(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function vs({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:l=false,theme:p="dark",locale:m="es"}){let[n,d]=react.useState(false),[c,i]=react.useState(false),[u,f]=react.useState(""),[h,g]=react.useState([]),[w,b]=react.useState(""),[v,x]=react.useState(""),[T,D]=react.useState(""),[M,k]=react.useState(false),[B,N]=react.useState(false),[C,H]=react.useState(false),I=react.useRef(null),K=react.useRef(null),j={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},$=react.useCallback(()=>{f(""),g([]),b(""),x(""),D(""),k(false),N(false),H(false),d(false);},[]);react.useEffect(()=>{n&&I.current&&I.current.focus();},[n]),react.useEffect(()=>{if(!n)return;let A=O=>{K.current&&!K.current.contains(O.target)&&(u.trim()||$());};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[n,u,$]);let Z=react.useCallback(async()=>{let A=u.trim();if(!(!A||c)){i(true);try{await t({name:A,columnId:e,assigneeIds:h.length>0?h:void 0,startDate:w?new Date(w):void 0,endDate:v?new Date(v):void 0,priority:T||void 0}),f(""),g([]),b(""),x(""),D(""),k(!1),N(!1),H(!1),I.current?.focus();}catch(O){console.error("Error creating card:",O);}finally{i(false);}}},[u,e,h,w,v,T,t,c]),ce=react.useCallback(A=>{A.key==="Enter"&&!A.shiftKey?(A.preventDefault(),Z()):A.key==="Escape"&&$();},[Z,$]),he=react.useCallback(A=>{g(O=>O.includes(A)?O.filter(P=>P!==A):[...O,A]);},[]),R=p==="dark";return n?jsxRuntime.jsxs("div",{ref:K,className:y("rounded-lg overflow-hidden shadow-lg",R?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:I,type:"text",value:u,onChange:A=>f(A.target.value),onKeyDown:ce,placeholder:j.placeholder,disabled:c,className:y("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",R?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>k(!M),className:y("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",M||h.length>0?"bg-emerald-500/20 text-emerald-400":R?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:j.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),h.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:h.length})]}),jsxRuntime.jsx("button",{onClick:()=>N(!B),className:y("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||w||v?"bg-blue-500/20 text-blue-400":R?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:j.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>H(!C),className:y("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",C||T?T==="urgent"?"bg-red-500/20 text-red-400":T==="high"?"bg-orange-500/20 text-orange-400":T==="medium"?"bg-yellow-500/20 text-yellow-400":T==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":R?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:j.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:Z,disabled:!u.trim()||c,className:y("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:c?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):j.save})]})]}),M&&a.length>0&&jsxRuntime.jsx("div",{className:y("px-3 pb-3 pt-0","border-t",R?"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:()=>he(A.id),className:y("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",h.includes(A.id)?"bg-emerald-500 text-white":R?"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:y("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",h.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))})}),B&&jsxRuntime.jsx("div",{className:y("px-3 pb-3 pt-0","border-t",R?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:y("block text-[10px] uppercase tracking-wide mb-1",R?"text-gray-500":"text-gray-400"),children:j.startDate}),jsxRuntime.jsx("input",{type:"date",value:w,onChange:A=>b(A.target.value),className:y("w-full px-2 py-1.5 rounded text-xs border",R?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:y("block text-[10px] uppercase tracking-wide mb-1",R?"text-gray-500":"text-gray-400"),children:j.endDate}),jsxRuntime.jsx("input",{type:"date",value:v,onChange:A=>x(A.target.value),className:y("w-full px-2 py-1.5 rounded text-xs border",R?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),C&&jsxRuntime.jsx("div",{className:y("px-3 pb-3 pt-0","border-t",R?"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:()=>D(T===A?"":A),className:y("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",T===A?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[A]} text-white`:R?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:j[A]},A))})})]}):jsxRuntime.jsxs("button",{onClick:()=>d(true),disabled:l,className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",R?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",l&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:j.buttonLabel})]})}var ko=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(lr,{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(l=>{l?o(l):s(new Error("Failed to create PNG blob"));},"image/png");})}};function nd(e={}){return new ko(e)}var Xr=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(l){console.error("Error in error handler:",l);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:l}=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:l?`Error in ${l}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function xs(e,t){let a=r=>jsxRuntime.jsx(Xr,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ws({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:l,onPredictRisks:p,onOpenAIUsage:m,shortcut:n="k",className:d=""}){let[c,i]=react.useState(false),[u,f]=react.useState(""),[h,g]=react.useState("home"),[w,b]=react.useState(""),[v,x]=react.useState("");react.useEffect(()=>{let k=B=>{(B.metaKey||B.ctrlKey)&&B.key===n&&(B.preventDefault(),i(N=>!N)),B.key==="Escape"&&(i(false),g("home"),f(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[n]),react.useEffect(()=>{c||(g("home"),f(""),b(""),x(""));},[c]);let T=react.useCallback(()=>{i(false);},[]),D=react.useCallback(k=>{let[B,N]=k.split(":");switch(B){case "create-card":g("create-card");break;case "create-card-in":b(N||"");break;case "navigate":N?(a?.(N),T()):g("navigate");break;case "search":r?.(u),T();break;case "priority":g("priority");break;case "set-priority":v&&N&&(o?.(v,N),T());break;case "assign":g("assign");break;case "assign-user":v&&N&&(s?.(v,N),T());break;case "ai":g("ai");break;case "ai-generate-plan":l?.(),T();break;case "ai-predict-risks":p?.(),T();break;case "ai-usage":m?.(),T();break;case "back":g("home");break;}},[u,v,t,a,r,o,s,l,p,m,T]),M=react.useCallback(()=>{w&&u.trim()&&(t?.(w,u.trim()),T());},[w,u,t,T]);return c?jsxRuntime.jsx(nt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:T,children:jsxRuntime.jsx("div",{className:`command-palette ${d}`,onClick:k=>k.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,onValueChange:f,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:h==="create-card"&&w?"Type card title and press Enter...":h==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&h==="create-card"&&w&&M();}}),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."}),h==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(B=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:B},B))})]},k.id))})]}),h==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${k.id}`,onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:k.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),h==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(k=>{let B=e.columns.find(N=>N.id===k.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:D,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:k.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:B?.title})]}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(N=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:N},N))})]},k.id)})})]}),h==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function ld(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let l=document.createElement("div");l.id="attachment-lightbox-native",l.className="attachment-lightbox",l.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'),pc=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),Cu=require('react-markdown'),Tu=require('remark-gfm'),Du=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var pc__default=/*#__PURE__*/_interopDefault(pc);var Cu__default=/*#__PURE__*/_interopDefault(Cu);var Tu__default=/*#__PURE__*/_interopDefault(Tu);var Du__default=/*#__PURE__*/_interopDefault(Du);var Go=(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 _o=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 [_o.Translate.toString(e),_o.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function b(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Vo(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 $p(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Zn(e,t){return e.length===0?1e3:t===0?Vo(null,e[0].position):t>=e.length?Vo(e[e.length-1].position,null):Vo(e[t-1].position,e[t].position)}function gl(e,t=100){return e>t}var Up=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 Wp(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function jo(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:i=Up,onRetry:p}=t,m,d=0;for(let l=1;l<=a;l++){d=l;try{return {data:await e(),attempts:d,success:!0}}catch(n){if(m=n,l===a||!i(m,l))return {error:m,attempts:d,success:false};let f=Wp(l,r,o,s);if(p)try{p(m,l,f);}catch(c){console.error("Error in retry callback:",c);}await new Promise(c=>setTimeout(c,f));}}return {error:m||new Error("Unknown error"),attempts:d,success:false}}function Hp(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 Gp(e,t={}){return async(...a)=>jo(()=>e(...a),t)}var Qn=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 fl=(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))(fl||{}),kr=class kr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...i}=t,p=`[${a}] [${r}] [${s}]`,m=Object.keys(i).length>0;switch(r){case "DEBUG":console.debug(p,o,m?i:"");break;case "INFO":console.info(p,o,m?i:"");break;case "WARN":console.warn(p,o,m?i:"");break;case "ERROR":console.error(p,o,m?i:""),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",...kr.globalOptions};}static configure(t){kr.globalOptions={...kr.globalOptions,...t};}child(t){return new kr({...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 Ko((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Ko(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:fl[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};kr.globalOptions={};var es=kr,Ko=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}},hl=new es;function Vp(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 jp(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 i=e.columns.find(p=>p.id===s.columnId);return [s.id,ts(s.title),ts(s.description||""),ts(i?.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 Kp(e,t,a){let r=t;if(!r){let i=document.querySelector(".asakaa-board");i&&(r=i.parentElement||i);}if(r)try{let i=await pc__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),p=i.toDataURL("image/png"),m=297,d=210,l=i.width/i.height,n=m-20,g=n/l;g>d-20&&(g=d-20,n=g*l);let f=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});f.setFontSize(16),f.setTextColor(255,255,255),f.setFillColor(10,10,10),f.rect(0,0,m,15,"F"),f.text(e.title||"Kanban Board",10,10);let c=(m-n)/2;return f.addImage(p,"PNG",c,20,n,g),f}catch(i){console.error("Error capturing board:",i);}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(i=>{let p=e.cards.filter(m=>m.columnId===i.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(i.title,20,s),s+=8,p.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):p.forEach(m=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(m.title,25,s),s+=6,m.description){o.setFontSize(9),o.setFont("helvetica","normal");let l=o.splitTextToSize(m.description,160);o.text(l,25,s),s+=l.length*5;}let d=[];if(m.priority&&d.push(`Priority: ${m.priority}`),m.labels&&m.labels.length>0&&d.push(`Labels: ${m.labels.join(", ")}`),m.assignedUserIds&&m.assignedUserIds.length>0&&d.push(`Assigned: ${m.assignedUserIds.length} user(s)`),m.startDate||m.endDate){let l=[];m.startDate&&l.push(`Start: ${m.startDate}`),m.endDate&&l.push(`End: ${m.endDate}`),d.push(l.join(" \u2192 "));}d.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(d.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function ts(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function yl(e,t,a,r){switch(t){case "json":return Vp(e,r);case "csv":return jp(e);case "pdf":return await Kp(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function vl(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let l=`${r}.pdf`;e.save(l);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]}`,i={json:"application/json",csv:"text/csv",pdf:"application/pdf"},p=new Blob([e],{type:i[t]}),m=URL.createObjectURL(p),d=document.createElement("a");d.href=m,d.download=s,document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(m);}function Yp(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 qp(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=xl(t[0]),r=[],o=new Map,s=[];for(let i=1;i<t.length;i++)try{let p=xl(t[i]||"");if(p.length>a.length){s.push(`Line ${i+1}: Too many columns`);continue}if(a.length-p.length>3){s.push(`Line ${i+1}: Column count mismatch (expected ${a.length}, got ${p.length})`);continue}for(;p.length<a.length;)p.push("");let d={};a.forEach((f,c)=>{d[f]=p[c]||"";});let l=d.Column||"Unnamed";o.has(l)||o.set(l,{id:`col-${o.size+1}`,title:l,position:o.size+1,cardIds:[]});let n=o.get(l),g={id:d["Card ID"]||`card-${i}`,title:d.Title||"Untitled",description:d.Description?d.Description:void 0,columnId:n.id,position:n.cardIds.length+1,priority:d.Priority||void 0,labels:d.Labels?d.Labels.split(";").filter(Boolean):void 0,assignedUserIds:d["Assigned Users"]?d["Assigned Users"].split(";").filter(Boolean):void 0,startDate:d["Start Date"]?d["Start Date"]:void 0,endDate:d["End Date"]?d["End Date"]:void 0,createdAt:d["Created At"]?d["Created At"]:void 0,updatedAt:d["Updated At"]?d["Updated At"]:void 0};r.push(g),n.cardIds.push(g.id);}catch(p){s.push(`Line ${i+1}: ${p instanceof Error?p.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 xl(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],i=e[o+1];s==='"'&&r&&i==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function kl(e,t){switch(t){case "json":return Yp(e);case "csv":return qp(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function wl(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 as=react.createContext(null);function Cl(){return react.useContext(as)}var Tl=react.createContext(null);function Dl({children:e,themeName:t}){return jsxRuntime.jsx(Tl.Provider,{value:{themeName:t},children:e})}function Hr(){return react.useContext(Tl)}function lt({children:e,container:t}){let[a,r]=react.useState(false),o=Cl(),s=Hr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let i=t||(typeof document<"u"?document.body:null);if(!i)return null;if(o){let{theme:p,themeName:m}=o,d={"--asakaa-color-background-primary":p.bgPrimary,"--asakaa-color-background-secondary":p.bgSecondary,"--asakaa-color-background-card":p.bgGrid,"--asakaa-color-background-hover":p.hoverBg,"--asakaa-color-text-primary":p.textPrimary,"--asakaa-color-text-secondary":p.textSecondary,"--asakaa-color-text-tertiary":p.textTertiary,"--asakaa-color-text-inverse":p.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":p.border,"--asakaa-color-border-hover":p.borderLight,"--asakaa-color-border-subtle":p.borderLight,"--asakaa-color-interactive-primary":p.accent,"--asakaa-color-interactive-primaryHover":p.accentHover,"--asakaa-color-interactive-primaryBorder":`${p.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${p.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${p.accent}33`,"--asakaa-color-status-success":p.statusCompleted,"--asakaa-color-status-warning":p.milestone,"--asakaa-color-status-error":p.criticalPath,"--asakaa-color-danger":p.criticalPath,"--asakaa-color-danger-border":`${p.criticalPath}4D`,"--asakaa-color-danger-background":`${p.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${p.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":m,"data-gantt-portal":"true",style:d,children:e}),i)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),i):reactDom.createPortal(e,i)}var Ml={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},rm="#BDC3C7",om=({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,i]=react.useState({top:0,left:0}),p=react.useRef(null),m=react.useRef(null),d=()=>{if(!m.current)return;let f=m.current.getBoundingClientRect(),c=window.innerHeight,w=window.innerWidth,h=160,k=220,u=4,y=f.right-h;y<10&&(y=f.left),y+h>w-10&&(y=w-h-10);let v=c-f.bottom,D=f.top,T;v>=k+u?T=f.bottom+u:D>=k+u?T=f.top-k-u:T=v>=D?f.bottom+u:Math.max(10,f.top-k-u),i({top:T,left:y}),o(true);};react.useEffect(()=>{let f=c=>{p.current&&!p.current.contains(c.target)&&!m.current?.contains(c.target)&&o(false);};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),react.useEffect(()=>{let f=c=>{c.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r]);let l=f=>{t(f),o(false);},n=e?Ml[e]:null,g=n?.color||rm;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>r?o(false):d(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${g}10`:"transparent",boxShadow:e?`0 0 0 2px ${g}30 inset`:"none"},title:n?.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(lt,{children:jsxRuntime.jsxs("div",{ref:p,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(Ml).map(([f,c])=>jsxRuntime.jsxs("button",{onClick:()=>l(f),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:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(om,{color:c.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:c.label}),e===f&&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"})})]},f)),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:()=>l(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: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("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 nm=[{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 go({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[i,p]=react.useState({top:0,left:0}),m=react.useRef(null),d=react.useRef(null),g=(Hr()?.themeName||"dark")==="dark",f=()=>{if(!d.current)return;let y=d.current.getBoundingClientRect(),v=window.innerHeight,D=window.innerWidth,T=320,M=380,x=4,L=y.left;L+T>D-10&&(L=D-T-10),L<10&&(L=10);let N=v-y.bottom,C=y.top,W;N>=M+x?W=y.bottom+x:C>=M+x?W=y.top-M-x:W=N>=C?y.bottom+x:Math.max(10,y.top-M-x),p({top:W,left:L}),s(true);};react.useEffect(()=>{let y=v=>{m.current&&!m.current.contains(v.target)&&!d.current?.contains(v.target)&&s(false);};if(o)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),react.useEffect(()=>{let y=v=>{v.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o]);let c=y=>{let v=new Date,D=L=>{let N=L.getFullYear(),C=String(L.getMonth()+1).padStart(2,"0"),W=String(L.getDate()).padStart(2,"0");return `${N}-${C}-${W}`},T=D(v),M=new Date(v);M.setDate(M.getDate()+y);let x=D(M);a(T,x),s(false);},w=()=>{if(!e||!t)return "Set date";let y=M=>{if(M instanceof Date)return M;if(typeof M!="string"||!M.match(/^\d{4}-\d{2}-\d{2}$/))return null;let x=M.split("-").map(Number);if(x.length!==3||x.some(W=>isNaN(W)))return null;let L=x[0],N=x[1],C=x[2];return L===void 0||N===void 0||C===void 0?null:new Date(L,N-1,C)},v=y(e),D=y(t);if(!v||!D||isNaN(v.getTime())||isNaN(D.getTime()))return "Set date";let T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${T[v.getMonth()]} ${v.getDate()} \u2013 ${T[D.getMonth()]} ${D.getDate()}`},h=e&&t,u=(()=>{if(!t)return false;let y=typeof t=="string"?new Date(t):t,v=new Date;return v.setHours(0,0,0,0),y<v})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:d,onClick:()=>o?s(false):f(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${u?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${w()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:w()})]}),o&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.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:nm.map(y=>jsxRuntime.jsx("button",{onClick:()=>c(y.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:v=>{v.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",v.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:v=>{v.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",v.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:y.label},y.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:y=>a(y.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:y=>a(e,y.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:y=>{y.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:y=>{y.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Tr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,i]=react.useState(false),[p,m]=react.useState(""),[d,l]=react.useState({top:0,left:0}),n=react.useRef(null),g=react.useRef(null),f=()=>{if(!g.current)return;let u=g.current.getBoundingClientRect(),y=window.innerHeight,v=window.innerWidth,D=300,T=380,M=4,x=u.right-D;x<10&&(x=u.left),x+D>v-10&&(x=v-D-10);let L=y-u.bottom,N=u.top,C;L>=T+M?C=u.bottom+M:N>=T+M?C=u.top-T-M:C=L>=N?u.bottom+M:Math.max(10,u.top-T-M),l({top:C,left:x}),i(true);};react.useEffect(()=>{let u=y=>{n.current&&!n.current.contains(y.target)&&!g.current?.contains(y.target)&&(i(false),m(""));};if(s)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),react.useEffect(()=>{let u=y=>{y.key==="Escape"&&(i(false),m(""));};if(s)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[s]);let c=u=>{let y=e.some(v=>v.id===u.id);a(y?e.filter(v=>v.id!==u.id):[...e,u]);},w=t.filter(u=>u.name.toLowerCase().includes(p.toLowerCase())),h=e.slice(0,o),k=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:g,onClick:()=>s?i(false):f(),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(u=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:u.name,children:u.avatar?jsxRuntime.jsx("img",{src:u.avatar,alt:u.name,className:"asakaa-avatar-img"}):u.initials},u.id)),k>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",k]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsxs("div",{ref:n,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${d.top}px`,left:`${d.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:p,onChange:u=>m(u.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:w.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):w.map(u=>{let y=e.some(v=>v.id===u.id);return jsxRuntime.jsxs("button",{onClick:()=>c(u),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:u.color,color:"#fff"},children:u.avatar?jsxRuntime.jsx("img",{src:u.avatar,alt:u.name,className:"w-full h-full rounded-full object-cover"}):u.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:u.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:y?"#3b82f6":"transparent"},children:y?"\u2713":""})]},u.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),i(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 Yo(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let d=m.dependencies.map(l=>{if(typeof l=="string")return l;let n=l;return n.taskId||n.targetId||""}).filter(Boolean);r.set(m.id,d);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,i=new Set,p=m=>{if(!s.has(m)){s.add(m),i.add(m);let d=r.get(m)||[];for(let l of d){if(!s.has(l)&&p(l))return true;if(i.has(l))return true}}return i.delete(m),false};return p(a)}function ho({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:i}){let[p,m]=react.useState(false),[d,l]=react.useState(""),[n,g]=react.useState(t.length>0),[f,c]=react.useState({top:0,left:0}),[w,h]=react.useState(null),k=react.useRef(null),u=react.useRef(null),y=()=>{if(!u.current)return;let x=u.current.getBoundingClientRect(),L=window.innerHeight,N=window.innerWidth,C=300,W=n?380:120,I=4,K=x.right-C;K<10&&(K=x.left),K+C>N-10&&(K=N-C-10);let V=L-x.bottom,z=x.top,Q;V>=W+I?Q=x.bottom+I:z>=W+I?Q=x.top-W-I:Q=V>=z?x.bottom+I:Math.max(10,x.top-W-I),c({top:Q,left:K}),m(true);};react.useEffect(()=>{if(!p||!u.current)return;let x=u.current.getBoundingClientRect(),L=window.innerHeight,N=window.innerWidth,C=300,W=n?380:120,I=4,K=x.right-C;K<10&&(K=x.left),K+C>N-10&&(K=N-C-10);let V=L-x.bottom,z=x.top,Q;V>=W+I?Q=x.bottom+I:z>=W+I?Q=x.top-W-I:Q=V>=z?x.bottom+I:Math.max(10,x.top-W-I),c({top:Q,left:K});},[n,p]),react.useEffect(()=>{let x=L=>{k.current&&!k.current.contains(L.target)&&!u.current?.contains(L.target)&&(m(false),l(""));};if(p)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[p]),react.useEffect(()=>{let x=L=>{L.key==="Escape"&&(m(false),l(""));};if(p)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[p]);let v=x=>{let L=t.includes(x),N=a.find(C=>C.id===x);if(h(null),L){let C=t.filter(W=>W!==x);r(C),C.length===0&&g(false);}else {if(s&&Yo(a,x,e)){let W=`Cannot add "${N?.title||x}" as dependency - would create circular reference`;h(W),i?.(x,N?.title||x),setTimeout(()=>h(null),3e3);return}r([...t,x]),g(true);}},D=()=>{let x=!n;g(x),x||r([]);},T=a.filter(x=>x.id!==e).filter(x=>x.title.toLowerCase().includes(d.toLowerCase())||x.id.toLowerCase().includes(d.toLowerCase())),M=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:u,onClick:()=>p?m(false):y(),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:M,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:M},children:t.length})]}),p&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsxs("div",{ref:k,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${f.top}px`,left:`${f.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[w&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:w})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:D,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:n?"#3b82f6":"transparent",borderColor:n?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:n&&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"})]})}),n&&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:d,onChange:x=>l(x.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:T.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"}):T.map(x=>{let L=t.includes(x.id);return jsxRuntime.jsxs("button",{onClick:()=>v(x.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:N=>{N.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:N=>{N.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: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.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:x.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:x.id})]})]},x.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),g(false),m(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Ka=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:i,availableUsers:p=[],allCards:m=[]})=>{let{attributes:d,listeners:l,setNodeRef:n,transform:g,transition:f,isDragging:c}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),w={transform:_o.Transform.toString(g),transition:f};if(t)return jsxRuntime.jsx("div",{ref:n,style:w,...d,...l,onClick:()=>a?.(e),children:t(e)});let h=p.filter(v=>e.assignedUserIds?.includes(v.id)),k=e.progress===100,u=(e.attachments||[]).filter(v=>v.type.startsWith("image/")),y={...w,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:n,style:y,className:b("asakaa-card",c&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...d,...l,onClick:v=>{v.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:v=>{v.currentTarget.style.display="none";}})}),u.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:u.length===1&&u[0]?jsxRuntime.jsx("img",{src:u[0].url,alt:u[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:v=>{v.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:u.slice(0,4).map((v,D)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:v.url,alt:v.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:T=>{T.currentTarget.style.display="none";}}),D===3&&u.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",u.length-4]})})]},v.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:k?"line-through":"none",opacity:k?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:v=>v.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(wr,{priority:e.priority,onChange:v=>i?.(e.id,{priority:v})})}),jsxRuntime.jsx("div",{onClick:v=>v.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(go,{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:(v,D)=>i?.(e.id,{startDate:v,endDate:D})})}),p.length>0&&jsxRuntime.jsx("div",{onClick:v=>v.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Tr,{assignedUsers:h,availableUsers:p,onChange:v=>i?.(e.id,{assignedUserIds:v.map(D=>D.id)})})}),jsxRuntime.jsx("div",{onClick:v=>v.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(ho,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(v=>typeof v=="string"?v:v.taskId):[],availableTasks:m,onChange:v=>i?.(e.id,{dependencies:v})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(v=>jsxRuntime.jsx("span",{className:"asakaa-label",children:v},v))}),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)));Ka.displayName="Card";var qo={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"}},Ul=({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 Wl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[i,p]=react.useState({top:0,left:0}),m=react.useRef(null),d=react.useRef(null),l=[...Object.entries(qo).map(([h,k])=>({id:h,label:k.label,color:k.color,icon:k.icon})),...r.filter(h=>!Object.keys(qo).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],n=()=>{let h=qo[e];if(h)return {...h,id:e};let k=r.find(u=>u.id===e);return k?{id:k.id,label:k.title,color:k.color||"#8B5CF6",icon:"circle-dot"}:{...qo.todo,id:"todo"}},g=()=>{if(!d.current)return;let h=d.current.getBoundingClientRect(),k=window.innerHeight,u=window.innerWidth,y=180,v=280,D=4,T=h.right-y;T<10&&(T=h.left),T+y>u-10&&(T=u-y-10);let M=k-h.bottom,x=h.top,L;M>=v+D?L=h.bottom+D:x>=v+D?L=h.top-v-D:L=M>=x?h.bottom+D:Math.max(10,h.top-v-D),p({top:L,left:T}),s(true);};react.useEffect(()=>{let h=k=>{m.current&&!m.current.contains(k.target)&&!d.current?.contains(k.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=k=>{k.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let f=h=>{t(h),s(false);},c=n(),w=c.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:d,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:`${w}10`,boxShadow:`0 0 0 2px ${w}30 inset`},title:c.label,children:jsxRuntime.jsx(Ul,{icon:c.icon,color:w})}),o&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${i.top}px`,left:`${i.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:l.map(h=>jsxRuntime.jsxs("button",{onClick:()=>f(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:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Ul,{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 Hl({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,i]=react.useState(false),[p,m]=react.useState(false),[d,l]=react.useState(e),[n,g]=react.useState({top:0,left:0}),f=react.useRef(null),c=react.useRef(null),w=react.useRef(null);react.useEffect(()=>{if(s&&c.current){let y=c.current.getBoundingClientRect();g({top:y.bottom+window.scrollY+8,left:y.left+window.scrollX});}},[s]),react.useEffect(()=>{let y=v=>{f.current&&!f.current.contains(v.target)&&!c.current?.contains(v.target)&&(i(false),m(false));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),react.useEffect(()=>{let y=v=>{v.key==="Escape"&&(i(false),m(false),l(e));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s,e]),react.useEffect(()=>{p&&w.current&&(w.current.focus(),w.current.select());},[p]);let h=()=>{m(true),l(e);},k=()=>{let y=d.trim();y&&y!==e&&t(y),m(false),i(false),l(e);},u=y=>{y.key==="Enter"?k():y.key==="Escape"&&(m(false),l(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>i(!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(lt,{children:jsxRuntime.jsx("div",{ref:f,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${n.top}px`,left:`${n.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:p?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:w,type:"text",value:d,onChange:y=>l(y.target.value),onKeyDown:u,onBlur:k,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick: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(),i(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 Vr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:i,onCardUpdate:p,availableUsers:m,allCards:d,enableVirtualization:l,cardHeight:n=120,isCollapsed:g,onToggleCollapse:f,onColumnRename:c,onColumnDelete:w,isDeletable:h=false,className:k})=>{let{setNodeRef:u,isOver:y}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),v=react.useRef(null),D=l??gl(t.length),T=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>v.current,estimateSize:()=>n,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:u,className:k,children:a(e,t)});let x=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let C=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:C}:C>=80?{state:"warning",percentage:C}:C>=60?{state:"approaching",percentage:C}:{state:"ok",percentage:C}})(),L=x.state==="exceeded",N=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:u,className:b("asakaa-column",y&&"ring-2 ring-asakaa-accent-blue",L&&"ring-2 ring-asakaa-accent-red",k),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:b(N()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&x.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${x.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[x.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),x.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),x.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),x.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(c||w)&&jsxRuntime.jsx(Hl,{columnTitle:e.title,onRename:C=>c?.(e.id,C),onDelete:w?()=>w(e.id):void 0,isDeletable:h}),f&&jsxRuntime.jsx("button",{onClick:f,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:v,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(C=>C.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):D?jsxRuntime.jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(C=>{let W=t[C.index];return W?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${C.start}px)`},children:jsxRuntime.jsx(Ka,{card:W,render:r,onClick:i,onUpdate:p,availableUsers:m,allCards:d})},W.id):null})}):t.map(C=>jsxRuntime.jsx(Ka,{card:C,render:r,onClick:i,onUpdate:p,availableUsers:m,allCards:d},C.id))})})]})});Vr.displayName="Column";function is({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,i]=react.useState(e),p=react.useRef(null);react.useEffect(()=>{r&&p.current&&(p.current.focus(),p.current.select());},[r]);let m=()=>{let l=s.trim();l&&l!==e?t(l):i(e),o(false);},d=l=>{l.key==="Enter"?m():l.key==="Escape"&&(i(e),o(false));};return r?jsxRuntime.jsx("input",{ref:p,type:"text",value:s,onChange:l=>i(l.target.value),onBlur:m,onKeyDown:d,className:b("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:b("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}var Qo=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function $a({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:i=true}){let[p,m]=react.useState(false),[d,l]=react.useState(""),[n,g]=react.useState(false),[f,c]=react.useState(Qo[10]||"#3B82F6"),[w,h]=react.useState({top:0,left:0}),k=react.useRef(null),u=react.useRef(null),y=react.useRef(null),v=react.useRef(null),D=t.filter(C=>C.name.toLowerCase().includes(d.toLowerCase())),T=t.some(C=>C.name.toLowerCase()===d.toLowerCase());react.useEffect(()=>{if(p&&u.current){let C=u.current.getBoundingClientRect();h({top:C.bottom+6,left:C.left});}},[p]),react.useEffect(()=>{let C=W=>{let I=W.target,K=k.current?.contains(I),V=y.current?.contains(I);!K&&!V&&(m(false),l(""),g(false));};if(p)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[p]),react.useEffect(()=>{p&&v.current&&v.current.focus();},[p]);let M=C=>{let W=e.some(I=>I.id===C.id);a(W?e.filter(I=>I.id!==C.id):[...e,C]);},x=async()=>{if(!(!r||!d.trim())){g(true);try{let C=await r(d.trim(),f);C&&(a([...e,C]),l(""),c(Qo[Math.floor(Math.random()*Qo.length)]||"#3B82F6"));}finally{g(false);}}},L=(C,W)=>{W.stopPropagation(),a(e.filter(I=>I.id!==C));},N={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:k,className:"relative",children:[jsxRuntime.jsxs("button",{ref:u,type:"button",onClick:()=>!s&&m(!p),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:N,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(C=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${C.color}20`,color:C.color},children:C.name},C.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:y,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:w.top,left:w.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:v,type:"text",value:d,onChange:C=>l(C.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:C=>{C.key==="Enter"&&d.trim()&&!T&&r&&x();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(C=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${C.color}20`,color:C.color},onClick:W=>L(C.id,W),children:[C.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},C.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:D.length>0?D.map(C=>{let W=e.some(I=>I.id===C.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>M(C),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:W?`${C.color}15`:"transparent",color:o.textPrimary},onMouseEnter:I=>{W||(I.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:I=>{W||(I.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:C.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:C.name}),W&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:C.color}})]},C.id)}):d.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"})}),d.trim()&&!T&&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:Qo.map(C=>jsxRuntime.jsx("button",{type:"button",onClick:()=>c(C),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:C,outline:f===C?`2px solid ${C}`:"none",outlineOffset:"2px"}},C))}),jsxRuntime.jsxs("button",{type:"button",onClick:x,disabled:n,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:f,color:"#FFFFFF",opacity:n?.7:1},children:[n?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 "',d.trim(),'"']})]})]})}),document.body)]})}function ds({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 jl({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(ds,{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]})]})}function Yl(e){if("title"in e&&!("name"in e)){let t=e,a=(t.assignedUserIds||[]).map(r=>({name:r,initials:r.substring(0,2).toUpperCase(),color:"#6366F1"}));return {id:t.id,name:t.title,startDate:t.startDate?new Date(t.startDate):void 0,endDate:t.endDate?new Date(t.endDate):void 0,progress:t.progress||0,status:t.columnId,priority:t.priority?.toLowerCase(),assignees:a,dependencies:Array.isArray(t.dependencies)?t.dependencies.map(r=>typeof r=="string"?r:r.taskId):[],tags:t.tags,subtasks:t.subtasks?.map(r=>({id:r.id,name:r.title,progress:r.completed?100:0,startDate:new Date,endDate:new Date})),color:t.color,description:t.description}}return e}function Wm(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 ms({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:i="es",availableUsers:p=[],availableTags:m=[],onCreateTag:d}){let l=s==="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)"},g=e&&"title"in e&&!("name"in e),f=e,[c,w]=react.useState(e?Yl(e):null),[h,k]=react.useState(false),[u,y]=react.useState(false),[v,D]=react.useState(null),[T,M]=react.useState(new Date),[x,L]=react.useState(false);react.useEffect(()=>{e&&w(Yl(e));},[e?.id]);let N=react.useCallback(z=>{w(z),g&&o&&f?o(Wm(z,f)):r&&r(z);},[g,f,o,r]),C=react.useCallback(()=>{k(false),y(false),D(null);},[]),W=react.useCallback((z,Q)=>{if(!c)return;let ue={...c,[z]:Q};N(ue);},[c,N]),I=react.useCallback(z=>{if(!c)return;let Q=c.progress||0;z==="completed"?Q=100:z==="in-progress"&&Q===0?Q=10:z==="todo"&&(Q=0);let ue={...c,status:z,progress:Q};N(ue),k(false);},[c,N]),K=react.useCallback((z,Q)=>{if(!c)return;let ue={...c,startDate:z,endDate:Q};N(ue);},[c,N]),V=react.useCallback(()=>{let z=T.getFullYear(),Q=T.getMonth(),ue=new Date(z,Q,1),B=new Date(z,Q+1,0).getDate(),A=ue.getDay(),R=[],P=new Date(z,Q,0).getDate();for(let q=A-1;q>=0;q--)R.push({date:new Date(z,Q-1,P-q),isCurrentMonth:false});for(let q=1;q<=B;q++)R.push({date:new Date(z,Q,q),isCurrentMonth:true});let J=42-R.length;for(let q=1;q<=J;q++)R.push({date:new Date(z,Q+1,q),isCurrentMonth:false});return R},[T]);return !t||!c?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:b("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:b("px-6 py-3 border-b flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:b("w-4 h-4",l?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:b("text-xs px-2 py-0.5 rounded",l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[i==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:b("text-xs font-mono",l?"text-[#6B7280]":"text-gray-400"),children:c.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:b("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",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:b("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:b("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:a,className:b("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 z=c.progress===100?0:100,ue={...c,progress:z,status:z===100?"completed":"todo"};N(ue);},className:b("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",c.progress===100?"bg-green-500 border-green-500":l?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:c.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:b("text-xl font-semibold flex-1",c.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:c.name})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:b("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{C(),k(!h);},className:b("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",c.progress===100||c.status==="completed"?"bg-green-500/20 text-green-400":c.progress&&c.progress>0||c.status==="in-progress"?"bg-blue-500/20 text-blue-400":l?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:c.progress===100||c.status==="completed"?i==="es"?"COMPLETADO":"DONE":c.progress&&c.progress>0||c.status==="in-progress"?i==="es"?"EN PROGRESO":"IN PROGRESS":i==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>k(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:i==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:i==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:i==="es"?"Completado":"Done",color:"bg-green-500"}].map(z=>jsxRuntime.jsxs("button",{onClick:()=>I(z.id),className:b("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",c.status===z.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",z.color)}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:z.label})]},z.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:b("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Asignados":"Assignees"}),c.assignees&&c.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[c.assignees.slice(0,3).map((z,Q)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:z.color||"#8B5CF6"},title:z.name,children:z.initials||z.name.slice(0,2).toUpperCase()},Q)),c.assignees.length>3&&jsxRuntime.jsxs("span",{className:b("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:["+",c.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:b("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:i==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:b("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{D(v?null:"start"),M(c.startDate||new Date);},className:b("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:[c.startDate?.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(i==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:b("mx-1",l?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),c.endDate?.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(i==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>D(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:b("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:z=>z.stopPropagation(),children:[jsxRuntime.jsx("div",{className:b("w-44 py-2 border-r",l?"border-white/10":"border-gray-200"),children:(()=>{let z=new Date,Q=new Date(z);Q.setDate(z.getDate()+1);let ue=new Date(z);ue.setDate(z.getDate()+7);let ve=new Date(z);return ve.setDate(z.getDate()+14),[{label:i==="es"?"Hoy":"Today",date:z},{label:i==="es"?"Ma\xF1ana":"Tomorrow",date:Q},{label:i==="es"?"Pr\xF3xima semana":"Next week",date:ue},{label:i==="es"?"2 semanas":"2 weeks",date:ve}].map((B,A)=>jsxRuntime.jsxs("button",{className:b("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:()=>{v==="start"?(K(B.date,c.endDate),D("end")):(K(c.startDate,B.date),D(null));},children:[jsxRuntime.jsx("span",{children:B.label}),jsxRuntime.jsx("span",{className:b("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:B.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]},A))})()}),jsxRuntime.jsxs("div",{className:"p-4 w-[280px]",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:b("text-sm font-medium",l?"text-white":"text-gray-900"),children:v==="start"?i==="es"?"Fecha inicio":"Start date":i==="es"?"Fecha fin":"End date"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>M(new Date(T.getFullYear(),T.getMonth()-1)),className:b("p-1 rounded",l?"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("span",{className:b("text-sm min-w-[100px] text-center",l?"text-white":"text-gray-900"),children:T.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>M(new Date(T.getFullYear(),T.getMonth()+1)),className:b("p-1 rounded",l?"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:(i==="es"?["L","M","M","J","V","S","D"]:["S","M","T","W","T","F","S"]).map((z,Q)=>jsxRuntime.jsx("div",{className:b("text-xs text-center py-1",l?"text-[#6B7280]":"text-gray-400"),children:z},Q))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:V().map((z,Q)=>{let ue=z.date.toDateString()===new Date().toDateString(),ve=c.startDate?.toDateString()===z.date.toDateString(),B=c.endDate?.toDateString()===z.date.toDateString(),A=c.startDate&&c.endDate&&z.date>=c.startDate&&z.date<=c.endDate;return jsxRuntime.jsx("button",{onClick:()=>{v==="start"?(K(z.date,c.endDate&&z.date>c.endDate?z.date:c.endDate),D("end")):(K(c.startDate&&z.date<c.startDate?z.date:c.startDate,z.date),D(null));},className:b("w-8 h-8 text-xs rounded-lg transition-colors",!z.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),z.isCurrentMonth&&(l?"text-white":"text-gray-900"),ue&&"ring-1 ring-blue-500",(ve||B)&&"bg-blue-500 text-white",A&&!ve&&!B&&(l?"bg-blue-500/20":"bg-blue-100"),l?"hover:bg-white/10":"hover:bg-gray-100"),children:z.date.getDate()},Q)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:b("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{C(),y(!u);},className:b("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",c.priority==="high"||c.priority==="urgent"?"bg-red-500/20 text-red-400":c.priority==="medium"?"bg-yellow-500/20 text-yellow-400":c.priority==="low"?"bg-green-500/20 text-green-400":l?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:c.priority?c.priority==="high"||c.priority==="urgent"?i==="es"?"Alta":"High":c.priority==="medium"?i==="es"?"Media":"Medium":i==="es"?"Baja":"Low":i==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>y(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:i==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:i==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:i==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:i==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:i==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(z=>jsxRuntime.jsxs("button",{onClick:()=>{W("priority",z.id),y(false);},className:b("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",c.priority===z.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",z.color)}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:z.label})]},z.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:b("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:b("text-sm",l?"text-white":"text-gray-900"),children:c.startDate&&c.endDate?`${Math.ceil((c.endDate.getTime()-c.startDate.getTime())/(1e3*60*60*24))} ${i==="es"?"d\xEDas":"days"}`:i==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded-full border-2",l?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[x?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:c.progress||0,onChange:z=>{let Q=parseInt(z.target.value),ue=c.status;Q===100?ue="completed":Q>0?ue="in-progress":ue="todo";let ve={...c,progress:Q,status:ue};N(ve);},onBlur:()=>L(false),className:b("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:()=>L(true),className:b("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:b("h-full rounded-full transition-all",c.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${c.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:b("text-sm font-medium min-w-[40px]",l?"text-white":"text-gray-900"),children:[c.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:b("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx($a,{selectedTags:c.tags||[],availableTags:m,onChange:z=>{W("tags",z);},onCreateTag:d,theme:n})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:b("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:b("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:c.dependencies&&c.dependencies.length>0?`${c.dependencies.length} ${i==="es"?"dependencias":"dependencies"}`:i==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:b("flex items-center gap-2 text-sm transition-colors",l?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),i==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:b("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"}),i==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:i==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",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"}),i==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:i==="es"?"Subtareas":"Subtasks"}),c.subtasks&&c.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:c.subtasks.map(z=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",z.progress===100?"bg-green-500 border-green-500":l?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:z.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:b("text-sm",z.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:z.name})]},z.id))}),jsxRuntime.jsxs("button",{className:b("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"}),i==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:b("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:b("text-sm font-semibold",l?"text-white":"text-gray-900"),children:i==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:b("p-1 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",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"}),i==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:i==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:b("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",l?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:b("w-6 h-6 mx-auto mb-2",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:b("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED para ",jsxRuntime.jsx("span",{className:"underline",children:"subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here to ",jsxRuntime.jsx("span",{className:"underline",children:"upload"})]})})]})]})]})]}),jsxRuntime.jsxs("div",{className:b("w-80 border-l flex flex-col",l?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:b("px-4 py-3 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("h3",{className:b("text-sm font-semibold",l?"text-white":"text-gray-900"),children:i==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:b("w-10 h-10 mb-3",l?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:b("text-sm",l?"text-[#6B7280]":"text-gray-500"),children:i==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:b("p-4 border-t",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:b("flex items-center gap-2 px-3 py-2 rounded-lg",l?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",placeholder:i==="es"?"Escribe un comentario...":"Write a comment...",className:b("flex-1 bg-transparent text-sm outline-none",l?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")}),jsxRuntime.jsx("button",{className:b("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]})})]})]})]})})}function gs(){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 lr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:i,style:p,isLoading:m,error:d,children:l,availableTags:n=[],onCreateTag:g}){let[f,c]=gs(),[w,h]=react.useState(null),k=o?.theme||"dark",u=k==="dark"||k==="neutral",y=u?"dark":"",v=react.useCallback((V,z)=>{t.onCardUpdate?.(V,z);},[t]),D=react.useCallback((V,z)=>{t.onColumnUpdate?.(V,{title:z});},[t]),T=react.useCallback(V=>{t.onColumnDelete?.(V);},[t]),M=["todo","in-progress","completed"],x=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),L=react.useMemo(()=>{let V=new Map;return e.columns.forEach(z=>{let Q=z.cardIds.map(ue=>e.cards.find(ve=>ve.id===ue)).filter(ue=>ue!==void 0).sort((ue,ve)=>ue.position-ve.position);V.set(z.id,Q);}),V},[e.cards,e.columns]),N=react.useCallback(V=>{let{active:z}=V,Q=e.cards.find(ue=>ue.id===z.id);Q&&c({isDragging:true,draggedCardId:Q.id,sourceColumnId:Q.columnId,targetColumnId:Q.columnId});},[e.cards,c]),C=react.useCallback(V=>{let{active:z,over:Q}=V;if(!Q||!e.cards.find(B=>B.id===z.id))return;let ve=null;Q.data.current?.type==="column"?ve=Q.id:Q.data.current?.type==="card"&&(ve=e.cards.find(A=>A.id===Q.id)?.columnId||null),ve&&ve!==f.targetColumnId&&c({...f,targetColumnId:ve});},[e.cards,f,c]),W=react.useCallback(async V=>{let{active:z,over:Q}=V;if(c({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!Q)return;let ue=e.cards.find(R=>R.id===z.id);if(!ue)return;let ve,B;if(Q.data.current?.type==="column"){ve=Q.id;let R=L.get(ve)||[];B=Zn(R,0);}else {let R=e.cards.find(q=>q.id===Q.id);if(!R)return;ve=R.columnId;let P=L.get(ve)||[],J=P.findIndex(q=>q.id===Q.id);B=Zn(P,J);}let A=e.columns.find(R=>R.id===ve);if(A&&A.wipLimit&&A.wipLimitType==="hard"){let R=L.get(ve)||[];if(ue.columnId!==ve&&R.length>=A.wipLimit){t.onWipLimitExceeded?.(A,ue);return}}(ue.columnId!==ve||ue.position!==B)&&await t.onCardMove?.(ue.id,ve,B);},[e.cards,e.columns,L,t,c]),I=react.useCallback(V=>{h(V),a?.(V);},[a]),K=react.useCallback(V=>{t.onCardUpdate?.(V.id,V),h(V);},[t]);return m?jsxRuntime.jsx("div",{className:b("asakaa-board",y,i),style:p,children:jsxRuntime.jsx(eu,{columnCount:3})}):d?jsxRuntime.jsx("div",{className:b("asakaa-board",y,i),style:p,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 d=="string"?d:d.message})]})})}):jsxRuntime.jsxs(Dl,{themeName:k,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:x,collisionDetection:core$1.closestCorners,onDragStart:N,onDragOver:C,onDragEnd:W,children:[jsxRuntime.jsxs("div",{className:b("asakaa-board",y,i),style:p,"data-theme":k,children:[e.columns.sort((V,z)=>V.position-z.position).map(V=>{let z=L.get(V.id)||[],Q=!M.includes(V.id);return jsxRuntime.jsx(Vr,{column:V,cards:z,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:I,onCardUpdate:v,onColumnRename:D,onColumnDelete:T,isDeletable:Q,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},V.id)}),l]}),jsxRuntime.jsx(core$1.DragOverlay,{children:f.draggedCardId?jsxRuntime.jsx(Ka,{card:e.cards.find(V=>V.id===f.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(ms,{task:w,isOpen:!!w,onClose:()=>h(null),onCardUpdate:K,theme:u?"dark":"light",locale:o?.locale==="es"?"es":"en",availableTags:n,onCreateTag:g})]})}function eu({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 nu={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)"},su={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)"},iu={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},lu={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function du({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,i]=react.useState(false),p=react.useRef(null);react.useEffect(()=>{let d=l=>{p.current&&!p.current.contains(l.target)&&i(false);};return s&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[s]);let m=d=>{t(d),i(false);};return jsxRuntime.jsxs("div",{ref:p,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(!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((d,l)=>d.position-l.position).map((d,l)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(d.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:l<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:l*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:d.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:d.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[d.cardIds.length," ",d.cardIds.length===1?"tarea":"tareas"]})]})]},d.id))]})})})]})}function cu({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,i]=react.useState(false),[p,m]=react.useState(null),d=react.useRef(null);if(react.useEffect(()=>{let f=c=>{d.current&&!d.current.contains(c.target)&&i(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),!(a||r||o))return null;let n=[{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(f=>f.handler),g=async(f,c)=>{if(c){m(f);try{await c();}catch(w){console.error(`Export ${f} failed:`,w);}finally{m(null),i(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(!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:n.map((f,c)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>g(f.id,f.handler),disabled:p!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:c<n.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:p===f.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"})}):f.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:f.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})})]})}function pu({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 hs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:i,onExportJSON:p,onExportExcel:m,translations:d}){let l=r==="dark"?nu:su,n={...o==="es"?iu:lu,...d},g=i||p||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:l.bgGrid,borderColor:l.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(cu,{theme:l,t:n,onExportCSV:i,onExportJSON:p,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:l.borderLight}})]}),t&&(s?jsxRuntime.jsx(du,{columns:e,onSelect:t,theme:l,t:n,createTaskLabel:a}):jsxRuntime.jsx(pu,{onClick:()=>t(),label:a||n.newTask}))]})})}function ys({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,i]=react.useState(false),[p,m]=react.useState(""),d=react.useCallback(()=>{let g=p.trim();g&&(e(g),m(""),i(false));},[p,e]),l=react.useCallback(g=>{g.key==="Enter"?(g.preventDefault(),d()):g.key==="Escape"&&(m(""),i(false));},[d]),n=react.useCallback(()=>{setTimeout(()=>{p.trim()||i(false);},150);},[p]);return s?jsxRuntime.jsx("div",{className:b("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:p,onChange:g=>m(g.target.value),onKeyDown:l,onBlur:n,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:d,disabled:!p.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{m(""),i(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:b("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>i(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 vs({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:i=false,theme:p="dark",locale:m="es"}){let[d,l]=react.useState(false),[n,g]=react.useState(false),[f,c]=react.useState(""),[w,h]=react.useState([]),[k,u]=react.useState(""),[y,v]=react.useState(""),[D,T]=react.useState(""),[M,x]=react.useState(false),[L,N]=react.useState(false),[C,W]=react.useState(false),I=react.useRef(null),K=react.useRef(null),V={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},z=react.useCallback(()=>{c(""),h([]),u(""),v(""),T(""),x(false),N(false),W(false),l(false);},[]);react.useEffect(()=>{d&&I.current&&I.current.focus();},[d]),react.useEffect(()=>{if(!d)return;let A=R=>{K.current&&!K.current.contains(R.target)&&(f.trim()||z());};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[d,f,z]);let Q=react.useCallback(async()=>{let A=f.trim();if(!(!A||n)){g(true);try{await t({name:A,columnId:e,assigneeIds:w.length>0?w:void 0,startDate:k?new Date(k):void 0,endDate:y?new Date(y):void 0,priority:D||void 0}),c(""),h([]),u(""),v(""),T(""),x(!1),N(!1),W(!1),I.current?.focus();}catch(R){console.error("Error creating card:",R);}finally{g(false);}}},[f,e,w,k,y,D,t,n]),ue=react.useCallback(A=>{A.key==="Enter"&&!A.shiftKey?(A.preventDefault(),Q()):A.key==="Escape"&&z();},[Q,z]),ve=react.useCallback(A=>{h(R=>R.includes(A)?R.filter(P=>P!==A):[...R,A]);},[]),B=p==="dark";return d?jsxRuntime.jsxs("div",{ref:K,className:b("rounded-lg overflow-hidden shadow-lg",B?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:I,type:"text",value:f,onChange:A=>c(A.target.value),onKeyDown:ue,placeholder:V.placeholder,disabled:n,className:b("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",B?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>x(!M),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",M||w.length>0?"bg-emerald-500/20 text-emerald-400":B?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:V.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),w.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:w.length})]}),jsxRuntime.jsx("button",{onClick:()=>N(!L),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",L||k||y?"bg-blue-500/20 text-blue-400":B?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:V.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>W(!C),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",C||D?D==="urgent"?"bg-red-500/20 text-red-400":D==="high"?"bg-orange-500/20 text-orange-400":D==="medium"?"bg-yellow-500/20 text-yellow-400":D==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":B?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:V.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:Q,disabled:!f.trim()||n,className:b("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:n?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):V.save})]})]}),M&&a.length>0&&jsxRuntime.jsx("div",{className:b("px-3 pb-3 pt-0","border-t",B?"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:()=>ve(A.id),className:b("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",w.includes(A.id)?"bg-emerald-500 text-white":B?"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:b("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",w.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))})}),L&&jsxRuntime.jsx("div",{className:b("px-3 pb-3 pt-0","border-t",B?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:b("block text-[10px] uppercase tracking-wide mb-1",B?"text-gray-500":"text-gray-400"),children:V.startDate}),jsxRuntime.jsx("input",{type:"date",value:k,onChange:A=>u(A.target.value),className:b("w-full px-2 py-1.5 rounded text-xs border",B?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:b("block text-[10px] uppercase tracking-wide mb-1",B?"text-gray-500":"text-gray-400"),children:V.endDate}),jsxRuntime.jsx("input",{type:"date",value:y,onChange:A=>v(A.target.value),className:b("w-full px-2 py-1.5 rounded text-xs border",B?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),C&&jsxRuntime.jsx("div",{className:b("px-3 pb-3 pt-0","border-t",B?"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:()=>T(D===A?"":A),className:b("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===A?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[A]} text-white`:B?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:V[A]},A))})})]}):jsxRuntime.jsxs("button",{onClick:()=>l(true),disabled:i,className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",B?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",i&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:V.buttonLabel})]})}var ko=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(lr,{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(i=>{i?o(i):s(new Error("Failed to create PNG blob"));},"image/png");})}};function nd(e={}){return new ko(e)}var Xr=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(i){console.error("Error in error handler:",i);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:i}=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:i?`Error in ${i}`:"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 xs(e,t){let a=r=>jsxRuntime.jsx(Xr,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ws({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:i,onPredictRisks:p,onOpenAIUsage:m,shortcut:d="k",className:l=""}){let[n,g]=react.useState(false),[f,c]=react.useState(""),[w,h]=react.useState("home"),[k,u]=react.useState(""),[y,v]=react.useState("");react.useEffect(()=>{let x=L=>{(L.metaKey||L.ctrlKey)&&L.key===d&&(L.preventDefault(),g(N=>!N)),L.key==="Escape"&&(g(false),h("home"),c(""));};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[d]),react.useEffect(()=>{n||(h("home"),c(""),u(""),v(""));},[n]);let D=react.useCallback(()=>{g(false);},[]),T=react.useCallback(x=>{let[L,N]=x.split(":");switch(L){case "create-card":h("create-card");break;case "create-card-in":u(N||"");break;case "navigate":N?(a?.(N),D()):h("navigate");break;case "search":r?.(f),D();break;case "priority":h("priority");break;case "set-priority":y&&N&&(o?.(y,N),D());break;case "assign":h("assign");break;case "assign-user":y&&N&&(s?.(y,N),D());break;case "ai":h("ai");break;case "ai-generate-plan":i?.(),D();break;case "ai-predict-risks":p?.(),D();break;case "ai-usage":m?.(),D();break;case "back":h("home");break;}},[f,y,t,a,r,o,s,i,p,m,D]),M=react.useCallback(()=>{k&&f.trim()&&(t?.(k,f.trim()),D());},[k,f,t,D]);return n?jsxRuntime.jsx(lt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:D,children:jsxRuntime.jsx("div",{className:`command-palette ${l}`,onClick:x=>x.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:f,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:w==="create-card"&&k?"Type card title and press Enter...":w==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:x=>{x.key==="Enter"&&w==="create-card"&&k&&M();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),w==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:T,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:T,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:T,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:T,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(x=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${x.id}`,onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:x.priority==="URGENT"?"#EF4444":x.priority==="HIGH"?"#F59E0B":x.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:x.title}),x.labels&&x.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:x.labels.slice(0,2).map(L=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:L},L))})]},x.id))})]}),w==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(x=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${x.id}`,onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:x.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[x.cardIds.length," cards"]})]},x.id))})]}),w==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(x=>{let L=e.columns.find(N=>N.id===x.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${x.id}`,onSelect:T,className:"command-palette-item",keywords:[x.title,x.description||"",...x.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:x.priority==="URGENT"?"#EF4444":x.priority==="HIGH"?"#F59E0B":x.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:x.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:L?.title})]}),x.labels&&x.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:x.labels.slice(0,2).map(N=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:N},N))})]},x.id)})})]}),w==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:T,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:T,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:T,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:T,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 ld(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let i=document.createElement("div");i.id="attachment-lightbox-native",i.className="attachment-lightbox",i.style.cssText=`
6
6
  position: fixed !important;
7
7
  inset: 0 !important;
8
8
  z-index: 2147483647 !important;
@@ -16,7 +16,7 @@
16
16
  max-height: 92vh !important;
17
17
  object-fit: contain !important;
18
18
  cursor: default !important;
19
- `,p.onclick=c=>c.stopPropagation();let m=document.createElement("div");m.className="attachment-lightbox-hint",m.textContent="Click anywhere or press ESC to close",m.style.cssText=`
19
+ `,p.onclick=n=>n.stopPropagation();let m=document.createElement("div");m.className="attachment-lightbox-hint",m.textContent="Click anywhere or press ESC to close",m.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 n=()=>{l.remove(),document.removeEventListener("keydown",d);},d=c=>{if(c.key==="Escape")n();else if(c.key==="ArrowLeft"&&a.length>1){let i=r>0?r-1:a.length-1;n(),o(i);}else if(c.key==="ArrowRight"&&a.length>1){let i=r<a.length-1?r+1:0;n(),o(i);}};if(l.onclick=n,document.addEventListener("keydown",d),a.length>1){let c=document.createElement("div");c.className="attachment-lightbox-dots",c.style.cssText=`
27
+ `;let d=()=>{i.remove(),document.removeEventListener("keydown",l);},l=n=>{if(n.key==="Escape")d();else if(n.key==="ArrowLeft"&&a.length>1){let g=r>0?r-1:a.length-1;d(),o(g);}else if(n.key==="ArrowRight"&&a.length>1){let g=r<a.length-1?r+1:0;d(),o(g);}};if(i.onclick=d,document.addEventListener("keydown",l),a.length>1){let n=document.createElement("div");n.className="attachment-lightbox-dots",n.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
- `,c.onclick=f=>f.stopPropagation(),a.forEach((f,h)=>{let g=document.createElement("button");g.className=`attachment-lightbox-dot ${h===r?"active":""}`,g.style.cssText=`
37
+ `,n.onclick=c=>c.stopPropagation(),a.forEach((c,w)=>{let h=document.createElement("button");h.className=`attachment-lightbox-dot ${w===r?"active":""}`,h.style.cssText=`
38
38
  width: 8px !important;
39
39
  height: 8px !important;
40
40
  border-radius: 50% !important;
41
- background: ${h===r?"white":"rgba(255, 255, 255, 0.3)"} !important;
41
+ background: ${w===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
- `,g.onclick=w=>{w.stopPropagation(),n(),o(h);},c.appendChild(g);});let i=document.createElement("button");i.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",i.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',i.style.cssText=`
45
+ `,h.onclick=k=>{k.stopPropagation(),d(),o(w);},n.appendChild(h);});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=`
46
46
  position: absolute !important;
47
47
  left: 0 !important;
48
48
  top: 0 !important;
@@ -55,7 +55,7 @@
55
55
  border: none !important;
56
56
  cursor: pointer !important;
57
57
  opacity: 0.5 !important;
58
- `,i.onmouseenter=()=>{i.style.opacity="1";},i.onmouseleave=()=>{i.style.opacity="0.5";},i.onclick=f=>{f.stopPropagation();let h=r>0?r-1:a.length-1;n(),o(h);};let u=document.createElement("button");u.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",u.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>',u.style.cssText=`
58
+ `,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=c=>{c.stopPropagation();let w=r>0?r-1:a.length-1;d(),o(w);};let f=document.createElement("button");f.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",f.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>',f.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
- `,u.onmouseenter=()=>{u.style.opacity="1";},u.onmouseleave=()=>{u.style.opacity="0.5";},u.onclick=f=>{f.stopPropagation();let h=r<a.length-1?r+1:0;n(),o(h);},l.appendChild(c),l.appendChild(i),l.appendChild(u);}l.appendChild(p),l.appendChild(m),document.body.appendChild(l),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function bu(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 yu(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 Ts(e){return e.startsWith("image/")}function Wa({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[l,p]=react.useState(false),[m,n]=react.useState(false),[d,c]=react.useState(null),i=react.useRef(null),u=react.useRef(e);u.current=e;let f=react.useCallback((k,B)=>{B.preventDefault(),B.stopPropagation();let N=u.current.filter(I=>Ts(I.type)),C=N.findIndex(I=>I.id===k.id),H=I=>{let K=u.current.filter($=>Ts($.type)),j=K[I];j&&ld(j.url,j.name,K,I,H);};ld(k.url,k.name,N,C,H);},[]),h=react.useCallback(k=>{let B=[],N=[];return e.length+k.length>s?(N.push(`Maximum ${s} files allowed`),{valid:B,errors:N}):(k.forEach(C=>{if(C.size/1048576>r){N.push(`${C.name} is too large (max ${r}MB)`);return}if(o&&!o.some(I=>C.type.match(I))){N.push(`${C.name} has invalid file type`);return}B.push(C);}),{valid:B,errors:N})},[e.length,s,r,o]),g=react.useCallback(async k=>{let{valid:B,errors:N}=h(k);if(N.length>0){c(N.join(", ")),setTimeout(()=>c(null),5e3);return}if(B.length!==0){n(true),c(null);try{await t?.(B);}catch(C){c(C instanceof Error?C.message:"Upload failed"),setTimeout(()=>c(null),5e3);}finally{n(false);}}},[h,t]),w=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),p(true);},[]),b=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),p(false);},[]),v=react.useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),x=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),p(false);let B=Array.from(k.dataTransfer.files);g(B);},[g]),T=react.useCallback(k=>{let B=k.target.files?Array.from(k.target.files):[];g(B),i.current&&(i.current.value="");},[g]),D=react.useCallback(()=>{i.current?.click();},[]),M=react.useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&a?.(k);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${l?"dragging":""} ${m?"uploading":""}`,onDragEnter:w,onDragLeave:b,onDragOver:v,onDrop:x,onClick:D,children:[jsxRuntime.jsx("input",{ref:i,type:"file",multiple:true,onChange:T,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:l?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),d&&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:d})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(k=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Ts(k.type)&&k.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:B=>f(k,B),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:k.thumbnailUrl||k.url,alt:k.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:yu(k.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:bu(k.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>M(k.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},k.id))})]})}function Ds({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:p=[],aiInsights:m=[],attachments:n=[],onAddComment:d,onDeleteComment:c,onUploadAttachments:i,onDeleteAttachment:u,onSuggestAssignee:f,onGenerateSubtasks:h,onEstimateEffort:g,currentUserId:w="user-1"}){let[b,v]=react.useState("details"),[x,T]=react.useState(false),[D,M]=react.useState({}),[k,B]=react.useState(""),[N,C]=react.useState(false),[H,I]=react.useState({});if(!t||!e)return null;let K=react.useCallback(()=>{T(false),M({}),v("details"),B(""),I({}),a();},[a]),j=react.useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),M({}),T(false));},[e.id,D,r]),$=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),K());},[e.id,o,K]),Z=react.useCallback(()=>{d&&k.trim()&&(d(e.id,k.trim()),B(""));},[e.id,k,d]),ce=react.useCallback(async()=>{if(f){C(true);try{let P=await f(e);I(X=>({...X,assignees:P}));}catch(P){console.error("Failed to suggest assignee:",P);}finally{C(false);}}},[e,f]),he=react.useCallback(async()=>{if(h){C(true);try{let P=await h(e);I(X=>({...X,subtasks:P}));}catch(P){console.error("Failed to generate subtasks:",P);}finally{C(false);}}},[e,h]),R=react.useCallback(async()=>{if(g){C(true);try{let P=await g(e);I(X=>({...X,effort:P}));}catch(P){console.error("Failed to estimate effort:",P);}finally{C(false);}}},[e,g]),A={...e,...D},O=s.filter(P=>A.assignedUserIds?.includes(P.id));return jsxRuntime.jsx(nt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:K,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:A.priority==="URGENT"?"#EF4444":A.priority==="HIGH"?"#F59E0B":A.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsxRuntime.jsx("input",{type:"text",value:D.title??A.title,onChange:P=>M({...D,title:P.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:[x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:j,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{T(false),M({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>T(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:$,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:()=>v("details"),className:`card-detail-tab ${b==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>v("comments"),className:`card-detail-tab ${b==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>v("activity"),className:`card-detail-tab ${b==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",p.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:p.length})]}),jsxRuntime.jsxs("button",{onClick:()=>v("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>v("ai"),className:`card-detail-tab ${b==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[b==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),x?jsxRuntime.jsx("textarea",{value:D.description??A.description??"",onChange:P=>M({...D,description:P.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"}),x?jsxRuntime.jsx("select",{multiple:true,value:D.assignedUserIds??A.assignedUserIds??[],onChange:P=>{let X=Array.from(P.target.selectedOptions,Y=>Y.value);M({...D,assignedUserIds:X});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(P=>jsxRuntime.jsx("option",{value:P.id,children:P.name},P.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:O.length>0?O.map(P=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:P.color},children:P.initials}),jsxRuntime.jsx("span",{children:P.name})]},P.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),x?jsxRuntime.jsxs("select",{value:D.priority??A.priority??"",onChange:P=>M({...D,priority:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background: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(P=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:P},P)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),x?jsxRuntime.jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:A.startDate?new Date(A.startDate).toISOString().split("T")[0]:"",onChange:P=>M({...D,startDate:P.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"}),x?jsxRuntime.jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:A.endDate?new Date(A.endDate).toISOString().split("T")[0]:"",onChange:P=>M({...D,endDate:P.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"}),x?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??A.estimatedTime??"",onChange:P=>M({...D,estimatedTime:P.target.value?parseFloat(P.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children: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(P=>{let X=typeof P=="string"?P:P.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",X.slice(-4)]},X)}):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"})]})]}),b==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:k,onChange:P=>B(P.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:Z,disabled:!k.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:l.length>0?l.map(P=>{let X=s.find(Y=>Y.id===P.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[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-comment-author-name",children:X?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(P.createdAt).toLocaleString()})]})]}),c&&jsxRuntime.jsx("button",{onClick:()=>c(P.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:P.content})]},P.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),b==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:p.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:p.map(P=>{let X=s.find(Y=>Y.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[P.type.includes("CREATED")&&"\u2795",P.type.includes("UPDATED")&&"\u270F\uFE0F",P.type.includes("MOVED")&&"\u27A1\uFE0F",P.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",P.type.includes("COMMENT")&&"\u{1F4AC}",P.type.includes("ASSIGNED")&&"\u{1F464}",P.type.includes("PRIORITY")&&"\u{1F3AF}",P.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",P.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:X?.name||"Unknown"})," ",P.type.replace(/_/g," ").toLowerCase(),P.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:P.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(P.timestamp).toLocaleString()})]})]},P.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),b==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Wa,{cardId:e.id,attachments:n,onUpload:i?P=>i(e.id,P):void 0,onDelete:u,currentUserId:w,maxSizeMB:10,maxFiles:20})}),b==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:ce,disabled:N||!f,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:he,disabled:N||!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("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:R,disabled:N||!g,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),H.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),H.assignees.map((P,X)=>{let Y=s.find(U=>U.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[Y&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:Y.color},children:Y.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:Y?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:P.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(P.confidence*100).toFixed(0),"%"]})]})]},X)})]}),H.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),H.subtasks.map((P,X)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:P.title}),P.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:P.description}),P.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",P.estimatedTime,"h"]})]},X))]}),H.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[H.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(H.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(P=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${P.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:P.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:P.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:P.description}),P.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",P.suggestedAction]})]},P.id))]}),!H.assignees&&!H.subtasks&&!H.effort&&m.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Co({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:l=""}){let[p,m]=react.useState({top:0,left:0}),n=react.useRef(null),d=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let c=e.current.getBoundingClientRect(),i=window.innerHeight,u=window.innerWidth,f=4,h=c.left;h+o>u-10&&(h=u-o-10),h<10&&(h=10);let g=i-c.bottom,w=c.top,b;return g>=s+f?b=c.bottom+f:w>=s+f?b=c.top-s-f:g>=w?b=c.bottom+f:b=Math.max(10,c.top-s-f),{top:b,left:h}},[e,o,s]);return react.useEffect(()=>{t&&m(d());},[t,d]),react.useEffect(()=>{if(!t)return;let c=u=>{let f=u.target;n.current&&!n.current.contains(f)&&e.current&&!e.current.contains(f)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",c);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",c);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let c=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),t?jsxRuntime.jsx(nt,{children:jsxRuntime.jsx("div",{ref:n,className:`smart-popover ${l}`,style:{position:"fixed",top:`${p.top}px`,left:`${p.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:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var Nu=["LOW","MEDIUM","HIGH","URGENT"],Su=["todo","in-progress","review","done"];function Es({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:p=[],onAddComment:m,onDeleteComment:n,currentUser:d,onAIGenerateDescription:c,onAICreateSubtasks:i,onAIFindSimilar:u,availableColumns:f=[],availableLabels:h=[],availableTags:g=[],onCreateTag:w,onUploadCoverImage:b,unsplashAccessKey:v,theme:x,onSubtasksChange:T,attachments:D=[],onUploadAttachments:M,onDeleteAttachment:k}){let B=Hr(),N=x||B?.themeName||"dark",[C,H]=react.useState(e),[I,K]=react.useState(false),[j,$]=react.useState(e?.subtasks||[]),[Z,ce]=react.useState(false),[he,R]=react.useState(""),[A,O]=react.useState(""),[P,X]=react.useState("all"),[Y,U]=react.useState(false),[Se,Te]=react.useState(false),[He,xe]=react.useState(false),[at,Le]=react.useState(false),[et,vt]=react.useState(false),[Pt,ct]=react.useState(false),z=react.useRef(null),se=react.useRef(null),fe=react.useRef(null),Ne=react.useRef(null),Ae=react.useRef(null),rt=react.useRef(null),ft=react.useRef(null),Re=react.useRef(null),L=react.useRef(null),Q=react.useRef(null),_e=react.useRef(null),Ge=react.useRef(null);react.useEffect(()=>{e&&!C?(H({...e}),$(e.subtasks||[])):e&&C&&e.id!==C.id&&(H({...e}),$(e.subtasks||[]));},[e,C]),react.useEffect(()=>{let W=J=>{let Ie=J.target;Ne.current&&!Ne.current.contains(Ie)&&U(false),Ae.current&&!Ae.current.contains(Ie)&&Te(false),rt.current&&!rt.current.contains(Ie)&&xe(false),ft.current&&!ft.current.contains(Ie)&&Le(false);};if(Y||Se||He||at)return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[Y,Se,He,at]),react.useEffect(()=>{if(!t)return;let W=J=>{let Ie=J.target,wt=Ie.tagName==="INPUT"||Ie.tagName==="TEXTAREA"||Ie.isContentEditable;if(J.key==="Escape"){J.preventDefault(),Y||Se||He||at||et||Pt?(U(false),Te(false),xe(false),Le(false),vt(false),ct(false)):wt||a();return}if(wt&&J.key!=="Escape")return;let ot=J.metaKey||J.ctrlKey;switch(J.key.toLowerCase()){case "s":J.preventDefault(),U(true);break;case "a":J.preventDefault(),xe(true);break;case "p":J.preventDefault(),Te(true);break;case "l":J.preventDefault(),Le(true);break;case "d":ot||(J.preventDefault(),vt(true),setTimeout(()=>Re.current?.focus(),0));break;case "e":ot||(J.preventDefault(),ct(true));break;case "i":J.preventDefault(),K(true),setTimeout(()=>se.current?.focus(),0);break;case "t":J.preventDefault(),ce(true);break;case "c":J.preventDefault(),fe.current?.focus();break}};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[t,a,Y,Se,He,at,et,Pt]);let kt=react.useCallback(W=>{let J=W.currentTarget.textContent?.trim()||"";if(C&&J!==C.title){let Ie={...C,title:J};H(Ie),r?.(C.id,{title:J});}},[C,r]),ae=react.useCallback(W=>{W.key==="Enter"&&(W.preventDefault(),W.currentTarget.blur()),W.key==="Escape"&&(W.preventDefault(),W.currentTarget.textContent=C?.title||"",W.currentTarget.blur());},[C]),ie=react.useCallback(()=>{C&&e&&C.description!==e.description&&r?.(C.id,{description:C.description}),K(false);},[C,e,r]),we=react.useCallback(W=>{if(C){let J={...C,columnId:W};H(J),r?.(C.id,{columnId:W}),U(false);}},[C,r]),De=react.useCallback(W=>{if(C){let J={...C,priority:W};H(J),r?.(C.id,{priority:W}),Te(false);}},[C,r]),le=react.useCallback(W=>{if(C){let J=C.assignedUserIds||[],Ie=J.includes(W)?J.filter(ot=>ot!==W):[...J,W],wt={...C,assignedUserIds:Ie};H(wt),r?.(C.id,{assignedUserIds:Ie});}},[C,r]),Pe=react.useCallback(W=>{if(C){let J=C.labels||[],Ie=J.includes(W)?J.filter(ot=>ot!==W):[...J,W],wt={...C,labels:Ie};H(wt),r?.(C.id,{labels:Ie});}},[C,r]),ke=react.useCallback(W=>{if(C){let J={...C,tags:W};H(J),r?.(C.id,{tags:W});}},[C,r]),Ee=react.useCallback(W=>{if(C){let J=W.target.value,Ie={...C,endDate:J};H(Ie),r?.(C.id,{endDate:J}),vt(false);}},[C,r]),pe=react.useCallback(W=>{if(C){let J={...C,estimatedTime:parseFloat(W)||0};H(J),r?.(C.id,{estimatedTime:parseFloat(W)||0});}},[C,r]),ze=react.useCallback(()=>{if(he.trim()&&C){let W={id:`subtask-${Date.now()}`,title:he.trim(),completed:false,createdAt:new Date},J=[...j,W];$(J),R(""),ce(false),T?.(C.id,J);}},[he,j,C,T]),Be=react.useCallback(W=>{let J=j.map(Ie=>Ie.id===W?{...Ie,completed:!Ie.completed,updatedAt:new Date}:Ie);$(J),C&&T?.(C.id,J);},[j,C,T]),Ye=react.useCallback(W=>{let J=j.filter(Ie=>Ie.id!==W);$(J),C&&T?.(C.id,J);},[j,C,T]),ht=react.useCallback(()=>{A.trim()&&C&&m&&(m(C.id,A.trim()),O(""));},[A,C,m]),Kt=react.useCallback(W=>{(W.metaKey||W.ctrlKey)&&W.key==="Enter"&&(W.preventDefault(),ht());},[ht]),q=W=>jsxRuntime.jsx(Cu__default.default,{remarkPlugins:[Tu__default.default],rehypePlugins:[Du__default.default],components:{a:({node:J,...Ie})=>jsxRuntime.jsx("a",{...Ie,target:"_blank",rel:"noopener noreferrer"})},children:W}),te=p.filter(W=>P==="comments"?W.type.includes("COMMENT"):P==="history"?!W.type.includes("COMMENT"):true);if(!t||!e)return null;let Me=C||e,Ve=s.filter(W=>Me.assignedUserIds?.includes(W.id)),$e=j.filter(W=>W.completed).length;return jsxRuntime.jsx(nt,{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:W=>W.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":N,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:z,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:kt,onKeyDown:ae,children:Me.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:Ne,children:[jsxRuntime.jsxs("button",{ref:L,className:"modal-v2-field",onClick:()=>U(!Y),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Me.columnId||"No status"})]}),jsxRuntime.jsx(Co,{triggerRef:L,isOpen:Y,onClose:()=>U(false),width:250,estimatedHeight:200,children:(f.length>0?f:Su.map(W=>({id:W,title:W}))).map(W=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${Me.columnId===W.id?"active":""}`,onClick:()=>we(W.id),children:W.title},W.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:rt,children:[jsxRuntime.jsxs("button",{ref:Q,className:"modal-v2-field",onClick:()=>xe(!He),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:Ve.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Ve.map(W=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:W.color},title:W.name,children:W.initials},W.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Co,{triggerRef:Q,isOpen:He,onClose:()=>xe(false),width:280,estimatedHeight:300,children:s.map(W=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Me.assignedUserIds?.includes(W.id)?"active":""}`,onClick:()=>le(W.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:W.color},children:W.initials}),W.name,Me.assignedUserIds?.includes(W.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"})})]},W.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ae,children:[jsxRuntime.jsxs("button",{ref:_e,className:"modal-v2-field",onClick:()=>Te(!Se),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"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:Me.priority||"None"})]}),jsxRuntime.jsxs(Co,{triggerRef:_e,isOpen:Se,onClose:()=>Te(false),width:180,estimatedHeight:220,children:[Nu.map(W=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${W.toLowerCase()} ${Me.priority===W?"active":""}`,onClick:()=>De(W),children:W},W)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>De(""),children:"None"})]})]}),g.length>0||w?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(sr,{selectedTags:Me.tags||[],availableTags:g,onChange:ke,onCreateTag:w,theme:je[N]||je.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ft,children:[jsxRuntime.jsxs("button",{ref:Ge,className:"modal-v2-field",onClick:()=>Le(!at),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:Me.labels&&Me.labels.length>0?jsxRuntime.jsx("span",{children:Me.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Co,{triggerRef:Ge,isOpen:at,onClose:()=>Le(false),width:220,estimatedHeight:200,children:(h.length>0?h:["Bug","Feature","Enhancement","Documentation"]).map(W=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Me.labels?.includes(W)?"active":""}`,onClick:()=>Pe(W),children:[W,Me.labels?.includes(W)&&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"})})]},W))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{vt(!et),setTimeout(()=>Re.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:Me.endDate?new Date(Me.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Re,type:"date",value:typeof Me.endDate=="string"?Me.endDate.split("T")[0]:Me.endDate?(()=>{let W=new Date(Me.endDate),J=W.getUTCFullYear(),Ie=String(W.getUTCMonth()+1).padStart(2,"0"),wt=String(W.getUTCDate()).padStart(2,"0");return `${J}-${Ie}-${wt}`})():"",onChange:Ee,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>ct(!Pt),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:Me.estimatedTime?`${Me.estimatedTime}h`:"Not set"})]}),Pt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Me.estimatedTime||"",onChange:W=>pe(W.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>ct(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"})]}),I?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:Me.description||"",onChange:W=>{if(C){let J={...C,description:W.target.value};H(J);}},onBlur:ie,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>K(true),children:Me.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:q(Me.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"}),j.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[$e,"/",j.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:[j.map(W=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${W.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Be(W.id),children:W.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:W.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ye(W.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"})]})})]},W.id)),Z&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:he,onChange:W=>R(W.target.value),onKeyDown:W=>{W.key==="Enter"&&ze(),W.key==="Escape"&&(ce(false),R(""));},onBlur:ze,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(M||D.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),D.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:D.length})]}),jsxRuntime.jsx(Wa,{cardId:Me.id,attachments:D,onUpload:M?W=>M(Me.id,W):void 0,onDelete:k,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${P==="all"?"active":""}`,onClick:()=>X("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${P==="comments"?"active":""}`,onClick:()=>X("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${P==="history"?"active":""}`,onClick:()=>X("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[d&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:d.color},children:d.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:fe,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:A,onChange:W=>O(W.target.value),onKeyDown:Kt,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:ht,disabled:!A.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[te.map(W=>{let J=s.find(wt=>wt.id===W.userId);if(W.type.includes("COMMENT")){let wt=l.find(ot=>ot.id===W.metadata?.commentId);return wt?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[J&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:J.color},children:J.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:J?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:wt.content})]})]},W.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[W.type.includes("CREATED")&&"\u2795",W.type.includes("UPDATED")&&"\u270F\uFE0F",W.type.includes("MOVED")&&"\u27A1\uFE0F",W.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",W.type.includes("ASSIGNED")&&"\u{1F464}",W.type.includes("PRIORITY")&&"\u{1F3AF}",W.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:J?.name||"Unknown"})," ",W.type.replace(/_/g," ").toLowerCase(),W.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:W.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]})]},W.id)}),te.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 Ru({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 Ms({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(l=>({...l,average:l.average??e.reduce((p,m)=>p+m.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ru,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((l,p)=>l+p.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((l,p)=>l+p.completed,0)/e.length).toFixed(1)})]}),o&&e.some(l=>l.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((l,p)=>l+(p.planned||0),0)})]})]})]})}function Vu({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 As({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),l=e[e.length-1]?.remaining||0,p=e[e.length-1]?.ideal||0,m=s>0?(s-l)/s*100:0,n=l<=p;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(Vu,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",fill:n?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:n?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:m>=50?"#10B981":"#F59E0B"},children:[m.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:n?"#10B981":"#EF4444"},children:l})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:n?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:n?"#10B981":"#EF4444"},children:n?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var eg={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},bd=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function tg({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let l=r+(o-r)*.5,p=e+l*Math.cos(-a*(Math.PI/180)),m=t+l*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:p,y:m,fill:"white",textAnchor:p>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function yd({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:a.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[o,"%"]})]})]})}function Is({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,n)=>m+n.value,0),l=e.map(m=>({...m,totalValue:s,color:m.color||eg[m.name]||bd[e.indexOf(m)%bd.length]})),p=l.map(m=>m.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:l,cx:"50%",cy:"50%",labelLine:false,label:o?tg:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:l.map((m,n)=>jsxRuntime.jsx(recharts.Cell,{fill:p[n]},`cell-${n}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(yd,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,n)=>{let d=n.payload,c=s>0?(d.value/s*100).toFixed(0):"0";return `${m} (${d.value} - ${c}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:l,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(yd,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:l.map((m,n)=>jsxRuntime.jsx(recharts.Cell,{fill:p[n]},`cell-${n}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((m,n)=>n.value>m.value?n:m).name})]})]})]})}var nn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[l,p]=react.useState(false),[m,n]=react.useState(false),[d,c]=react.useState(false),[i,u]=react.useState(false);if(e.length===0)return null;let f=e.map(x=>x.id),h=x=>{r.onBulkUpdate?.(f,{priority:x}),p(false);},g=x=>{r.onBulkMove?.(f,x),n(false),a();},w=x=>{r.onBulkUpdate?.(f,{assignedUserIds:x}),c(false);},b=x=>{let T=new Set;e.forEach(M=>{M.labels?.forEach(k=>T.add(k));});let D=Array.from(new Set([...T,...x]));r.onBulkUpdate?.(f,{labels:D}),u(false);},v=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(f),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:()=>p(!l),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(x),children:[jsxRuntime.jsx("span",{className:y("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>n(!m),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(x.id),children:x.title},x.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!d),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>w([x.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!i),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([x]),children:x},x))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:v,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"})})]})]})})});nn.displayName="BulkOperationsToolbar";function sg(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,l,p,m,n;switch(t){case "assignee":let d=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);d.length>0?d.forEach(u=>{let f=a?.find(h=>h.id===u);l=`assignee-${u}`,p=f?.name||`User ${u}`,m=f?.color,n=f?.avatar,r.has(l)||r.set(l,{id:l,title:p,groupValue:u,cardIds:[],color:m,icon:n}),r.get(l).cardIds.push(o.id);}):(l="assignee-unassigned",p="Unassigned",m="#6b7280",n="\u{1F464}",r.has(l)||r.set(l,{id:l,title:p,groupValue:null,cardIds:[],color:m,icon:n}),r.get(l).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",l=`priority-${s}`;let i={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];p=i.title,m=i.color,r.has(l)||r.set(l,{id:l,title:p,groupValue:s,cardIds:[],color:m}),r.get(l).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{l=`label-${u}`,p=u,m="#6b7280",r.has(l)||r.set(l,{id:l,title:p,groupValue:u,cardIds:[],color:m}),r.get(l).cardIds.push(o.id);}):(l="label-none",p="No Labels",m="#6b7280",r.has(l)||r.set(l,{id:l,title:p,groupValue:null,cardIds:[],color:m}),r.get(l).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Ls({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,l]=react.useState(new Set),p=react.useMemo(()=>sg(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(n=>{l(d=>{let c=new Set(d);return c.has(n)?c.delete(n):c.add(n),c});},[]);return t.groupBy==="none"||p.length===0?jsxRuntime.jsx(lr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:y("asakaa-swimlane-view",o),children:[p.map(n=>{let d=s.has(n.id),c=e.cards.filter(u=>n.cardIds.includes(u.id)),i={...e,cards:c};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(n.id),style:{borderLeft:n.color?`4px solid ${n.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:n.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:n.color},children:n.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",n.cardIds.length," ",n.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":d?"Expand lane":"Collapse lane",children:d?"\u25B6":"\u25BC"})]}),!d&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(lr,{board:i,callbacks:r,availableUsers:a})})]},n.id)}),p.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 Fs=[{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 Bs({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null),p=Fs.find(n=>n.value===e)||Fs[0];react.useEffect(()=>{function n(d){s.current&&!s.current.contains(d.target)&&l.current&&!l.current.contains(d.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let m=n=>{t(n),o(false);};return jsxRuntime.jsxs("div",{className:y("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:p.icon}),jsxRuntime.jsx("span",{children:p.label}),jsxRuntime.jsx("svg",{className:y("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:Fs.map(n=>jsxRuntime.jsxs("button",{onClick:()=>m(n.value),className:y("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===n.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:n.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:n.label}),e===n.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:n.description})]})]},n.value))})]})]})}var To=[{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 dg(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(n=>e.key===n||e.code===n))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,l=o.shift?e.shiftKey:!e.shiftKey,p=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&l&&p&&m}function Cd(e={}){let{shortcuts:t=To,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 l=react.useCallback(m=>{o.current=[...o.current,m];},[]),p=react.useCallback(m=>{o.current=o.current.filter(n=>n.action!==m);},[]);return react.useEffect(()=>{function m(n){if(!s.current)return;let d=n.target;if(!((d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.isContentEditable)&&n.key!=="Escape"&&!n.ctrlKey&&!n.metaKey)){for(let c of o.current)if(dg(n,c)){r&&n.preventDefault();let i=new CustomEvent("keyboard-action",{detail:c.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:l,unregisterShortcut:p,isEnabled:a}}function pg(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function mg(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 ug(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=mg(e),r=t?pg(t):"";return a?`${a} + ${r}`:r}function gg(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 Rs({shortcuts:e=To,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function p(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,a]),!o||!t)return null;let l=gg(e);return jsxRuntime.jsxs("div",{className:y("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(l).map(([p,m])=>m.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),p]}),jsxRuntime.jsx("div",{className:"space-y-3",children:m.map(n=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:n.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:ug(n)})]},n.action))})]},p))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Os=[{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
+ `,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=c=>{c.stopPropagation();let w=r<a.length-1?r+1:0;d(),o(w);},i.appendChild(n),i.appendChild(g),i.appendChild(f);}i.appendChild(p),i.appendChild(m),document.body.appendChild(i),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function bu(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 yu(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 Ts(e){return e.startsWith("image/")}function Ha({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[i,p]=react.useState(false),[m,d]=react.useState(false),[l,n]=react.useState(null),g=react.useRef(null),f=react.useRef(e);f.current=e;let c=react.useCallback((x,L)=>{L.preventDefault(),L.stopPropagation();let N=f.current.filter(I=>Ts(I.type)),C=N.findIndex(I=>I.id===x.id),W=I=>{let K=f.current.filter(z=>Ts(z.type)),V=K[I];V&&ld(V.url,V.name,K,I,W);};ld(x.url,x.name,N,C,W);},[]),w=react.useCallback(x=>{let L=[],N=[];return e.length+x.length>s?(N.push(`Maximum ${s} files allowed`),{valid:L,errors:N}):(x.forEach(C=>{if(C.size/1048576>r){N.push(`${C.name} is too large (max ${r}MB)`);return}if(o&&!o.some(I=>C.type.match(I))){N.push(`${C.name} has invalid file type`);return}L.push(C);}),{valid:L,errors:N})},[e.length,s,r,o]),h=react.useCallback(async x=>{let{valid:L,errors:N}=w(x);if(N.length>0){n(N.join(", ")),setTimeout(()=>n(null),5e3);return}if(L.length!==0){d(true),n(null);try{await t?.(L);}catch(C){n(C instanceof Error?C.message:"Upload failed"),setTimeout(()=>n(null),5e3);}finally{d(false);}}},[w,t]),k=react.useCallback(x=>{x.preventDefault(),x.stopPropagation(),p(true);},[]),u=react.useCallback(x=>{x.preventDefault(),x.stopPropagation(),p(false);},[]),y=react.useCallback(x=>{x.preventDefault(),x.stopPropagation();},[]),v=react.useCallback(x=>{x.preventDefault(),x.stopPropagation(),p(false);let L=Array.from(x.dataTransfer.files);h(L);},[h]),D=react.useCallback(x=>{let L=x.target.files?Array.from(x.target.files):[];h(L),g.current&&(g.current.value="");},[h]),T=react.useCallback(()=>{g.current?.click();},[]),M=react.useCallback(x=>{confirm("Are you sure you want to delete this attachment?")&&a?.(x);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${i?"dragging":""} ${m?"uploading":""}`,onDragEnter:k,onDragLeave:u,onDragOver:y,onDrop:v,onClick:T,children:[jsxRuntime.jsx("input",{ref:g,type:"file",multiple:true,onChange:D,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:i?"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"]})]})})]}),l&&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:l})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(x=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Ts(x.type)&&x.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:L=>c(x,L),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:x.thumbnailUrl||x.url,alt:x.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:yu(x.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:x.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:x.name,children:x.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:bu(x.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(x.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>M(x.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"})})})]},x.id))})]})}function Ds({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:i=[],activities:p=[],aiInsights:m=[],attachments:d=[],onAddComment:l,onDeleteComment:n,onUploadAttachments:g,onDeleteAttachment:f,onSuggestAssignee:c,onGenerateSubtasks:w,onEstimateEffort:h,currentUserId:k="user-1"}){let[u,y]=react.useState("details"),[v,D]=react.useState(false),[T,M]=react.useState({}),[x,L]=react.useState(""),[N,C]=react.useState(false),[W,I]=react.useState({});if(!t||!e)return null;let K=react.useCallback(()=>{D(false),M({}),y("details"),L(""),I({}),a();},[a]),V=react.useCallback(()=>{r&&Object.keys(T).length>0&&(r(e.id,T),M({}),D(false));},[e.id,T,r]),z=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),K());},[e.id,o,K]),Q=react.useCallback(()=>{l&&x.trim()&&(l(e.id,x.trim()),L(""));},[e.id,x,l]),ue=react.useCallback(async()=>{if(c){C(true);try{let P=await c(e);I(J=>({...J,assignees:P}));}catch(P){console.error("Failed to suggest assignee:",P);}finally{C(false);}}},[e,c]),ve=react.useCallback(async()=>{if(w){C(true);try{let P=await w(e);I(J=>({...J,subtasks:P}));}catch(P){console.error("Failed to generate subtasks:",P);}finally{C(false);}}},[e,w]),B=react.useCallback(async()=>{if(h){C(true);try{let P=await h(e);I(J=>({...J,effort:P}));}catch(P){console.error("Failed to estimate effort:",P);}finally{C(false);}}},[e,h]),A={...e,...T},R=s.filter(P=>A.assignedUserIds?.includes(P.id));return jsxRuntime.jsx(lt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:K,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:A.priority==="URGENT"?"#EF4444":A.priority==="HIGH"?"#F59E0B":A.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),v?jsxRuntime.jsx("input",{type:"text",value:T.title??A.title,onChange:P=>M({...T,title:P.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:[v?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:V,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{D(false),M({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>D(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:z,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick: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:()=>y("details"),className:`card-detail-tab ${u==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>y("comments"),className:`card-detail-tab ${u==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>y("activity"),className:`card-detail-tab ${u==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",p.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:p.length})]}),jsxRuntime.jsxs("button",{onClick:()=>y("attachments"),className:`card-detail-tab ${u==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",d.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxRuntime.jsxs("button",{onClick:()=>y("ai"),className:`card-detail-tab ${u==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[u==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),v?jsxRuntime.jsx("textarea",{value:T.description??A.description??"",onChange:P=>M({...T,description:P.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"}),v?jsxRuntime.jsx("select",{multiple:true,value:T.assignedUserIds??A.assignedUserIds??[],onChange:P=>{let J=Array.from(P.target.selectedOptions,q=>q.value);M({...T,assignedUserIds:J});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(P=>jsxRuntime.jsx("option",{value:P.id,children:P.name},P.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:R.length>0?R.map(P=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:P.color},children:P.initials}),jsxRuntime.jsx("span",{children:P.name})]},P.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),v?jsxRuntime.jsxs("select",{value:T.priority??A.priority??"",onChange:P=>M({...T,priority:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background: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(P=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:P},P)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),v?jsxRuntime.jsx("input",{type:"date",value:T.startDate?new Date(T.startDate).toISOString().split("T")[0]:A.startDate?new Date(A.startDate).toISOString().split("T")[0]:"",onChange:P=>M({...T,startDate:P.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"}),v?jsxRuntime.jsx("input",{type:"date",value:T.endDate?new Date(T.endDate).toISOString().split("T")[0]:A.endDate?new Date(A.endDate).toISOString().split("T")[0]:"",onChange:P=>M({...T,endDate:P.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"}),v?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:T.estimatedTime??A.estimatedTime??"",onChange:P=>M({...T,estimatedTime:P.target.value?parseFloat(P.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children: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(P=>{let J=typeof P=="string"?P:P.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"})]})]}),u==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:x,onChange:P=>L(P.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:Q,disabled:!x.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:i.length>0?i.map(P=>{let J=s.find(q=>q.id===P.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[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(P.createdAt).toLocaleString()})]})]}),n&&jsxRuntime.jsx("button",{onClick:()=>n(P.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:P.content})]},P.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),u==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:p.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:p.map(P=>{let J=s.find(q=>q.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[P.type.includes("CREATED")&&"\u2795",P.type.includes("UPDATED")&&"\u270F\uFE0F",P.type.includes("MOVED")&&"\u27A1\uFE0F",P.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",P.type.includes("COMMENT")&&"\u{1F4AC}",P.type.includes("ASSIGNED")&&"\u{1F464}",P.type.includes("PRIORITY")&&"\u{1F3AF}",P.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",P.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:J?.name||"Unknown"})," ",P.type.replace(/_/g," ").toLowerCase(),P.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:P.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(P.timestamp).toLocaleString()})]})]},P.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),u==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Ha,{cardId:e.id,attachments:d,onUpload:g?P=>g(e.id,P):void 0,onDelete:f,currentUserId:k,maxSizeMB:10,maxFiles:20})}),u==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:ue,disabled:N||!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:ve,disabled:N||!w,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:B,disabled:N||!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((P,J)=>{let q=s.find($=>$.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[q&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:q.color},children:q.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:q?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:P.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(P.confidence*100).toFixed(0),"%"]})]})]},J)})]}),W.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),W.subtasks.map((P,J)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:P.title}),P.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:P.description}),P.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",P.estimatedTime,"h"]})]},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),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(P=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${P.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:P.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:P.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:P.description}),P.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",P.suggestedAction]})]},P.id))]}),!W.assignees&&!W.subtasks&&!W.effort&&m.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Co({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:i=""}){let[p,m]=react.useState({top:0,left:0}),d=react.useRef(null),l=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let n=e.current.getBoundingClientRect(),g=window.innerHeight,f=window.innerWidth,c=4,w=n.left;w+o>f-10&&(w=f-o-10),w<10&&(w=10);let h=g-n.bottom,k=n.top,u;return h>=s+c?u=n.bottom+c:k>=s+c?u=n.top-s-c:h>=k?u=n.bottom+c:u=Math.max(10,n.top-s-c),{top:u,left:w}},[e,o,s]);return react.useEffect(()=>{t&&m(l());},[t,l]),react.useEffect(()=>{if(!t)return;let n=f=>{let c=f.target;d.current&&!d.current.contains(c)&&e.current&&!e.current.contains(c)&&a();},g=setTimeout(()=>{document.addEventListener("mousedown",n);},0);return ()=>{clearTimeout(g),document.removeEventListener("mousedown",n);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let n=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),a());};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[t,a]),t?jsxRuntime.jsx(lt,{children:jsxRuntime.jsx("div",{ref:d,className:`smart-popover ${i}`,style:{position:"fixed",top:`${p.top}px`,left:`${p.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:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var Nu=["LOW","MEDIUM","HIGH","URGENT"],Su=["todo","in-progress","review","done"];function Es({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:i=[],activities:p=[],onAddComment:m,onDeleteComment:d,currentUser:l,onAIGenerateDescription:n,onAICreateSubtasks:g,onAIFindSimilar:f,availableColumns:c=[],availableLabels:w=[],availableTags:h=[],onCreateTag:k,onUploadCoverImage:u,unsplashAccessKey:y,theme:v,onSubtasksChange:D,attachments:T=[],onUploadAttachments:M,onDeleteAttachment:x}){let L=Hr(),N=v||L?.themeName||"dark",[C,W]=react.useState(e),[I,K]=react.useState(false),[V,z]=react.useState(e?.subtasks||[]),[Q,ue]=react.useState(false),[ve,B]=react.useState(""),[A,R]=react.useState(""),[P,J]=react.useState("all"),[q,$]=react.useState(false),[ke,Ae]=react.useState(false),[He,we]=react.useState(false),[Je,Be]=react.useState(false),[at,Pt]=react.useState(false),[bt,rt]=react.useState(false),O=react.useRef(null),ie=react.useRef(null),ge=react.useRef(null),De=react.useRef(null),Me=react.useRef(null),st=react.useRef(null),wt=react.useRef(null),$e=react.useRef(null),be=react.useRef(null),Ne=react.useRef(null),Kt=react.useRef(null),H=react.useRef(null);react.useEffect(()=>{e&&!C?(W({...e}),z(e.subtasks||[])):e&&C&&e.id!==C.id&&(W({...e}),z(e.subtasks||[]));},[e,C]),react.useEffect(()=>{let U=Z=>{let Le=Z.target;De.current&&!De.current.contains(Le)&&$(false),Me.current&&!Me.current.contains(Le)&&Ae(false),st.current&&!st.current.contains(Le)&&we(false),wt.current&&!wt.current.contains(Le)&&Be(false);};if(q||ke||He||Je)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[q,ke,He,Je]),react.useEffect(()=>{if(!t)return;let U=Z=>{let Le=Z.target,kt=Le.tagName==="INPUT"||Le.tagName==="TEXTAREA"||Le.isContentEditable;if(Z.key==="Escape"){Z.preventDefault(),q||ke||He||Je||at||bt?($(false),Ae(false),we(false),Be(false),Pt(false),rt(false)):kt||a();return}if(kt&&Z.key!=="Escape")return;let it=Z.metaKey||Z.ctrlKey;switch(Z.key.toLowerCase()){case "s":Z.preventDefault(),$(true);break;case "a":Z.preventDefault(),we(true);break;case "p":Z.preventDefault(),Ae(true);break;case "l":Z.preventDefault(),Be(true);break;case "d":it||(Z.preventDefault(),Pt(true),setTimeout(()=>$e.current?.focus(),0));break;case "e":it||(Z.preventDefault(),rt(true));break;case "i":Z.preventDefault(),K(true),setTimeout(()=>ie.current?.focus(),0);break;case "t":Z.preventDefault(),ue(true);break;case "c":Z.preventDefault(),ge.current?.focus();break}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[t,a,q,ke,He,Je,at,bt]);let Se=react.useCallback(U=>{let Z=U.currentTarget.textContent?.trim()||"";if(C&&Z!==C.title){let Le={...C,title:Z};W(Le),r?.(C.id,{title:Z});}},[C,r]),et=react.useCallback(U=>{U.key==="Enter"&&(U.preventDefault(),U.currentTarget.blur()),U.key==="Escape"&&(U.preventDefault(),U.currentTarget.textContent=C?.title||"",U.currentTarget.blur());},[C]),Ce=react.useCallback(()=>{C&&e&&C.description!==e.description&&r?.(C.id,{description:C.description}),K(false);},[C,e,r]),Ee=react.useCallback(U=>{if(C){let Z={...C,columnId:U};W(Z),r?.(C.id,{columnId:U}),$(false);}},[C,r]),ae=react.useCallback(U=>{if(C){let Z={...C,priority:U};W(Z),r?.(C.id,{priority:U}),Ae(false);}},[C,r]),X=react.useCallback(U=>{if(C){let Z=C.assignedUserIds||[],Le=Z.includes(U)?Z.filter(it=>it!==U):[...Z,U],kt={...C,assignedUserIds:Le};W(kt),r?.(C.id,{assignedUserIds:Le});}},[C,r]),Te=react.useCallback(U=>{if(C){let Z=C.labels||[],Le=Z.includes(U)?Z.filter(it=>it!==U):[...Z,U],kt={...C,labels:Le};W(kt),r?.(C.id,{labels:Le});}},[C,r]),ee=react.useCallback(U=>{if(C){let Z={...C,tags:U};W(Z),r?.(C.id,{tags:U});}},[C,r]),ze=react.useCallback(U=>{if(C){let Z=U.target.value,Le={...C,endDate:Z};W(Le),r?.(C.id,{endDate:Z}),Pt(false);}},[C,r]),Fe=react.useCallback(U=>{if(C){let Z={...C,estimatedTime:parseFloat(U)||0};W(Z),r?.(C.id,{estimatedTime:parseFloat(U)||0});}},[C,r]),Ze=react.useCallback(()=>{if(ve.trim()&&C){let U={id:`subtask-${Date.now()}`,title:ve.trim(),completed:false,createdAt:new Date},Z=[...V,U];z(Z),B(""),ue(false),D?.(C.id,Z);}},[ve,V,C,D]),Ie=react.useCallback(U=>{let Z=V.map(Le=>Le.id===U?{...Le,completed:!Le.completed,updatedAt:new Date}:Le);z(Z),C&&D?.(C.id,Z);},[V,C,D]),pe=react.useCallback(U=>{let Z=V.filter(Le=>Le.id!==U);z(Z),C&&D?.(C.id,Z);},[V,C,D]),Re=react.useCallback(()=>{A.trim()&&C&&m&&(m(C.id,A.trim()),R(""));},[A,C,m]),ot=react.useCallback(U=>{(U.metaKey||U.ctrlKey)&&U.key==="Enter"&&(U.preventDefault(),Re());},[Re]),Y=U=>jsxRuntime.jsx(Cu__default.default,{remarkPlugins:[Tu__default.default],rehypePlugins:[Du__default.default],components:{a:({node:Z,...Le})=>jsxRuntime.jsx("a",{...Le,target:"_blank",rel:"noopener noreferrer"})},children:U}),re=p.filter(U=>P==="comments"?U.type.includes("COMMENT"):P==="history"?!U.type.includes("COMMENT"):true);if(!t||!e)return null;let Pe=C||e,Ve=s.filter(U=>Pe.assignedUserIds?.includes(U.id)),We=V.filter(U=>U.completed).length;return jsxRuntime.jsx(lt,{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:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":N,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:O,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Se,onKeyDown:et,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:De,children:[jsxRuntime.jsxs("button",{ref:be,className:"modal-v2-field",onClick:()=>$(!q),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("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(Co,{triggerRef:be,isOpen:q,onClose:()=>$(false),width:250,estimatedHeight:200,children:(c.length>0?c:Su.map(U=>({id:U,title:U}))).map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${Pe.columnId===U.id?"active":""}`,onClick:()=>Ee(U.id),children:U.title},U.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:st,children:[jsxRuntime.jsxs("button",{ref:Ne,className:"modal-v2-field",onClick:()=>we(!He),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:Ve.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Ve.map(U=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:U.color},title:U.name,children:U.initials},U.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Co,{triggerRef:Ne,isOpen:He,onClose:()=>we(false),width:280,estimatedHeight:300,children:s.map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Pe.assignedUserIds?.includes(U.id)?"active":""}`,onClick:()=>X(U.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:U.color},children:U.initials}),U.name,Pe.assignedUserIds?.includes(U.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"})})]},U.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Me,children:[jsxRuntime.jsxs("button",{ref:Kt,className:"modal-v2-field",onClick:()=>Ae(!ke),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(Co,{triggerRef:Kt,isOpen:ke,onClose:()=>Ae(false),width:180,estimatedHeight:220,children:[Nu.map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${U.toLowerCase()} ${Pe.priority===U?"active":""}`,onClick:()=>ae(U),children:U},U)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>ae(""),children:"None"})]})]}),h.length>0||k?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($a,{selectedTags:Pe.tags||[],availableTags:h,onChange:ee,onCreateTag:k,theme:je[N]||je.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:wt,children:[jsxRuntime.jsxs("button",{ref:H,className:"modal-v2-field",onClick:()=>Be(!Je),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(Co,{triggerRef:H,isOpen:Je,onClose:()=>Be(false),width:220,estimatedHeight:200,children:(w.length>0?w:["Bug","Feature","Enhancement","Documentation"]).map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Pe.labels?.includes(U)?"active":""}`,onClick:()=>Te(U),children:[U,Pe.labels?.includes(U)&&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"})})]},U))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{Pt(!at),setTimeout(()=>$e.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:$e,type:"date",value:typeof Pe.endDate=="string"?Pe.endDate.split("T")[0]:Pe.endDate?(()=>{let U=new Date(Pe.endDate),Z=U.getUTCFullYear(),Le=String(U.getUTCMonth()+1).padStart(2,"0"),kt=String(U.getUTCDate()).padStart(2,"0");return `${Z}-${Le}-${kt}`})():"",onChange:ze,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>rt(!bt),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"})]}),bt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Pe.estimatedTime||"",onChange:U=>Fe(U.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>rt(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"})]}),I?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:Pe.description||"",onChange:U=>{if(C){let Z={...C,description:U.target.value};W(Z);}},onBlur:Ce,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>K(true),children:Pe.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:Y(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"}),V.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[We,"/",V.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>ue(true),children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[V.map(U=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${U.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Ie(U.id),children:U.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:U.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>pe(U.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"})]})})]},U.id)),Q&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:ve,onChange:U=>B(U.target.value),onKeyDown:U=>{U.key==="Enter"&&Ze(),U.key==="Escape"&&(ue(false),B(""));},onBlur:Ze,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(M||T.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"}),T.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:T.length})]}),jsxRuntime.jsx(Ha,{cardId:Pe.id,attachments:T,onUpload:M?U=>M(Pe.id,U):void 0,onDelete:x,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 ${P==="all"?"active":""}`,onClick:()=>J("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${P==="comments"?"active":""}`,onClick:()=>J("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${P==="history"?"active":""}`,onClick:()=>J("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[l&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:l.color},children:l.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:ge,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:A,onChange:U=>R(U.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:Re,disabled:!A.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[re.map(U=>{let Z=s.find(kt=>kt.id===U.userId);if(U.type.includes("COMMENT")){let kt=i.find(it=>it.id===U.metadata?.commentId);return kt?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[Z&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:Z.color},children:Z.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:Z?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:kt.content})]})]},U.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[U.type.includes("CREATED")&&"\u2795",U.type.includes("UPDATED")&&"\u270F\uFE0F",U.type.includes("MOVED")&&"\u27A1\uFE0F",U.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",U.type.includes("ASSIGNED")&&"\u{1F464}",U.type.includes("PRIORITY")&&"\u{1F3AF}",U.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:Z?.name||"Unknown"})," ",U.type.replace(/_/g," ").toLowerCase(),U.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:U.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]})]},U.id)}),re.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 Ru({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 Ms({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(i=>({...i,average:i.average??e.reduce((p,m)=>p+m.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ru,{})}),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((i,p)=>i+p.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((i,p)=>i+p.completed,0)/e.length).toFixed(1)})]}),o&&e.some(i=>i.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((i,p)=>i+(p.planned||0),0)})]})]})]})}function Vu({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 As({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),i=e[e.length-1]?.remaining||0,p=e[e.length-1]?.ideal||0,m=s>0?(s-i)/s*100:0,d=i<=p;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(Vu,{})}),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:d?"#10B981":"#EF4444",fill:d?"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:d?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:d?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:m>=50?"#10B981":"#F59E0B"},children:[m.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:d?"#10B981":"#EF4444"},children:i})]}),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:d?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:d?"#10B981":"#EF4444"},children:d?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var eg={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},bd=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function tg({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let i=r+(o-r)*.5,p=e+i*Math.cos(-a*(Math.PI/180)),m=t+i*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:p,y:m,fill:"white",textAnchor:p>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function yd({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:a.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[o,"%"]})]})]})}function Is({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,d)=>m+d.value,0),i=e.map(m=>({...m,totalValue:s,color:m.color||eg[m.name]||bd[e.indexOf(m)%bd.length]})),p=i.map(m=>m.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:i,cx:"50%",cy:"50%",labelLine:false,label:o?tg:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:i.map((m,d)=>jsxRuntime.jsx(recharts.Cell,{fill:p[d]},`cell-${d}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(yd,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,d)=>{let l=d.payload,n=s>0?(l.value/s*100).toFixed(0):"0";return `${m} (${l.value} - ${n}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:i,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(yd,{})}),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:i.map((m,d)=>jsxRuntime.jsx(recharts.Cell,{fill:p[d]},`cell-${d}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((m,d)=>d.value>m.value?d:m).name})]})]})]})}var nn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[i,p]=react.useState(false),[m,d]=react.useState(false),[l,n]=react.useState(false),[g,f]=react.useState(false);if(e.length===0)return null;let c=e.map(v=>v.id),w=v=>{r.onBulkUpdate?.(c,{priority:v}),p(false);},h=v=>{r.onBulkMove?.(c,v),d(false),a();},k=v=>{r.onBulkUpdate?.(c,{assignedUserIds:v}),n(false);},u=v=>{let D=new Set;e.forEach(M=>{M.labels?.forEach(x=>D.add(x));});let T=Array.from(new Set([...D,...v]));r.onBulkUpdate?.(c,{labels:T}),f(false);},y=()=>{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:()=>p(!i),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(v=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>w(v),children:[jsxRuntime.jsx("span",{className:b("asakaa-priority-dot",v==="LOW"&&"bg-asakaa-priority-low",v==="MEDIUM"&&"bg-asakaa-priority-medium",v==="HIGH"&&"bg-asakaa-priority-high",v==="URGENT"&&"bg-asakaa-priority-urgent")}),v]},v))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!m),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(v=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(v.id),children:v.title},v.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>n(!l),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(v=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k([v.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:v.color},children:v.initials}),v.name]},v.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>f(!g),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),g&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(v=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>u([v]),children:v},v))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:y,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"})})]})]})})});nn.displayName="BulkOperationsToolbar";function sg(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,i,p,m,d;switch(t){case "assignee":let l=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);l.length>0?l.forEach(f=>{let c=a?.find(w=>w.id===f);i=`assignee-${f}`,p=c?.name||`User ${f}`,m=c?.color,d=c?.avatar,r.has(i)||r.set(i,{id:i,title:p,groupValue:f,cardIds:[],color:m,icon:d}),r.get(i).cardIds.push(o.id);}):(i="assignee-unassigned",p="Unassigned",m="#6b7280",d="\u{1F464}",r.has(i)||r.set(i,{id:i,title:p,groupValue:null,cardIds:[],color:m,icon:d}),r.get(i).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",i=`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];p=g.title,m=g.color,r.has(i)||r.set(i,{id:i,title:p,groupValue:s,cardIds:[],color:m}),r.get(i).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(f=>{i=`label-${f}`,p=f,m="#6b7280",r.has(i)||r.set(i,{id:i,title:p,groupValue:f,cardIds:[],color:m}),r.get(i).cardIds.push(o.id);}):(i="label-none",p="No Labels",m="#6b7280",r.has(i)||r.set(i,{id:i,title:p,groupValue:null,cardIds:[],color:m}),r.get(i).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Fs({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,i]=react.useState(new Set),p=react.useMemo(()=>sg(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(d=>{i(l=>{let n=new Set(l);return n.has(d)?n.delete(d):n.add(d),n});},[]);return t.groupBy==="none"||p.length===0?jsxRuntime.jsx(lr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:b("asakaa-swimlane-view",o),children:[p.map(d=>{let l=s.has(d.id),n=e.cards.filter(f=>d.cardIds.includes(f.id)),g={...e,cards:n};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(d.id),style:{borderLeft:d.color?`4px solid ${d.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[d.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:d.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:d.color},children:d.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",d.cardIds.length," ",d.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":l?"Expand lane":"Collapse lane",children:l?"\u25B6":"\u25BC"})]}),!l&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(lr,{board:g,callbacks:r,availableUsers:a})})]},d.id)}),p.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 Ls=[{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 Bs({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),i=react.useRef(null),p=Ls.find(d=>d.value===e)||Ls[0];react.useEffect(()=>{function d(l){s.current&&!s.current.contains(l.target)&&i.current&&!i.current.contains(l.target)&&o(false);}if(r)return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r]);let m=d=>{t(d),o(false);};return jsxRuntime.jsxs("div",{className:b("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:i,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:p.icon}),jsxRuntime.jsx("span",{children:p.label}),jsxRuntime.jsx("svg",{className:b("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:Ls.map(d=>jsxRuntime.jsxs("button",{onClick:()=>m(d.value),className:b("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===d.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:d.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:d.label}),e===d.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:d.description})]})]},d.value))})]})]})}var To=[{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 dg(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(d=>e.key===d||e.code===d))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,i=o.shift?e.shiftKey:!e.shiftKey,p=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&i&&p&&m}function Cd(e={}){let{shortcuts:t=To,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 i=react.useCallback(m=>{o.current=[...o.current,m];},[]),p=react.useCallback(m=>{o.current=o.current.filter(d=>d.action!==m);},[]);return react.useEffect(()=>{function m(d){if(!s.current)return;let l=d.target;if(!((l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.isContentEditable)&&d.key!=="Escape"&&!d.ctrlKey&&!d.metaKey)){for(let n of o.current)if(dg(d,n)){r&&d.preventDefault();let g=new CustomEvent("keyboard-action",{detail:n.action,bubbles:true,cancelable:true});window.dispatchEvent(g);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:i,unregisterShortcut:p,isEnabled:a}}function pg(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function mg(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 ug(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=mg(e),r=t?pg(t):"";return a?`${a} + ${r}`:r}function gg(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 Rs({shortcuts:e=To,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function p(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,a]),!o||!t)return null;let i=gg(e);return jsxRuntime.jsxs("div",{className:b("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(i).map(([p,m])=>m.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),p]}),jsxRuntime.jsx("div",{className:"space-y-3",children:m.map(d=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:d.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:ug(d)})]},d.action))})]},p))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Os=[{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 zs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{function n(d){s.current&&!s.current.contains(d.target)&&l.current&&!l.current.contains(d.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let p=n=>{t(n),o(false);},m=e.reduce((n,d)=>{let c=d.category||"Other";return n[c]||(n[c]=[]),n[c].push(d),n},{});return jsxRuntime.jsxs("div",{className:y("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",n.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",n.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:y("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([n,d])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:n})}),jsxRuntime.jsx("div",{children:d.map(c=>jsxRuntime.jsxs("button",{onClick:()=>p(c),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:c.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:c.name}),c.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:c.description})]})]},c.id))})]},n)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Us({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[l,p]=react.useState("export"),[m,n]=react.useState("json"),[d,c]=react.useState(null),i=react.useRef(null);if(!t)return null;let u=async()=>{let h=o?.current||void 0,g=await yl(e,m,h);vl(g,m);},f=async h=>{let g=h.target.files?.[0];if(g){try{let w=await wl(g),b=g.name.endsWith(".json")?"json":"csv",v=kl(w,b);c(v),v.success&&r&&r(v,w);}catch(w){c({success:false,errors:[`Failed to read file: ${w instanceof Error?w.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxRuntime.jsxs("div",{className:y("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>p("export"),className:y("flex-1 px-6 py-4 font-semibold transition-colors",l==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>p("import"),className:y("flex-1 px-6 py-4 font-semibold transition-colors",l==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[l==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(h=>jsxRuntime.jsxs("button",{onClick:()=>n(h),className:y("p-4 rounded-lg border-2 transition-all text-center",m===h?"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:[h==="json"&&"\u{1F4C4}",h==="csv"&&"\u{1F4CA}",h==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:h})]},h))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:u,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),l==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:i,type:"file",accept:".json,.csv",onChange:f,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>i.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),d&&jsxRuntime.jsxs("div",{className:y("p-4 rounded-lg",d.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:y("font-semibold mb-2",d.success?"text-green-400":"text-red-400"),children:d.success?"\u2713 Import Successful":"\u2717 Import Failed"}),d.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",d.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",d.columnsImported]})]}),d.errors&&d.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:d.errors.map((h,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",h]},g))})]})]})]})]})]})}var vg=["URGENT","HIGH","MEDIUM","LOW"],xg=[{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"}],kg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ws({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:l,onFilterHighPriority:p,availableUsers:m=[],availableLabels:n=[],availableColumns:d=[],showQuickFilters:c=true,compact:i=false,groupBy:u="none",onGroupByChange:f}){let[h,g]=react.useState(true),w=react.useCallback(D=>{a({search:D.target.value});},[a]),b=react.useCallback(D=>{a({dateFilter:D.target.value});},[a]),v=react.useCallback(D=>{r({by:D.target.value});},[r]),x=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),T=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${h?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!h),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:h?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:h?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),T&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!h&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[c&&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"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),p&&jsxRuntime.jsx("button",{onClick:p,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:w,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:b,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:D=>{let M=D.target.value;a({priorities:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),vg.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let M=D.target.value;a({assignees:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(D=>jsxRuntime.jsx("option",{value:D.id,children:D.name},D.id))]})}),n.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let M=D.target.value;a({labels:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),n.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:v,className:"filter-bar__select filter-bar__select--sm",children:xg.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),f&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:D=>f(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:kg.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))})}),T&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Hs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:l,onExportGanttPNG:p,onExportGanttCSV:m}){let[n,d]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let u=f=>{c.current&&!c.current.contains(f.target)&&d(false);};return n&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[n]);let i=u=>{u(),d(false);};return jsxRuntime.jsxs("div",{className:y("relative",r),ref:c,children:[jsxRuntime.jsxs("button",{onClick:()=>d(!n),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",u.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",u.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":n,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),n&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>i(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await p?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>i(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>i(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>i(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Gs={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"}},_s={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"}},Vs={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"}},Er={dark:Gs,light:_s,neutral:Vs},ln="dark";var dn=react.createContext(void 0),Ag="asakaa-theme";function Nd({children:e,defaultTheme:t=ln,storageKey:a=Ag}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let p=localStorage.getItem(a);if(p&&(p==="dark"||p==="light"||p==="neutral"))return p}return t}),s=react.useCallback(p=>{o(p),typeof window<"u"&&localStorage.setItem(a,p);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let p=document.documentElement,m=Er[r];Object.entries(m.colors).forEach(([d,c])=>{c&&p.style.setProperty(`--theme-${Ig(d)}`,c);}),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(([d,c])=>{let i=m.colors[d];i&&p.style.setProperty(c,i);}),p.setAttribute("data-theme",r),p.classList.remove("theme-dark","theme-light","theme-neutral"),p.classList.add(`theme-${r}`);},[r]);let l={theme:r,setTheme:s,themes:Er};return jsxRuntime.jsx(dn.Provider,{value:l,children:e})}function eo(){let e=react.useContext(dn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Ig(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function js({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=eo();return e?jsxRuntime.jsxs("div",{className:y("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Er).map(([s,l])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:y("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:l.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:l.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[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 Sd(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return je[e]||je.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,l)=>a.getPropertyValue(s).trim()||l;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 cn={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Ed={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Ks={en:cn,es:Ed};function Pd(e){return Ks[e]||Ks.en}function Ys(e,t){let a=Pd(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 ao=react.createContext(cn);function Do(){return react.useContext(ao)}function qg({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:l}){let[p,m]=react.useState(false),[n,d]=react.useState(null),c=react.useRef(null),i=Do();if(react.useEffect(()=>{let g=w=>{c.current&&!c.current.contains(w.target)&&m(false);};return p&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[p]),!(t||a||r||o||s||l))return null;let f=[{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:l}].filter(g=>g.handler),h=async(g,w)=>{if(w){d(g);try{await w();}catch(b){console.error(`Export ${g} failed:`,b);}finally{d(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!p),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:p?e.accent:e.bgSecondary,border:`1px solid ${p?e.accent:e.borderLight}`,color:p?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:i.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:p?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&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:f.map((g,w)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>h(g.id,g.handler),disabled:n!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:w<f.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:w*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:n===g.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"})}):g.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:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Xg({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 l=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:l?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500,zIndex:l?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[l&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Jg({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 Zg({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=Do();react.useEffect(()=>{let n=d=>{s.current&&!s.current.contains(d.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let p=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],m=p.find(n=>n.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${l.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:p.map((n,d)=>{let c=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(n.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:c?e.accentLight:"transparent",borderBottom:d<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:c?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:d*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:c?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:c?600:500},children:n.label}),c&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function pn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:l,rowDensity:p,onRowDensityChange:m,showThemeSelector:n=false,showCreateTaskButton:d=false,createTaskLabel:c,onCreateTask:i,onExportPNG:u,onExportPDF:f,onExportExcel:h,onExportCSV:g,onExportJSON:w,onExportMSProject:b}){let v=Do(),x=u||f||h||g||w||b,T=[{value:"day",label:v.toolbar.day},{value:"week",label:v.toolbar.week},{value:"month",label:v.toolbar.month}],D=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Jg,{options:T,value:t,onChange:M=>a(M),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(Zg,{theme:e,value:p,onChange:m})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[d&&i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:i,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:c||v.toolbar.createTask})]}),(x||n)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qg,{theme:e,onExportPNG:u,onExportPDF:f,onExportExcel:h,onExportCSV:g,onExportJSON:w,onExportMSProject:b}),n&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsxRuntime.jsx(Xg,{options:D,value:s,onChange:M=>l(M),theme:e})]})]})}function mn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,l]=react.useState({x:0,y:0}),p=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let d=c=>{p.current&&!p.current.contains(c.target)&&o(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r]);let n=e.filter(d=>d.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let d=m.current.getBoundingClientRect();l({x:d.left,y:d.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(nt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:p,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),n.map(d=>jsxRuntime.jsxs("button",{onClick:()=>{t(d.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:c=>{c.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:d.label}),d.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},d.id))]})})})})]})}function ro({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let l=react.useRef(null),[p,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let d=200,c=r.length*36+8,i=8,u=window.innerWidth,f=window.innerHeight,h=t,g=a;t+d+i>u&&(h=t-d,h<i&&(h=i)),a+c+i>f&&(g=f-c-i,g<i&&(g=i)),m({x:h,y:g});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let d=i=>{l.current&&!l.current.contains(i.target)&&o();},c=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",c);}},[e,o]),!e)return null;let n=d=>d.startsWith("#")&&(d.length===7||d.length===4)?d: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:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${p.x}px`,top:`${p.y}px`,backgroundColor:n(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(d=>jsxRuntime.jsxs("div",{children:[d.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{d.disabled||(d.onClick(),o());},disabled:d.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:d.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:d.disabled?"not-allowed":"pointer",opacity:d.disabled?.5:1},onMouseEnter:c=>{d.disabled||(c.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[d.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:d.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:d.label}),d.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},d.id))})})})}var St={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 Hd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:l,onTaskIndent:p,onTaskOutdent:m,onTaskRename:n,onTaskToggleExpand:d,onOpenTaskModal:c,enableKeyboard:i=true}){let u=react.useRef(false),f=react.useCallback(v=>{u.current=v;},[]),h=react.useCallback(v=>{let x=[],T=D=>{for(let M of D)x.push(M),M.subtasks&&M.subtasks.length>0&&M.isExpanded&&T(M.subtasks);};return T(v),x},[]),g=react.useCallback(()=>{let v=h(e);for(let x of v)if(t.has(x.id))return x;return null},[e,t,h]),w=react.useCallback((v,x)=>{let T=h(e);if(T.length===0)return;let D=g();if(!D){a(T[0].id,false);return}let M=T.findIndex(N=>N.id===D.id);if(M===-1)return;let k=v==="up"?M-1:M+1;if(k<0||k>=T.length)return;let B=T[k];a(B.id,x);},[e,g,h,a]),b=react.useCallback(v=>{if(!i)return;let x=v.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||u.current){v.key==="Escape"&&(x.blur(),u.current=false);return}let M=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,k=Array.from(t),B=g();if(v.key==="ArrowUp"){v.preventDefault(),w("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),w("down",v.shiftKey);return}if(B&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){B.subtasks&&B.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!B.isExpanded||v.key==="ArrowLeft"&&B.isExpanded)&&d(B.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){k.length>0&&(v.preventDefault(),l(k,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){k.length>0&&(v.preventDefault(),p(k));return}if(v.key==="Tab"&&v.shiftKey){k.length>0&&(v.preventDefault(),m(k));return}if(v.key==="Enter"&&!v.shiftKey&&!M){B&&(v.preventDefault(),r(B.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!M){B&&(v.preventDefault(),r(B.id,"above"));return}if(v.key==="Enter"&&M){B&&(v.preventDefault(),c(B.id));return}if(v.key==="F2"){B&&(v.preventDefault(),n(B.id));return}if(v.key==="Delete"||v.key==="Backspace"&&M){k.length>0&&(v.preventDefault(),o(k));return}if(v.key==="d"&&M&&!v.shiftKey){k.length>0&&(v.preventDefault(),s(k));return}},[i,t,g,w,r,o,s,l,p,m,n,d,c]);return react.useEffect(()=>{if(i)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[i,b]),{setIsEditing:f}}function _d(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(c=>{t(new Set([c])),r(c);},[]),s=react.useCallback(c=>{t(i=>{let u=new Set(i);return u.has(c)?u.delete(c):u.add(c),u}),r(c);},[]),l=react.useCallback((c,i)=>{if(!a){o(c);return}let u=i.indexOf(a),f=i.indexOf(c);if(u===-1||f===-1){o(c);return}let h=Math.min(u,f),g=Math.max(u,f),w=i.slice(h,g+1);t(new Set(w)),r(c);},[a,o]),p=react.useCallback((c,i,u,f)=>{f?l(c,i):u?s(c):o(c);},[o,s,l]),m=react.useCallback((c,i)=>{i?t(u=>{let f=new Set(u);return f.add(c),f}):o(c);},[o]),n=react.useCallback(()=>{t(new Set),r(null);},[]),d=react.useCallback(c=>e.has(c),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:l,handleTaskClick:p,handleKeyboardSelection:m,clearSelection:n,isTaskSelected:d}}function oo(e){let t=[],a=(r,o,s=0)=>{for(let l=0;l<r.length;l++){let p={...r[l],parentId:o,level:s,position:l};t.push(p),p.subtasks&&p.subtasks.length>0&&p.isExpanded&&a(p.subtasks,p.id,s+1);}};return a(e),t}function Vd(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Vd(a.subtasks,t);if(r)return r}}return null}function Js(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Js(a.subtasks,t);if(r)return r}return null}function Zs(e,t){if(t.length===0)return e;let a=oo(e),r=t[0],o=a.findIndex(c=>c.id===r);if(o<=0)return e;let s=a[o-1],l=(c,i)=>{let u=[];return {tasks:c.filter(h=>{if(i.has(h.id))return u.push(h),false;if(h.subtasks){let g=l(h.subtasks,i);h.subtasks=g.tasks,u.push(...g.removed);}return true}),removed:u}},p=(c,i,u)=>c.map(f=>f.id===i?{...f,subtasks:[...f.subtasks||[],...u],isExpanded:true}:f.subtasks?{...f,subtasks:p(f.subtasks,i,u)}:f),m=new Set(t),{tasks:n,removed:d}=l(e,m);return p(n,s.id,d)}function Qs(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Js(a,r);if(!o)continue;let s=Js(a,o.id),l=(n,d,c)=>{for(let i=0;i<n.length;i++){let u=n[i];if(u.id===d&&u.subtasks){let f=u.subtasks.findIndex(h=>h.id===c);if(f!==-1){let[h]=u.subtasks.splice(f,1);return h}}if(u.subtasks){let f=l(u.subtasks,d,c);if(f)return f}}return null},p=(n,d,c)=>{let i=n.findIndex(u=>u.id===d);if(i!==-1)return n.splice(i+1,0,c),n;for(let u of n)u.subtasks&&p(u.subtasks,d,c);return n},m=l(a,o.id,r);m&&(s&&s.subtasks?p(s.subtasks,o.id,m):p(a,o.id,m));}return a}function ei(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(l,p,m)=>{let n=l.findIndex(c=>c.id===p);if(n===-1){for(let c of l)if(c.subtasks&&s(c.subtasks,p,m))return true;return false}let d=m==="up"?n-1:n+1;return d<0||d>=l.length?false:([l[n],l[d]]=[l[d],l[n]],true)};return s(r,o,a),r}function ti(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 ai(e,t){let a=[...e];for(let r of t){let o=l=>{let p=l.findIndex(d=>d.id===r);if(p===-1){for(let d of l)if(d.subtasks&&o(d.subtasks))return true;return false}let m=l[p],n={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return l.splice(p+1,0,n),true},s=l=>l.map(p=>({...p,id:`${p.id}-copy-${Date.now()}`,subtasks:p.subtasks?s(p.subtasks):void 0}));o(a);}return a}function jd(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let l={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},p=m=>{let n=m.findIndex(c=>c.id===t);if(n===-1){for(let c of m)if(c.subtasks&&p(c.subtasks))return true;return false}let d=a==="above"?n:n+1;return m.splice(d,0,l),true};return p(r),{tasks:r,newTask:l}}function ri(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ri(r.subtasks,t,a)}:r)}function oi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:oi(a.subtasks,t)}:a)}function ni(e,t){let a=d=>{for(let c of d){if(c.id===t)return c;if(c.subtasks){let i=a(c.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let l=r?.startDate||o,p=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(l),endDate:new Date(p),color:r?.color||"#3B82F6"},n=d=>d.map(c=>{if(c.id===t){let i=c.subtasks||[];return {...c,subtasks:[...i,m],isExpanded:true}}return c.subtasks?{...c,subtasks:n(c.subtasks)}:c});return {tasks:n(e),newTask:m}}function Kd(e,t,a,r){if(t===a)return e;let o=Vd(e,t);if(!o)return e;if(a){let p=(m,n)=>{if(!m.subtasks)return false;for(let d of m.subtasks)if(d.id===n||p(d,n))return true;return false};if(p(o,a))return e}let s=p=>p.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),l=s(e);if(a===null){let p=r!==void 0?r:l.length;l.splice(p,0,{...o,parentId:void 0});}else {let p=m=>m.map(n=>{if(n.id===a){let d=n.subtasks||[],c=r!==void 0?r:d.length,i=[...d];return i.splice(c,0,{...o,parentId:a}),{...n,subtasks:i,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:p(n.subtasks)}:n});l=p(l);}return l}function fn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:l,onTaskContextMenu:p,onTaskToggle:m,scrollTop:n,columns:d,onToggleColumn:c,onColumnResize:i,onTaskUpdate:u,onTaskIndent:f,onTaskOutdent:h,onTaskMove:g,onMultiTaskDelete:w,onTaskDuplicate:b,onTaskCreate:v,onTaskRename:x,onCreateSubtask:T,onOpenTaskModal:D,onDeleteRequest:M,onTaskReparent:k}){let B=react.useContext(ao),[N,C]=react.useState(null),[H,I]=react.useState(null),[K,j]=react.useState(""),$=react.useRef(null),[Z,ce]=react.useState(null),[he,R]=react.useState(0),[A,O]=react.useState(0),[P,X]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[Y,U]=react.useState(null),[Se,Te]=react.useState(null),[He,xe]=react.useState(null),at=react.useRef(0),Le=5,et=react.useRef(false),[vt,Pt]=react.useState(null),[ct,z]=react.useState(false),[se,fe]=react.useState(null),[Ne,Ae]=react.useState(false),rt=react.useRef(null);react.useEffect(()=>{function q(te){rt.current&&!rt.current.contains(te.target)&&Ae(false);}if(Ne)return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[Ne]),react.useEffect(()=>{H&&$.current&&($.current.focus(),$.current.select());},[H]),react.useEffect(()=>{if(!Z)return;let q=Me=>{let Ve=Me.clientX-he,$e=A+Ve;i?.(Z,$e);},te=()=>{ce(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",q),document.addEventListener("mouseup",te),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",te),document.body.style.cursor="",document.body.style.userSelect="";}},[Z,he,A,i]);let{selectedTaskIds:ft,handleTaskClick:Re,isTaskSelected:L}=_d(),{setIsEditing:Q}=Hd({tasks:e,selectedTaskIds:ft,onTaskSelect:(q,te)=>{let Ve=oo(e).map($e=>$e.id);Re(q,Ve,te||false,false);},onTaskCreate:v||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:f||(()=>{}),onTaskOutdent:h||(()=>{}),onTaskRename:q=>{let te=oo(e).find(Me=>Me.id===q);te&&we(te);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:q=>{let te=oo(e).find(Me=>Me.id===q);te&&D&&D(te);},enableKeyboard:true}),_e=(q,te=0)=>{let Me=[];for(let Ve of q)Me.push({task:Ve,level:te}),Ve.subtasks&&Ve.subtasks.length>0&&Ve.isExpanded&&Me.push(..._e(Ve.subtasks,te+1));return Me},Ge=_e(e),kt=48,ae=Math.max(Ge.length*a,600-kt),ie=q=>!q.startDate||!q.endDate?"-":`${Math.ceil((q.endDate.getTime()-q.startDate.getTime())/(1e3*60*60*24))}d`,we=q=>{I(q.id),j(q.name),Q(true);},De=q=>{K.trim()&&K!==e.find(te=>te.id===q)?.name&&x?.(q,K.trim()),I(null),j(""),Q(false);},le=()=>{I(null),j(""),Q(false);},Pe=(q,te)=>{te.stopPropagation(),T?.(q.id);},ke=(q,te)=>{te.preventDefault(),at.current=te.clientY,U(q),et.current=false,z(false),Pt({x:te.clientX,y:te.clientY});},Ee=q=>{if(!Y||(Math.abs(q.clientY-at.current)>Le&&!et.current&&(et.current=true,z(true)),Pt({x:q.clientX,y:q.clientY}),!et.current))return;let Me=document.querySelectorAll("[data-task-row]"),Ve=null,$e=null;Me.forEach(W=>{let J=W.getBoundingClientRect(),Ie=W.getAttribute("data-task-row");if(Ie&&Ie!==Y&&q.clientY>=J.top&&q.clientY<=J.bottom){Ve=Ie;let wt=q.clientY-J.top,ot=J.height;wt<ot*.25?$e="above":wt>ot*.75?$e="below":$e="child";}}),Te(Ve),xe($e);},pe=()=>{if(et.current&&Y&&Se&&He){if(He==="child")k?.(Y,Se);else if(He==="above"||He==="below"){let q=(Ve,$e,W=null)=>{for(let J of Ve){if(J.id===$e)return W;if(J.subtasks){let Ie=q(J.subtasks,$e,J.id);if(Ie!==void 0)return Ie}}},te=q(e,Se,null),Me=(Ve,$e)=>{let W=Ve.findIndex(J=>J.id===$e);return He==="below"?W+1:W};if(te===null){let Ve=Me(e,Se);k?.(Y,null,Ve);}else {let Ve=Ge.find($e=>$e.task.id===te)?.task;if(Ve?.subtasks){let $e=Me(Ve.subtasks,Se);k?.(Y,te,$e);}}}}U(null),Te(null),xe(null),Pt(null),et.current=false,z(false);};react.useEffect(()=>{if(Y)return document.addEventListener("mousemove",Ee),document.addEventListener("mouseup",pe),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ee),document.removeEventListener("mouseup",pe),document.body.style.cursor="",document.body.style.userSelect="";}},[Y,Se,He]);let ze=(q,te,Me)=>{switch(q.id){case "name":let Ve=H===te.id,$e=N===te.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Me*20}px`},children:[k&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:$e?1:.3},onMouseDown:ue=>ke(te.id,ue),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),te.subtasks&&te.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ue=>{ue.stopPropagation(),m?.(te.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:te.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:te.color||"#3B82F6",opacity:te.parentId?.6:1,borderColor:te.isMilestone?t.accent:"transparent",borderWidth:te.isMilestone?"2px":"0px"},title:te.isMilestone?"Milestone":te.parentId?"Subtask":"Task"})}),Ve?jsxRuntime.jsx("input",{ref:$,type:"text",value:K,onChange:ue=>j(ue.target.value),onKeyDown:ue=>{ue.key==="Enter"?De(te.id):ue.key==="Escape"&&le();},onBlur:()=>De(te.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:ue=>ue.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:te.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:te.parentId?"13px":"14px",fontWeight:te.isMilestone?600:te.parentId?400:600,letterSpacing:te.parentId?"0":"-0.01em"},title:te.name,children:te.name}),$e&&!Ve&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ue=>ue.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ue=>Pe(te,ue),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:ue=>{ue.stopPropagation(),we(te);},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 J=q.id==="startDate"?"startDate":"endDate",Ie=te[J],wt=se?.taskId===te.id&&se?.field===J,ot=ue=>ue?(typeof ue=="string"?new Date(ue):ue).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:ue=>ue.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:ue=>{if(wt)fe(null);else {let Mt=ue.currentTarget.getBoundingClientRect();fe({taskId:te.id,field:J,month:Ie?typeof Ie=="string"?new Date(Ie):Ie:new Date,position:{top:Mt.bottom+4,left:Mt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:ot(Ie)})]}),wt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>fe(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:se?.position.top,left:se?.position.left},onClick:ue=>ue.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ue=new Date,Mt=new Date(ue);Mt.setDate(ue.getDate()+1);let ea=new Date(ue);ea.setDate(ue.getDate()+7);let $r=new Date(ue);return $r.setDate(ue.getDate()+14),[{label:"Hoy",date:ue},{label:"Ma\xF1ana",date:Mt},{label:"Pr\xF3xima semana",date:ea},{label:"2 semanas",date:$r}].map((Qa,Va)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:yr=>yr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:yr=>yr.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(te.id,{[J]:Qa.date}),fe(null);},children:Qa.label},Va))})(),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:ue=>ue.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ue=>ue.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(te.id,{[J]:void 0}),fe(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:()=>fe(ue=>ue?{...ue,month:new Date(ue.month.getFullYear(),ue.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:se?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>fe(ue=>ue?{...ue,month:new Date(ue.month.getFullYear(),ue.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((ue,Mt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ue},Mt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ue=se?.month||new Date,Mt=ue.getFullYear(),ea=ue.getMonth(),$r=new Date(Mt,ea,1).getDay(),Wo=new Date(Mt,ea+1,0).getDate(),Qa=new Date,Va=[];for(let $t=$r-1;$t>=0;$t--)Va.push({day:new Date(Mt,ea,-$t).getDate(),date:new Date(Mt,ea-1,new Date(Mt,ea,-$t).getDate()),isCurrentMonth:false});for(let $t=1;$t<=Wo;$t++)Va.push({day:$t,date:new Date(Mt,ea,$t),isCurrentMonth:true});let yr=42-Va.length;for(let $t=1;$t<=yr;$t++)Va.push({day:$t,date:new Date(Mt,ea+1,$t),isCurrentMonth:false});return Va.map(($t,mo)=>{let jn=$t.date.toDateString()===Qa.toDateString(),uo=(Ie?typeof Ie=="string"?new Date(Ie):Ie:null)?.toDateString()===$t.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:$t.isCurrentMonth?uo?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:uo?"#3B82F6":"transparent",boxShadow:jn&&!uo?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{u?.(te.id,{[J]:$t.date}),fe(null);},children:$t.day},mo)})})()})]})]})]}),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:ie(te)})});case "assignees":let _a=r.filter(ue=>te.assignees?.some(Mt=>Mt.name===ue.name||Mt.initials===ue.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx(Tr,{assignedUsers:_a,availableUsers:r,onChange:ue=>{let Mt=ue.map(ea=>({id:ea.id,name:ea.name,initials:ea.initials,color:ea.color}));u?.(te.id,{assignees:Mt.length>0?Mt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx(Wl,{status:te.status||"todo",onChange:ue=>{u?.(te.id,{status:ue,progress:ue==="completed"?100:te.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:`${te.progress}%`,backgroundColor:te.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:[te.progress,"%"]})]});case "priority":let br={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Za={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},po=br[te.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ue=>ue.stopPropagation(),children:jsxRuntime.jsx(wr,{priority:po,onChange:ue=>{ue&&u?.(te.id,{priority:Za[ue]||"medium"});}})});default:return null}},Be=q=>[{id:"hide",label:"Hide Column",icon:St.Hide,onClick:()=>c(q),disabled:q==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:St.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:St.SortDesc,onClick:()=>{}}],Ye=q=>q.subtasks&&q.subtasks.length>0?[{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:St.Add,onClick:()=>{T?.(q.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:St.Delete,onClick:()=>{M?M(q.id,q.name):w?.([q.id]);}}]:[{id:"edit",label:B?.contextMenu?.editTask||"Edit Task",icon:St.Pencil,onClick:()=>{l?.(q);}},{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:St.Add,onClick:()=>{T?.(q.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:B?.contextMenu?.markIncomplete||"Mark Incomplete",icon:St.MarkIncomplete,onClick:()=>{u?.(q.id,{status:"todo",progress:0});},disabled:q.status==="todo"},{id:"setInProgress",label:B?.contextMenu?.setInProgress||"Set In Progress",icon:St.SetInProgress,onClick:()=>{u?.(q.id,{status:"in-progress"});},disabled:q.status==="in-progress"},{id:"markComplete",label:B?.contextMenu?.markComplete||"Mark Complete",icon:St.MarkComplete,onClick:()=>{u?.(q.id,{status:"completed",progress:100});},disabled:q.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:B?.contextMenu?.splitTask||"Split Task",icon:St.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:St.Delete,onClick:()=>{M?M(q.id,q.name):w?.([q.id]);}}],ht=d.filter(q=>q.visible),Kt=ht.reduce((q,te)=>q+te.width,0);return jsxRuntime.jsxs("div",{className:"h-full",style:{backgroundColor:t.bgPrimary,minWidth:Kt},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${kt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:ht.map((q,te)=>{let Me=te===ht.length-1,Ve=q.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ve?"":"justify-center"}`,style:{width:`${q.width}px`,minWidth:`${q.minWidth??(Ve?200:60)}px`,maxWidth:`${q.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Me?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:$e=>{$e.preventDefault(),X({isOpen:true,x:$e.clientX,y:$e.clientY,type:"header",columnId:q.id});},onMouseEnter:$e=>{$e.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:$e=>{$e.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:q.label,children:q.label}),q.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Z===q.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:$e=>{$e.preventDefault(),$e.stopPropagation(),ce(q.id),R($e.clientX),O(q.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},q.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(mn,{columns:d,onToggleColumn:c,theme:t}),jsxRuntime.jsx("button",{onClick:()=>Ae(!Ne),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"})}),Ne&&jsxRuntime.jsxs("div",{ref:rt,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>Ae(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:ae},children:Ge.map(({task:q,level:te},Me)=>{let Ve=L(q.id),$e=Se===q.id,W=$e&&He==="above",J=$e&&He==="below",Ie=$e&&He==="child",wt={};return Ie&&(wt.backgroundColor=`${t.accent}15`,wt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":q.id,className:`flex items-center cursor-pointer group ${Y===q.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ve?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ve?t.accentLight:Ie?`${t.accent}15`:Me%2===0?t.bgPrimary:t.bgGrid,...wt},onMouseEnter:()=>C(q.id),onMouseLeave:()=>C(null),onClick:ot=>{let br=oo(e).map(ue=>ue.id),po=navigator.platform.toUpperCase().indexOf("MAC")>=0?ot.metaKey:ot.ctrlKey;Re(q.id,br,po,ot.shiftKey),s?.(q);},onDoubleClick:ot=>{ot.stopPropagation(),l?.(q);},onContextMenu:ot=>{ot.preventDefault(),X({isOpen:true,x:ot.clientX,y:ot.clientY,type:"task",task:q}),p?.(q,ot);},whileHover:{backgroundColor:Ve?t.accentLight:t.hoverBg},children:[W&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),J&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ht.map((ot,_a)=>{let br=_a===ht.length-1,Za=ot.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Za?"justify-start":"justify-center"}`,style:{width:`${ot.width}px`,minWidth:`${ot.minWidth??(Za?200:60)}px`,maxWidth:`${ot.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:br?"none":`1px solid ${N===q.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ze(ot,q,Za?te:0)},`${q.id}-${ot.id}`)})]},q.id)})}),jsxRuntime.jsx(ro,{isOpen:P.isOpen,x:P.x,y:P.y,items:P.type==="header"&&P.columnId?Be(P.columnId):P.type==="task"&&P.task?Ye(P.task):[],onClose:()=>X({...P,isOpen:false}),theme:t}),ct&&vt&&Y&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:vt.x+12,top:vt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let q=Ge.find(te=>te.task.id===Y)?.task;return q?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:q.name})}):null})()}),document.body)]})}function Zd(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[l,p]=react.useState(e),[m,n]=react.useState(t),[d,c]=react.useState(null),[i,u]=react.useState(null),[f,h]=react.useState(null),[g,w]=react.useState(null),[b,v]=react.useState(0),[x,T]=react.useState(0),[D,M]=react.useState(null),[k,B]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:l,setGhostX:p,ghostWidth:m,setGhostWidth:n,connectionLine:d,setConnectionLine:c,hoveredTaskId:i,setHoveredTaskId:u,activeZone:f,setActiveZone:h,draggedSegmentIndex:g,setDraggedSegmentIndex:w,draggedSegmentStartX:b,setDraggedSegmentStartX:v,segmentDragOffsetX:x,setSegmentDragOffsetX:T,hoveredSegmentIndex:D,setHoveredSegmentIndex:M,isHovered:k,setIsHovered:B,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(K,j)=>{r("none"),c(null),u(null),p(K),n(j),T(0),w(null),v(0);}}}function hn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:l,templates:p,onClick:m,onDoubleClick:n,onContextMenu:d,onDateChange:c,onDependencyCreate:i,allTaskPositions:u=[],onDragMove:f,onHoverChange:h}){let g=Zd(t,r),w=react.useRef(null),{dragMode:b,setDragMode:v,dragOffset:x,setDragOffset:T,ghostX:D,setGhostX:M,ghostWidth:k,setGhostWidth:B,connectionLine:N,setConnectionLine:C,hoveredTaskId:H,setHoveredTaskId:I,activeZone:K,setActiveZone:j,draggedSegmentIndex:$,setDraggedSegmentIndex:Z,draggedSegmentStartX:ce,setDraggedSegmentStartX:he,segmentDragOffsetX:R,setSegmentDragOffsetX:A,hoveredSegmentIndex:O,setHoveredSegmentIndex:P,isHovered:X,setIsHovered:Y,isDragging:U,isResizing:Se,isConnecting:Te,resetDragState:He}=g,xe=32,at=8,Le=e.endDate&&e.endDate<new Date&&e.progress<100,et=e.isCriticalPath,vt=o.name==="neutral"||o.today==="#1C1917",Pt=e.status==="completed"||e.progress===100,ct={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},se=e.isCriticalPath||Le?"#DC2626":e.color?e.color:e.priority&&ct[e.priority]?ct[e.priority]:o.taskBarPrimary,Ne=(le=>le>=80?20:le>=60?15:le>=50?12:10)(r),Ae=r<50,rt=r<40;react.useEffect(()=>{if(h)if(X&&!U&&!e.segments){let le=a<100;h({task:e,x:t,y:a,width:r,height:xe,showBelow:le});}else h(null);},[X,U,e,t,a,r,xe,h]);let ft=le=>le.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Re=()=>{let le=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${le} day${le!==1?"s":""}`},L=le=>Math.round(le/s)*s,Q=le=>{let Pe=Math.round(le/s),ke=new Date(l);return ke.setDate(ke.getDate()+Pe),ke},_e=(le,Pe)=>{for(let ke of u){if(ke.id===e.id)continue;let Ee=5;if(le>=ke.x-Ee&&le<=ke.x+ke.width+Ee&&Pe>=ke.y-Ee&&Pe<=ke.y+ke.height+Ee)return ke.id}return null},Ge=react.useCallback((le,Pe,ke)=>{le.preventDefault(),le.stopPropagation();let Ee=w.current?.ownerSVGElement;if(!Ee)return;let pe=Ee.createSVGPoint();pe.x=le.clientX,pe.y=le.clientY;let ze=pe.matrixTransform(Ee.getScreenCTM()?.inverse()),Be=ke!==void 0?ke:t,Ye=Pe;if(!Ye){let ht=ze.x-Be;le.shiftKey?(Ye="connect",C({x:t+r,y:a+xe/2})):le.ctrlKey||le.metaKey?Ye="move":le.altKey?Ye=ht<r/2?"resize-start":"resize-end":rt?ht<r/2?Ye="move":Ye="resize-end":Ae?ht<=Ne/2?Ye="resize-start":ht>=r-Ne/2?Ye="resize-end":Ye="move":ht<=Ne?Ye="resize-start":ht>=r-Ne?Ye="resize-end":Ye="move";}v(Ye),Y(false),j(null),Ye==="move"?T(ze.x-Be):Ye==="connect"?C({x:t+r,y:a+xe/2}):T(0),M(Be),B(r);},[t,r,a,xe]),kt=react.useCallback(le=>{if(b==="none")return;let Pe=w.current?.ownerSVGElement;if(!Pe)return;let ke=Pe.createSVGPoint();ke.x=le.clientX,ke.y=le.clientY;let Ee=ke.matrixTransform(Pe.getScreenCTM()?.inverse());if(b==="connect"){C({x:Ee.x,y:Ee.y});let pe=_e(Ee.x,Ee.y);I(pe);}else if(b==="move"){let pe=Ee.x-x,ze=L(pe);M(ze),B(r);let Be=Math.round((ze-t)/s);if(f?.(e.id,Be,true),e.segments&&e.segments.length>0&&$!==null){let Ye=ze-ce;A(Ye);}}else if(b==="resize-start"){let pe=Ee.x,ze=L(pe),Be=t+r-ze;Be>=s&&(M(ze),B(Be));}else if(b==="resize-end"){let pe=Ee.x,Be=L(pe)-t;Be>=s&&B(Be);}},[b,t,r,s,x,e,L,$,ce,_e,I,C,M,B,A,f]),ae=react.useCallback(()=>{if(b!=="none"){if(b==="connect")H&&i&&i(e,H),C(null),I(null);else {let le=e.endDate.getTime()-e.startDate.getTime(),Pe,ke,Ee=true;if(b==="move"){if(Pe=Q(D),ke=new Date(Pe.getTime()+le),e.segments&&e.segments.length>0&&$!==null){let pe=Math.round(R/s),ze=e.segments.map((Kt,q)=>{if(q===$){let te=new Date(Kt.startDate),Me=new Date(Kt.endDate);return te.setDate(te.getDate()+pe),Me.setDate(Me.getDate()+pe),{startDate:te,endDate:Me}}return Kt}),Be=ze.flatMap(Kt=>[Kt.startDate,Kt.endDate]),Ye=new Date(Math.min(...Be.map(Kt=>Kt.getTime()))),ht=new Date(Math.max(...Be.map(Kt=>Kt.getTime())));c?.({...e,segments:ze},Ye,ht),He(t,r);return}}else b==="resize-start"?(Pe=Q(D),ke=e.endDate,Pe>ke&&(console.warn("Invalid date range: start date must be before or equal to end date"),Ee=false)):b==="resize-end"?(Pe=e.startDate,ke=Q(D+k),ke<Pe&&(console.warn("Invalid date range: end date must be after or equal to start date"),Ee=false)):Ee=false;Ee&&Pe&&ke&&(ke.getTime()<Pe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):c?.(e,Pe,ke));}f?.(e.id,0,false),He(t,r);}},[b,D,k,e,c,H,i,t,r,s,Q,R,$,He,f]);react.useEffect(()=>{if(b==="none")return;let le=ke=>{kt(ke);},Pe=()=>{ae();};return window.addEventListener("mousemove",le),window.addEventListener("mouseup",Pe),()=>{window.removeEventListener("mousemove",le),window.removeEventListener("mouseup",Pe);}},[b,kt,ae]);let ie=U&&!Te?D:t,we=U&&!Te?k:r,De=p.taskClass(e);return jsxRuntime.jsxs("g",{ref:w,onMouseEnter:()=>!U&&Y(true),onMouseLeave:()=>{U||(Y(false),j(null));},onClick:()=>!U&&m?.(e),onDoubleClick:le=>{U||(le.stopPropagation(),n?.(e));},onContextMenu:le=>{le.preventDefault(),d?.(e,le);},children:[X&&!U&&!Ae&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Ne,height:xe,fill:K==="resize-start"?o.accent:"transparent",opacity:K==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>j("resize-start"),onMouseDown:le=>Ge(le,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Ne,y:a,width:r-Ne*2,height:xe,fill:K==="move"?o.accent:"transparent",opacity:K==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>j("move"),onMouseDown:le=>Ge(le,"move")}),jsxRuntime.jsx("rect",{x:t+r-Ne,y:a,width:Ne,height:xe,fill:K==="resize-end"?o.accent:"transparent",opacity:K==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>j("resize-end"),onMouseDown:le=>Ge(le,"resize-end")})]}),X&&!U&&rt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:xe,fill:K==="move"?o.accent:"transparent",opacity:K==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>j("move"),onMouseDown:le=>Ge(le,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:xe,fill:K==="resize-end"?o.accent:"transparent",opacity:K==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>j("resize-end"),onMouseDown:le=>Ge(le,"resize-end")}),X&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+xe-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),U&&!Te&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:D,y:a,width:k,height:xe,rx:at,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ie,y:a,width:we,height:xe,rx:at,fill:se,"data-task-class":De,initial:{opacity:0,scale:.95},animate:{opacity:U&&!Te?.15:e.parentId?.6:X?.9:.8,scale:X&&!U?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:le=>Ge(le),style:{cursor:U?Te?"crosshair":Se?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:ie,y:a,width:we*(e.progress/100),height:xe,rx:at,fill:se,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((le,Pe)=>{let ke=(le.startDate.getTime()-l.getTime())/864e5*s,pe=(le.endDate.getTime()-l.getTime())/(1e3*60*60*24)*s-ke+s,ze=U&&b==="move"&&$===Pe,Be=O===Pe,Ye=ze?ke+R:ke;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!U&&P(Pe),onMouseLeave:()=>!U&&P(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Ye,y:a,width:pe,height:xe,rx:at,fill:se,initial:{opacity:0,scale:.95},animate:{opacity:ze||e.parentId?.6:Be?.9:.8,scale:Be&&!U?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ht=>{ht.stopPropagation(),Z(Pe),he(ke),Ge(ht,void 0,ke);},style:{cursor:U?Te?"crosshair":Se?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Ye,y:a,width:pe*(e.progress/100),height:xe,rx:at,fill:se,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Pe}`)}),vt&&(Le||et)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[et&&!Le&&jsxRuntime.jsx("rect",{x:ie,y:a,width:we,height:xe,rx:at,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Le&&jsxRuntime.jsx("rect",{x:ie,y:a,width:we,height:xe,rx:at,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),we>60&&!e.segments&&(()=>{let le=p.taskLabel(e),Pe=typeof le=="string"?le:e.name,ke=Pe.length>Math.floor(we/8)?`${Pe.substring(0,Math.floor(we/8))}...`:Pe;return jsxRuntime.jsx("text",{x:ie+12,y:a+xe/2,dominantBaseline:"middle",fill:Pt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Pt?"line-through":"none"},children:ke})})(),we>100&&e.progress>0&&e.progress<100&&!U&&!e.segments&&jsxRuntime.jsxs("text",{x:ie+we-12,y:a+xe/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&&!U&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:ie+we-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:ie+we-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(X||Se)&&!Te&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Ae?ie-15:ie-10,y:a-5,width:Ae?25:20,height:xe+10,fill:"transparent",onMouseDown:le=>Ge(le,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ae?ie-8:ie-3,y:a+6,width:Ae?8:6,height:Ae?xe-12:xe-16,rx:3,fill:b==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:ie+we-10,y:a-5,width:Ae?25:20,height:xe+10,fill:"transparent",onMouseDown:le=>Ge(le,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ae?ie+we:ie+we-3,y:a+6,width:Ae?8:6,height:Ae?xe-12:xe-16,rx:3,fill:b==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:X&&!U&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+8,cy:a+xe/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:le=>{le.stopPropagation(),Ge(le,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+xe/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Te&&N&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+xe/2,x2:N.x,y2:N.y,stroke:H?o.statusCompleted:o.accent,strokeWidth:H?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:H?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:N.x,cy:N.y,r:H?8:6,fill:H?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),H&&jsxRuntime.jsx(framerMotion.motion.text,{x:N.x+15,y:N.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:N.x+10},animate:{opacity:1,x:N.x+15},transition:{duration:.2},children:"Connect"})]}),(X||U)&&!Te&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ie-2,y:a-2,width:we+4,height:xe+4,rx:at+2,fill:"none",stroke:U?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:U?.6:.4,initial:{opacity:0},animate:{opacity:U?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Se&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:D,y1:0,x2:D,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:D+k,y1:0,x2:D+k,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:X&&!U&&!e.segments&&!h&&(()=>{let ke=a<100,Ee=ke?a+xe+13:a-82-13,pe=ke?`M ${ie+we/2-6} ${a+xe+3} L ${ie+we/2} ${a+xe+13} L ${ie+we/2+6} ${a+xe+3}`:`M ${ie+we/2-6} ${a-13} L ${ie+we/2} ${a-3} L ${ie+we/2+6} ${a-13}`,ze=Ee+22,Be=Ee+40,Ye=Ee+55,ht=Ee+70,Kt=ke?Ee+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:ke?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ke?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:pe,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:ie+we/2-120,y:Ee,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:ie+we/2,y:ze,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:ie+we/2-110,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ie+we/2-70,y:Be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ft(e.startDate)}),jsxRuntime.jsx("text",{x:ie+we/2-110,y:Ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ie+we/2-70,y:Ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ft(e.endDate)}),jsxRuntime.jsx("text",{x:ie+we/2+10,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ie+we/2+65,y:Be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Re()}),jsxRuntime.jsx("text",{x:ie+we/2+10,y:Ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ie+we/2+65,y:Ye,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:ie+we/2-110,y:ht,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ie+we/2-50,y:ht,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(q=>q.name).join(", ").substring(0,30),e.assignees.map(q=>q.name).join(", ").length>30?"...":""]})]}),!ke&&jsxRuntime.jsx("text",{x:ie+we/2,y:Kt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:rt?"Left: move \u2022 Right: resize":Ae?"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 tc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:l,showBelow:p}=e,m=82,n=13,d=p?o+l+n:o-m-n,c=p?`M ${r+s/2-6} ${o+l+3} L ${r+s/2} ${o+l+13} L ${r+s/2+6} ${o+l+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=d+22,u=d+40,f=d+55,h=d+70,g=x=>x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),w=()=>{if(!a.startDate||!a.endDate)return "N/A";let x=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${x} day${x!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:p?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:p?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:c,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:d,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:i,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?g(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?g(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:w()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:f,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:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(x=>x.name).join(", ").substring(0,30),a.assignees.map(x=>x.name).join(", ").length>30?"...":""]})]})]})})}function vn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:l}){let[p,m]=react.useState(false),n=a-e,d=r-t,c=e+n/2,i=`M ${e} ${t} C ${c} ${t}, ${c} ${r}, ${a} ${r}`,u=6,f=Math.atan2(d,n),h=a-u*Math.cos(f-Math.PI/6),g=r-u*Math.sin(f-Math.PI/6),w=a-u*Math.cos(f+Math.PI/6),b=r-u*Math.sin(f+Math.PI/6),v=o.dependency;react.useEffect(()=>{l&&s&&l(p?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[p,e,t,a,r,s,l]);let x=!s&&!l;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!x&&m(true),onMouseLeave:()=>!x&&m(false),style:{pointerEvents:x?"none":"auto"},children:[!x&&jsxRuntime.jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:i,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:p&&l?0:p?1:.8,strokeWidth:p?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${h} ${g} M ${a} ${r} L ${w} ${b}`,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:p&&l?0:p?1:.8,scale:p?1.1:1,strokeWidth:p?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:v,initial:{scale:0},animate:{scale:p&&l?0:p?1.3:1,opacity:p&&l?0:p?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),p&&s&&!l&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:T=>{T.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:c,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:c-4,y1:(t+r)/2-4,x2:c+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:c+4,y1:(t+r)/2-4,x2:c-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function kn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,l]=react.useState(false),p=16,m=n=>n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:p+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-p/2,y:a+16-p/2,width:p,height:p,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-(p+4)/2,y:a+16-(p+4)/2,width:p+4,height:p+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var me={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=n=>{n.forEach(d=>{d.dependencies&&r.set(d.id,d.dependencies),d.subtasks&&o(d.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let l=new Set,p=new Set,m=n=>{if(!l.has(n)){l.add(n),p.add(n);let d=r.get(n)||[];for(let c of d){if(!l.has(c)&&m(c))return true;if(p.has(c))return true}}return p.delete(n),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=me.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=me.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=me.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=me.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
112
- `)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=me.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=me.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>me.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=me.findTaskById(e,t);return !a||!a.dependencies?[]:me.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>me.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>me.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=me.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>me.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=me.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let l=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],p=s.map(m=>{let n=m.startDate&&m.endDate?me.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?me.formatDate(m.startDate):"N/A",m.endDate?me.formatDate(m.endDate):"N/A",n>0?`${n} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:l,body:p,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=me.flattenTasks(e).map(m=>{let n=m.startDate&&m.endDate?me.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?me.formatDate(m.startDate):"","End Date":m.endDate?me.formatDate(m.endDate):"","Duration (days)":n>0?n:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(d=>d.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),s=a.utils.json_to_sheet(o),l=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=l;let p=a.utils.book_new();a.utils.book_append_sheet(p,s,"Gantt Tasks"),a.writeFile(p,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=me.flattenTasks(e),o=new Map;r.forEach((i,u)=>{o.set(i.id,u+1);});let s=i=>i.toISOString().replace("Z",""),l=me.getEarliestStartDate(e)||new Date,p=me.getLatestEndDate(e)||new Date,m=r.map((i,u)=>{let f=o.get(i.id),h=i.startDate&&i.endDate?me.calculateDuration(i.startDate,i.endDate):0,g=(i.dependencies||[]).filter(w=>o.has(w)).map(w=>`
111
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function zs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),i=react.useRef(null);react.useEffect(()=>{function d(l){s.current&&!s.current.contains(l.target)&&i.current&&!i.current.contains(l.target)&&o(false);}if(r)return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r]);let p=d=>{t(d),o(false);},m=e.reduce((d,l)=>{let n=l.category||"Other";return d[n]||(d[n]=[]),d[n].push(l),d},{});return jsxRuntime.jsxs("div",{className:b("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:i,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:d=>{d.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",d.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",d.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:b("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([d,l])=>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:d})}),jsxRuntime.jsx("div",{children:l.map(n=>jsxRuntime.jsxs("button",{onClick:()=>p(n),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:n.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:n.name}),n.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:n.description})]})]},n.id))})]},d)),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 Us({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[i,p]=react.useState("export"),[m,d]=react.useState("json"),[l,n]=react.useState(null),g=react.useRef(null);if(!t)return null;let f=async()=>{let w=o?.current||void 0,h=await yl(e,m,w);vl(h,m);},c=async w=>{let h=w.target.files?.[0];if(h){try{let k=await wl(h),u=h.name.endsWith(".json")?"json":"csv",y=kl(k,u);n(y),y.success&&r&&r(y,k);}catch(k){n({success:false,errors:[`Failed to read file: ${k instanceof Error?k.message:"Unknown error"}`]});}g.current&&(g.current.value="");}};return jsxRuntime.jsxs("div",{className:b("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>p("export"),className:b("flex-1 px-6 py-4 font-semibold transition-colors",i==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>p("import"),className:b("flex-1 px-6 py-4 font-semibold transition-colors",i==="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:[i==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(w=>jsxRuntime.jsxs("button",{onClick:()=>d(w),className:b("p-4 rounded-lg border-2 transition-all text-center",m===w?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[w==="json"&&"\u{1F4C4}",w==="csv"&&"\u{1F4CA}",w==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:w})]},w))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:f,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"})]}),i==="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"})]})]}),l&&jsxRuntime.jsxs("div",{className:b("p-4 rounded-lg",l.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:b("font-semibold mb-2",l.success?"text-green-400":"text-red-400"),children:l.success?"\u2713 Import Successful":"\u2717 Import Failed"}),l.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",l.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",l.columnsImported]})]}),l.errors&&l.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:l.errors.map((w,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",w]},h))})]})]})]})]})]})}var vg=["URGENT","HIGH","MEDIUM","LOW"],xg=[{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"}],kg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ws({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:i,onFilterHighPriority:p,availableUsers:m=[],availableLabels:d=[],availableColumns:l=[],showQuickFilters:n=true,compact:g=false,groupBy:f="none",onGroupByChange:c}){let[w,h]=react.useState(true),k=react.useCallback(T=>{a({search:T.target.value});},[a]),u=react.useCallback(T=>{a({dateFilter:T.target.value});},[a]),y=react.useCallback(T=>{r({by:T.target.value});},[r]),v=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${g?"filter-bar--compact":""} ${w?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!w),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:w?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:w?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),D&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!w&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[n&&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"}),i&&jsxRuntime.jsx("button",{onClick:i,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),p&&jsxRuntime.jsx("button",{onClick:p,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:k,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:u,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:T=>{let M=T.target.value;a({priorities:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),vg.map(T=>jsxRuntime.jsx("option",{value:T,children:T},T))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:T=>{let M=T.target.value;a({assignees:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(T=>jsxRuntime.jsx("option",{value:T.id,children:T.name},T.id))]})}),d.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:T=>{let M=T.target.value;a({labels:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),d.map(T=>jsxRuntime.jsx("option",{value:T,children:T},T))]})}),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:y,className:"filter-bar__select filter-bar__select--sm",children:xg.map(T=>jsxRuntime.jsx("option",{value:T.value,children:T.label},T.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:v,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:f,onChange:T=>c(T.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:kg.map(T=>jsxRuntime.jsx("option",{value:T.value,children:T.label},T.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Hs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:i,onExportGanttPNG:p,onExportGanttCSV:m}){let[d,l]=react.useState(false),n=react.useRef(null);react.useEffect(()=>{let f=c=>{n.current&&!n.current.contains(c.target)&&l(false);};return d&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[d]);let g=f=>{f(),l(false);};return jsxRuntime.jsxs("div",{className:b("relative",r),ref:n,children:[jsxRuntime.jsxs("button",{onClick:()=>l(!d),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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",f.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",f.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":d,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"})]}),d&&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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 i?.()),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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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(()=>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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 Gs={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"}},_s={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"}},Vs={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"}},Er={dark:Gs,light:_s,neutral:Vs},ln="dark";var dn=react.createContext(void 0),Ag="asakaa-theme";function Nd({children:e,defaultTheme:t=ln,storageKey:a=Ag}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let p=localStorage.getItem(a);if(p&&(p==="dark"||p==="light"||p==="neutral"))return p}return t}),s=react.useCallback(p=>{o(p),typeof window<"u"&&localStorage.setItem(a,p);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let p=document.documentElement,m=Er[r];Object.entries(m.colors).forEach(([l,n])=>{n&&p.style.setProperty(`--theme-${Ig(l)}`,n);}),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(([l,n])=>{let g=m.colors[l];g&&p.style.setProperty(n,g);}),p.setAttribute("data-theme",r),p.classList.remove("theme-dark","theme-light","theme-neutral"),p.classList.add(`theme-${r}`);},[r]);let i={theme:r,setTheme:s,themes:Er};return jsxRuntime.jsx(dn.Provider,{value:i,children:e})}function eo(){let e=react.useContext(dn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Ig(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function js({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=eo();return e?jsxRuntime.jsxs("div",{className:b("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Er).map(([s,i])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:b("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:i.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:i.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 Sd(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return je[e]||je.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,i)=>a.getPropertyValue(s).trim()||i;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 cn={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Ed={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Ks={en:cn,es:Ed};function Pd(e){return Ks[e]||Ks.en}function Ys(e,t){let a=Pd(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 ao=react.createContext(cn);function Do(){return react.useContext(ao)}function qg({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:i}){let[p,m]=react.useState(false),[d,l]=react.useState(null),n=react.useRef(null),g=Do();if(react.useEffect(()=>{let h=k=>{n.current&&!n.current.contains(k.target)&&m(false);};return p&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[p]),!(t||a||r||o||s||i))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:i}].filter(h=>h.handler),w=async(h,k)=>{if(k){l(h);try{await k();}catch(u){console.error(`Export ${h} failed:`,u);}finally{l(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:n,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!p),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:p?e.accent:e.bgSecondary,border:`1px solid ${p?e.accent:e.borderLight}`,color:p?"#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:p?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&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((h,k)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(h.id,h.handler),disabled:d!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:k<c.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:d===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 Xg({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 i=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:i?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:i?600:500,zIndex:i?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[i&&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:i?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:i?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Jg({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 Zg({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),i=Do();react.useEffect(()=>{let d=l=>{s.current&&!s.current.contains(l.target)&&o(false);};return r&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r]);let p=[{value:"compact",label:i.toolbar.compact||"Compact"},{value:"comfortable",label:i.toolbar.normal||"Normal"},{value:"spacious",label:i.toolbar.spacious||"Spacious"}],m=p.find(d=>d.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:`${i.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:p.map((d,l)=>{let n=t===d.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(d.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:n?e.accentLight:"transparent",borderBottom:l<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:n?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:l*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:n?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500},children:d.label}),n&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},d.value)})})})})]})}function pn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:i,rowDensity:p,onRowDensityChange:m,showThemeSelector:d=false,showCreateTaskButton:l=false,createTaskLabel:n,onCreateTask:g,onExportPNG:f,onExportPDF:c,onExportExcel:w,onExportCSV:h,onExportJSON:k,onExportMSProject:u}){let y=Do(),v=f||c||w||h||k||u,D=[{value:"day",label:y.toolbar.day},{value:"week",label:y.toolbar.week},{value:"month",label:y.toolbar.month}],T=[{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(Jg,{options:D,value:t,onChange:M=>a(M),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(Zg,{theme:e,value:p,onChange:m})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[l&&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:n||y.toolbar.createTask})]}),(v||d)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qg,{theme:e,onExportPNG:f,onExportPDF:c,onExportExcel:w,onExportCSV:h,onExportJSON:k,onExportMSProject:u}),d&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),d&&jsxRuntime.jsx(Xg,{options:T,value:s,onChange:M=>i(M),theme:e})]})]})}function mn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,i]=react.useState({x:0,y:0}),p=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let l=n=>{p.current&&!p.current.contains(n.target)&&o(false);};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let d=e.filter(l=>l.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let l=m.current.getBoundingClientRect();i({x:l.left,y:l.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(lt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:p,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"}),d.map(l=>jsxRuntime.jsxs("button",{onClick:()=>{t(l.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:n=>{n.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:l.label}),l.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},l.id))]})})})})]})}function ro({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let i=react.useRef(null),[p,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let l=200,n=r.length*36+8,g=8,f=window.innerWidth,c=window.innerHeight,w=t,h=a;t+l+g>f&&(w=t-l,w<g&&(w=g)),a+n+g>c&&(h=c-n-g,h<g&&(h=g)),m({x:w,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let l=g=>{i.current&&!i.current.contains(g.target)&&o();},n=g=>{g.key==="Escape"&&o();};return document.addEventListener("mousedown",l),document.addEventListener("keydown",n),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",n);}},[e,o]),!e)return null;let d=l=>l.startsWith("#")&&(l.length===7||l.length===4)?l: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:i,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:`${p.x}px`,top:`${p.y}px`,backgroundColor:d(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(l=>jsxRuntime.jsxs("div",{children:[l.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{l.disabled||(l.onClick(),o());},disabled:l.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:l.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:l.disabled?"not-allowed":"pointer",opacity:l.disabled?.5:1},onMouseEnter:n=>{l.disabled||(n.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent";},children:[l.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:l.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:l.label}),l.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},l.id))})})})}var St={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 Hd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:i,onTaskIndent:p,onTaskOutdent:m,onTaskRename:d,onTaskToggleExpand:l,onOpenTaskModal:n,enableKeyboard:g=true}){let f=react.useRef(false),c=react.useCallback(y=>{f.current=y;},[]),w=react.useCallback(y=>{let v=[],D=T=>{for(let M of T)v.push(M),M.subtasks&&M.subtasks.length>0&&M.isExpanded&&D(M.subtasks);};return D(y),v},[]),h=react.useCallback(()=>{let y=w(e);for(let v of y)if(t.has(v.id))return v;return null},[e,t,w]),k=react.useCallback((y,v)=>{let D=w(e);if(D.length===0)return;let T=h();if(!T){a(D[0].id,false);return}let M=D.findIndex(N=>N.id===T.id);if(M===-1)return;let x=y==="up"?M-1:M+1;if(x<0||x>=D.length)return;let L=D[x];a(L.id,v);},[e,h,w,a]),u=react.useCallback(y=>{if(!g)return;let v=y.target;if(v.tagName==="INPUT"||v.tagName==="TEXTAREA"||v.isContentEditable||f.current){y.key==="Escape"&&(v.blur(),f.current=false);return}let M=navigator.platform.toUpperCase().indexOf("MAC")>=0?y.metaKey:y.ctrlKey,x=Array.from(t),L=h();if(y.key==="ArrowUp"){y.preventDefault(),k("up",y.shiftKey);return}if(y.key==="ArrowDown"){y.preventDefault(),k("down",y.shiftKey);return}if(L&&(y.key==="ArrowRight"||y.key==="ArrowLeft")){L.subtasks&&L.subtasks.length>0&&(y.preventDefault(),(y.key==="ArrowRight"&&!L.isExpanded||y.key==="ArrowLeft"&&L.isExpanded)&&l(L.id));return}if(y.altKey&&(y.key==="ArrowUp"||y.key==="ArrowDown")){x.length>0&&(y.preventDefault(),i(x,y.key==="ArrowUp"?"up":"down"));return}if(y.key==="Tab"&&!y.shiftKey){x.length>0&&(y.preventDefault(),p(x));return}if(y.key==="Tab"&&y.shiftKey){x.length>0&&(y.preventDefault(),m(x));return}if(y.key==="Enter"&&!y.shiftKey&&!M){L&&(y.preventDefault(),r(L.id,"below"));return}if(y.key==="Enter"&&y.shiftKey&&!M){L&&(y.preventDefault(),r(L.id,"above"));return}if(y.key==="Enter"&&M){L&&(y.preventDefault(),n(L.id));return}if(y.key==="F2"){L&&(y.preventDefault(),d(L.id));return}if(y.key==="Delete"||y.key==="Backspace"&&M){x.length>0&&(y.preventDefault(),o(x));return}if(y.key==="d"&&M&&!y.shiftKey){x.length>0&&(y.preventDefault(),s(x));return}},[g,t,h,k,r,o,s,i,p,m,d,l,n]);return react.useEffect(()=>{if(g)return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u);}},[g,u]),{setIsEditing:c}}function _d(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(n=>{t(new Set([n])),r(n);},[]),s=react.useCallback(n=>{t(g=>{let f=new Set(g);return f.has(n)?f.delete(n):f.add(n),f}),r(n);},[]),i=react.useCallback((n,g)=>{if(!a){o(n);return}let f=g.indexOf(a),c=g.indexOf(n);if(f===-1||c===-1){o(n);return}let w=Math.min(f,c),h=Math.max(f,c),k=g.slice(w,h+1);t(new Set(k)),r(n);},[a,o]),p=react.useCallback((n,g,f,c)=>{c?i(n,g):f?s(n):o(n);},[o,s,i]),m=react.useCallback((n,g)=>{g?t(f=>{let c=new Set(f);return c.add(n),c}):o(n);},[o]),d=react.useCallback(()=>{t(new Set),r(null);},[]),l=react.useCallback(n=>e.has(n),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:i,handleTaskClick:p,handleKeyboardSelection:m,clearSelection:d,isTaskSelected:l}}function oo(e){let t=[],a=(r,o,s=0)=>{for(let i=0;i<r.length;i++){let p={...r[i],parentId:o,level:s,position:i};t.push(p),p.subtasks&&p.subtasks.length>0&&p.isExpanded&&a(p.subtasks,p.id,s+1);}};return a(e),t}function Vd(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Vd(a.subtasks,t);if(r)return r}}return null}function Js(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Js(a.subtasks,t);if(r)return r}return null}function Zs(e,t){if(t.length===0)return e;let a=oo(e),r=t[0],o=a.findIndex(n=>n.id===r);if(o<=0)return e;let s=a[o-1],i=(n,g)=>{let f=[];return {tasks:n.filter(w=>{if(g.has(w.id))return f.push(w),false;if(w.subtasks){let h=i(w.subtasks,g);w.subtasks=h.tasks,f.push(...h.removed);}return true}),removed:f}},p=(n,g,f)=>n.map(c=>c.id===g?{...c,subtasks:[...c.subtasks||[],...f],isExpanded:true}:c.subtasks?{...c,subtasks:p(c.subtasks,g,f)}:c),m=new Set(t),{tasks:d,removed:l}=i(e,m);return p(d,s.id,l)}function Qs(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Js(a,r);if(!o)continue;let s=Js(a,o.id),i=(d,l,n)=>{for(let g=0;g<d.length;g++){let f=d[g];if(f.id===l&&f.subtasks){let c=f.subtasks.findIndex(w=>w.id===n);if(c!==-1){let[w]=f.subtasks.splice(c,1);return w}}if(f.subtasks){let c=i(f.subtasks,l,n);if(c)return c}}return null},p=(d,l,n)=>{let g=d.findIndex(f=>f.id===l);if(g!==-1)return d.splice(g+1,0,n),d;for(let f of d)f.subtasks&&p(f.subtasks,l,n);return d},m=i(a,o.id,r);m&&(s&&s.subtasks?p(s.subtasks,o.id,m):p(a,o.id,m));}return a}function ei(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(i,p,m)=>{let d=i.findIndex(n=>n.id===p);if(d===-1){for(let n of i)if(n.subtasks&&s(n.subtasks,p,m))return true;return false}let l=m==="up"?d-1:d+1;return l<0||l>=i.length?false:([i[d],i[l]]=[i[l],i[d]],true)};return s(r,o,a),r}function ti(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 ai(e,t){let a=[...e];for(let r of t){let o=i=>{let p=i.findIndex(l=>l.id===r);if(p===-1){for(let l of i)if(l.subtasks&&o(l.subtasks))return true;return false}let m=i[p],d={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return i.splice(p+1,0,d),true},s=i=>i.map(p=>({...p,id:`${p.id}-copy-${Date.now()}`,subtasks:p.subtasks?s(p.subtasks):void 0}));o(a);}return a}function jd(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let i={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},p=m=>{let d=m.findIndex(n=>n.id===t);if(d===-1){for(let n of m)if(n.subtasks&&p(n.subtasks))return true;return false}let l=a==="above"?d:d+1;return m.splice(l,0,i),true};return p(r),{tasks:r,newTask:i}}function ri(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ri(r.subtasks,t,a)}:r)}function oi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:oi(a.subtasks,t)}:a)}function ni(e,t){let a=l=>{for(let n of l){if(n.id===t)return n;if(n.subtasks){let g=a(n.subtasks);if(g)return g}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let i=r?.startDate||o,p=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(i),endDate:new Date(p),color:r?.color||"#3B82F6"},d=l=>l.map(n=>{if(n.id===t){let g=n.subtasks||[];return {...n,subtasks:[...g,m],isExpanded:true}}return n.subtasks?{...n,subtasks:d(n.subtasks)}:n});return {tasks:d(e),newTask:m}}function Kd(e,t,a,r){if(t===a)return e;let o=Vd(e,t);if(!o)return e;if(a){let p=(m,d)=>{if(!m.subtasks)return false;for(let l of m.subtasks)if(l.id===d||p(l,d))return true;return false};if(p(o,a))return e}let s=p=>p.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),i=s(e);if(a===null){let p=r!==void 0?r:i.length;i.splice(p,0,{...o,parentId:void 0});}else {let p=m=>m.map(d=>{if(d.id===a){let l=d.subtasks||[],n=r!==void 0?r:l.length,g=[...l];return g.splice(n,0,{...o,parentId:a}),{...d,subtasks:g,isExpanded:true}}return d.subtasks&&d.subtasks.length>0?{...d,subtasks:p(d.subtasks)}:d});i=p(i);}return i}function fn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:i,onTaskContextMenu:p,onTaskToggle:m,scrollTop:d,columns:l,onToggleColumn:n,onColumnResize:g,onTaskUpdate:f,onTaskIndent:c,onTaskOutdent:w,onTaskMove:h,onMultiTaskDelete:k,onTaskDuplicate:u,onTaskCreate:y,onTaskRename:v,onCreateSubtask:D,onOpenTaskModal:T,onDeleteRequest:M,onTaskReparent:x}){let L=react.useContext(ao),[N,C]=react.useState(null),[W,I]=react.useState(null),[K,V]=react.useState(""),z=react.useRef(null),[Q,ue]=react.useState(null),[ve,B]=react.useState(0),[A,R]=react.useState(0),[P,J]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[q,$]=react.useState(null),[ke,Ae]=react.useState(null),[He,we]=react.useState(null),Je=react.useRef(0),Be=5,at=react.useRef(false),[Pt,bt]=react.useState(null),[rt,O]=react.useState(false),[ie,ge]=react.useState(null),[De,Me]=react.useState(false),st=react.useRef(null);react.useEffect(()=>{function Y(re){st.current&&!st.current.contains(re.target)&&Me(false);}if(De)return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[De]),react.useEffect(()=>{W&&z.current&&(z.current.focus(),z.current.select());},[W]),react.useEffect(()=>{if(!Q)return;let Y=Pe=>{let Ve=Pe.clientX-ve,We=A+Ve;g?.(Q,We);},re=()=>{ue(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",Y),document.addEventListener("mouseup",re),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",re),document.body.style.cursor="",document.body.style.userSelect="";}},[Q,ve,A,g]);let{selectedTaskIds:wt,handleTaskClick:$e,isTaskSelected:be}=_d(),{setIsEditing:Ne}=Hd({tasks:e,selectedTaskIds:wt,onTaskSelect:(Y,re)=>{let Ve=oo(e).map(We=>We.id);$e(Y,Ve,re||false,false);},onTaskCreate:y||(()=>{}),onTaskDelete:k||(()=>{}),onTaskDuplicate:u||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:c||(()=>{}),onTaskOutdent:w||(()=>{}),onTaskRename:Y=>{let re=oo(e).find(Pe=>Pe.id===Y);re&&Ee(re);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:Y=>{let re=oo(e).find(Pe=>Pe.id===Y);re&&T&&T(re);},enableKeyboard:true}),Kt=(Y,re=0)=>{let Pe=[];for(let Ve of Y)Pe.push({task:Ve,level:re}),Ve.subtasks&&Ve.subtasks.length>0&&Ve.isExpanded&&Pe.push(...Kt(Ve.subtasks,re+1));return Pe},H=Kt(e),Se=48,et=Math.max(H.length*a,600-Se),Ce=Y=>!Y.startDate||!Y.endDate?"-":`${Math.ceil((Y.endDate.getTime()-Y.startDate.getTime())/(1e3*60*60*24))}d`,Ee=Y=>{I(Y.id),V(Y.name),Ne(true);},ae=Y=>{K.trim()&&K!==e.find(re=>re.id===Y)?.name&&v?.(Y,K.trim()),I(null),V(""),Ne(false);},X=()=>{I(null),V(""),Ne(false);},Te=(Y,re)=>{re.stopPropagation(),D?.(Y.id);},ee=(Y,re)=>{re.preventDefault(),Je.current=re.clientY,$(Y),at.current=false,O(false),bt({x:re.clientX,y:re.clientY});},ze=Y=>{if(!q||(Math.abs(Y.clientY-Je.current)>Be&&!at.current&&(at.current=true,O(true)),bt({x:Y.clientX,y:Y.clientY}),!at.current))return;let Pe=document.querySelectorAll("[data-task-row]"),Ve=null,We=null;Pe.forEach(U=>{let Z=U.getBoundingClientRect(),Le=U.getAttribute("data-task-row");if(Le&&Le!==q&&Y.clientY>=Z.top&&Y.clientY<=Z.bottom){Ve=Le;let kt=Y.clientY-Z.top,it=Z.height;kt<it*.25?We="above":kt>it*.75?We="below":We="child";}}),Ae(Ve),we(We);},Fe=()=>{if(at.current&&q&&ke&&He){if(He==="child")x?.(q,ke);else if(He==="above"||He==="below"){let Y=(Ve,We,U=null)=>{for(let Z of Ve){if(Z.id===We)return U;if(Z.subtasks){let Le=Y(Z.subtasks,We,Z.id);if(Le!==void 0)return Le}}},re=Y(e,ke,null),Pe=(Ve,We)=>{let U=Ve.findIndex(Z=>Z.id===We);return He==="below"?U+1:U};if(re===null){let Ve=Pe(e,ke);x?.(q,null,Ve);}else {let Ve=H.find(We=>We.task.id===re)?.task;if(Ve?.subtasks){let We=Pe(Ve.subtasks,ke);x?.(q,re,We);}}}}$(null),Ae(null),we(null),bt(null),at.current=false,O(false);};react.useEffect(()=>{if(q)return document.addEventListener("mousemove",ze),document.addEventListener("mouseup",Fe),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ze),document.removeEventListener("mouseup",Fe),document.body.style.cursor="",document.body.style.userSelect="";}},[q,ke,He]);let Ze=(Y,re,Pe)=>{switch(Y.id){case "name":let Ve=W===re.id,We=N===re.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Pe*20}px`},children:[x&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:We?1:.3},onMouseDown:ce=>ee(re.id,ce),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),re.subtasks&&re.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ce=>{ce.stopPropagation(),m?.(re.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:re.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:re.color||"#3B82F6",opacity:re.parentId?.6:1,borderColor:re.isMilestone?t.accent:"transparent",borderWidth:re.isMilestone?"2px":"0px"},title:re.isMilestone?"Milestone":re.parentId?"Subtask":"Task"})}),Ve?jsxRuntime.jsx("input",{ref:z,type:"text",value:K,onChange:ce=>V(ce.target.value),onKeyDown:ce=>{ce.key==="Enter"?ae(re.id):ce.key==="Escape"&&X();},onBlur:()=>ae(re.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:ce=>ce.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:re.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:re.parentId?"13px":"14px",fontWeight:re.isMilestone?600:re.parentId?400:600,letterSpacing:re.parentId?"0":"-0.01em"},title:re.name,children:re.name}),We&&!Ve&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ce=>ce.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ce=>Te(re,ce),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:ce=>{ce.stopPropagation(),Ee(re);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let Z=Y.id==="startDate"?"startDate":"endDate",Le=re[Z],kt=ie?.taskId===re.id&&ie?.field===Z,it=ce=>ce?(typeof ce=="string"?new Date(ce):ce).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:ce=>ce.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:ce=>{if(kt)ge(null);else {let Mt=ce.currentTarget.getBoundingClientRect();ge({taskId:re.id,field:Z,month:Le?typeof Le=="string"?new Date(Le):Le:new Date,position:{top:Mt.bottom+4,left:Mt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:it(Le)})]}),kt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ge(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:ie?.position.top,left:ie?.position.left},onClick:ce=>ce.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ce=new Date,Mt=new Date(ce);Mt.setDate(ce.getDate()+1);let ea=new Date(ce);ea.setDate(ce.getDate()+7);let $r=new Date(ce);return $r.setDate(ce.getDate()+14),[{label:"Hoy",date:ce},{label:"Ma\xF1ana",date:Mt},{label:"Pr\xF3xima semana",date:ea},{label:"2 semanas",date:$r}].map((er,ja)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:yr=>yr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:yr=>yr.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(re.id,{[Z]:er.date}),ge(null);},children:er.label},ja))})(),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:ce=>ce.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(re.id,{[Z]:void 0}),ge(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:()=>ge(ce=>ce?{...ce,month:new Date(ce.month.getFullYear(),ce.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:ie?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ge(ce=>ce?{...ce,month:new Date(ce.month.getFullYear(),ce.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((ce,Mt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ce},Mt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ce=ie?.month||new Date,Mt=ce.getFullYear(),ea=ce.getMonth(),$r=new Date(Mt,ea,1).getDay(),Wo=new Date(Mt,ea+1,0).getDate(),er=new Date,ja=[];for(let $t=$r-1;$t>=0;$t--)ja.push({day:new Date(Mt,ea,-$t).getDate(),date:new Date(Mt,ea-1,new Date(Mt,ea,-$t).getDate()),isCurrentMonth:false});for(let $t=1;$t<=Wo;$t++)ja.push({day:$t,date:new Date(Mt,ea,$t),isCurrentMonth:true});let yr=42-ja.length;for(let $t=1;$t<=yr;$t++)ja.push({day:$t,date:new Date(Mt,ea+1,$t),isCurrentMonth:false});return ja.map(($t,mo)=>{let jn=$t.date.toDateString()===er.toDateString(),uo=(Le?typeof Le=="string"?new Date(Le):Le:null)?.toDateString()===$t.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:$t.isCurrentMonth?uo?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:uo?"#3B82F6":"transparent",boxShadow:jn&&!uo?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(re.id,{[Z]:$t.date}),ge(null);},children:$t.day},mo)})})()})]})]})]}),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(re)})});case "assignees":let Va=r.filter(ce=>re.assignees?.some(Mt=>Mt.name===ce.name||Mt.initials===ce.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx(Tr,{assignedUsers:Va,availableUsers:r,onChange:ce=>{let Mt=ce.map(ea=>({id:ea.id,name:ea.name,initials:ea.initials,color:ea.color}));f?.(re.id,{assignees:Mt.length>0?Mt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx(Wl,{status:re.status||"todo",onChange:ce=>{f?.(re.id,{status:ce,progress:ce==="completed"?100:re.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:`${re.progress}%`,backgroundColor:re.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:[re.progress,"%"]})]});case "priority":let br={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Qa={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},po=br[re.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsxRuntime.jsx(wr,{priority:po,onChange:ce=>{ce&&f?.(re.id,{priority:Qa[ce]||"medium"});}})});default:return null}},Ie=Y=>[{id:"hide",label:"Hide Column",icon:St.Hide,onClick:()=>n(Y),disabled:Y==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:St.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:St.SortDesc,onClick:()=>{}}],pe=Y=>Y.subtasks&&Y.subtasks.length>0?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:St.Add,onClick:()=>{D?.(Y.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:St.Delete,onClick:()=>{M?M(Y.id,Y.name):k?.([Y.id]);}}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:St.Pencil,onClick:()=>{i?.(Y);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:St.Add,onClick:()=>{D?.(Y.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:L?.contextMenu?.markIncomplete||"Mark Incomplete",icon:St.MarkIncomplete,onClick:()=>{f?.(Y.id,{status:"todo",progress:0});},disabled:Y.status==="todo"},{id:"setInProgress",label:L?.contextMenu?.setInProgress||"Set In Progress",icon:St.SetInProgress,onClick:()=>{f?.(Y.id,{status:"in-progress"});},disabled:Y.status==="in-progress"},{id:"markComplete",label:L?.contextMenu?.markComplete||"Mark Complete",icon:St.MarkComplete,onClick:()=>{f?.(Y.id,{status:"completed",progress:100});},disabled:Y.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:L?.contextMenu?.splitTask||"Split Task",icon:St.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:St.Delete,onClick:()=>{M?M(Y.id,Y.name):k?.([Y.id]);}}],Re=l.filter(Y=>Y.visible),ot=Re.reduce((Y,re)=>Y+re.width,0);return jsxRuntime.jsxs("div",{className:"h-full",style:{backgroundColor:t.bgPrimary,minWidth:ot},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Se}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:Re.map((Y,re)=>{let Pe=re===Re.length-1,Ve=Y.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ve?"":"justify-center"}`,style:{width:`${Y.width}px`,minWidth:`${Y.minWidth??(Ve?200:60)}px`,maxWidth:`${Y.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Pe?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:We=>{We.preventDefault(),J({isOpen:true,x:We.clientX,y:We.clientY,type:"header",columnId:Y.id});},onMouseEnter:We=>{We.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:We=>{We.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:Y.label,children:Y.label}),Y.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Q===Y.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:We=>{We.preventDefault(),We.stopPropagation(),ue(Y.id),B(We.clientX),R(Y.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"}})})]},Y.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(mn,{columns:l,onToggleColumn:n,theme:t}),jsxRuntime.jsx("button",{onClick:()=>Me(!De),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"})}),De&&jsxRuntime.jsxs("div",{ref:st,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:Y=>Y.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:()=>Me(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:et},children:H.map(({task:Y,level:re},Pe)=>{let Ve=be(Y.id),We=ke===Y.id,U=We&&He==="above",Z=We&&He==="below",Le=We&&He==="child",kt={};return Le&&(kt.backgroundColor=`${t.accent}15`,kt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":Y.id,className:`flex items-center cursor-pointer group ${q===Y.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ve?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ve?t.accentLight:Le?`${t.accent}15`:Pe%2===0?t.bgPrimary:t.bgGrid,...kt},onMouseEnter:()=>C(Y.id),onMouseLeave:()=>C(null),onClick:it=>{let br=oo(e).map(ce=>ce.id),po=navigator.platform.toUpperCase().indexOf("MAC")>=0?it.metaKey:it.ctrlKey;$e(Y.id,br,po,it.shiftKey),s?.(Y);},onDoubleClick:it=>{it.stopPropagation(),i?.(Y);},onContextMenu:it=>{it.preventDefault(),J({isOpen:true,x:it.clientX,y:it.clientY,type:"task",task:Y}),p?.(Y,it);},whileHover:{backgroundColor:Ve?t.accentLight:t.hoverBg},children:[U&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Z&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Re.map((it,Va)=>{let br=Va===Re.length-1,Qa=it.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Qa?"justify-start":"justify-center"}`,style:{width:`${it.width}px`,minWidth:`${it.minWidth??(Qa?200:60)}px`,maxWidth:`${it.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:br?"none":`1px solid ${N===Y.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ze(it,Y,Qa?re:0)},`${Y.id}-${it.id}`)})]},Y.id)})}),jsxRuntime.jsx(ro,{isOpen:P.isOpen,x:P.x,y:P.y,items:P.type==="header"&&P.columnId?Ie(P.columnId):P.type==="task"&&P.task?pe(P.task):[],onClose:()=>J({...P,isOpen:false}),theme:t}),rt&&Pt&&q&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Pt.x+12,top:Pt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let Y=H.find(re=>re.task.id===q)?.task;return Y?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:Y.name})}):null})()}),document.body)]})}function Zd(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[i,p]=react.useState(e),[m,d]=react.useState(t),[l,n]=react.useState(null),[g,f]=react.useState(null),[c,w]=react.useState(null),[h,k]=react.useState(null),[u,y]=react.useState(0),[v,D]=react.useState(0),[T,M]=react.useState(null),[x,L]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:i,setGhostX:p,ghostWidth:m,setGhostWidth:d,connectionLine:l,setConnectionLine:n,hoveredTaskId:g,setHoveredTaskId:f,activeZone:c,setActiveZone:w,draggedSegmentIndex:h,setDraggedSegmentIndex:k,draggedSegmentStartX:u,setDraggedSegmentStartX:y,segmentDragOffsetX:v,setSegmentDragOffsetX:D,hoveredSegmentIndex:T,setHoveredSegmentIndex:M,isHovered:x,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(K,V)=>{r("none"),n(null),f(null),p(K),d(V),D(0),k(null),y(0);}}}function hn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:i,templates:p,onClick:m,onDoubleClick:d,onContextMenu:l,onDateChange:n,onDependencyCreate:g,allTaskPositions:f=[],onDragMove:c,onHoverChange:w}){let h=Zd(t,r),k=react.useRef(null),{dragMode:u,setDragMode:y,dragOffset:v,setDragOffset:D,ghostX:T,setGhostX:M,ghostWidth:x,setGhostWidth:L,connectionLine:N,setConnectionLine:C,hoveredTaskId:W,setHoveredTaskId:I,activeZone:K,setActiveZone:V,draggedSegmentIndex:z,setDraggedSegmentIndex:Q,draggedSegmentStartX:ue,setDraggedSegmentStartX:ve,segmentDragOffsetX:B,setSegmentDragOffsetX:A,hoveredSegmentIndex:R,setHoveredSegmentIndex:P,isHovered:J,setIsHovered:q,isDragging:$,isResizing:ke,isConnecting:Ae,resetDragState:He}=h,we=32,Je=8,Be=e.endDate&&e.endDate<new Date&&e.progress<100,at=e.isCriticalPath,Pt=o.name==="neutral"||o.today==="#1C1917",bt=e.status==="completed"||e.progress===100,rt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ie=e.isCriticalPath||Be?"#DC2626":e.color?e.color:e.priority&&rt[e.priority]?rt[e.priority]:o.taskBarPrimary,De=(X=>X>=80?20:X>=60?15:X>=50?12:10)(r),Me=r<50,st=r<40;react.useEffect(()=>{if(w)if(J&&!$&&!e.segments){let X=a<100;w({task:e,x:t,y:a,width:r,height:we,showBelow:X});}else w(null);},[J,$,e,t,a,r,we,w]);let wt=X=>X.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),$e=()=>{let X=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${X} day${X!==1?"s":""}`},be=X=>Math.round(X/s)*s,Ne=X=>{let Te=Math.round(X/s),ee=new Date(i);return ee.setDate(ee.getDate()+Te),ee},Kt=(X,Te)=>{for(let ee of f){if(ee.id===e.id)continue;let ze=5;if(X>=ee.x-ze&&X<=ee.x+ee.width+ze&&Te>=ee.y-ze&&Te<=ee.y+ee.height+ze)return ee.id}return null},H=react.useCallback((X,Te,ee)=>{X.preventDefault(),X.stopPropagation();let ze=k.current?.ownerSVGElement;if(!ze)return;let Fe=ze.createSVGPoint();Fe.x=X.clientX,Fe.y=X.clientY;let Ze=Fe.matrixTransform(ze.getScreenCTM()?.inverse()),Ie=ee!==void 0?ee:t,pe=Te;if(!pe){let Re=Ze.x-Ie;X.shiftKey?(pe="connect",C({x:t+r,y:a+we/2})):X.ctrlKey||X.metaKey?pe="move":X.altKey?pe=Re<r/2?"resize-start":"resize-end":st?Re<r/2?pe="move":pe="resize-end":Me?Re<=De/2?pe="resize-start":Re>=r-De/2?pe="resize-end":pe="move":Re<=De?pe="resize-start":Re>=r-De?pe="resize-end":pe="move";}y(pe),q(false),V(null),pe==="move"?D(Ze.x-Ie):pe==="connect"?C({x:t+r,y:a+we/2}):D(0),M(Ie),L(r);},[t,r,a,we]),Se=react.useCallback(X=>{if(u==="none")return;let Te=k.current?.ownerSVGElement;if(!Te)return;let ee=Te.createSVGPoint();ee.x=X.clientX,ee.y=X.clientY;let ze=ee.matrixTransform(Te.getScreenCTM()?.inverse());if(u==="connect"){C({x:ze.x,y:ze.y});let Fe=Kt(ze.x,ze.y);I(Fe);}else if(u==="move"){let Fe=ze.x-v,Ze=be(Fe);M(Ze),L(r);let Ie=Math.round((Ze-t)/s);if(c?.(e.id,Ie,true),e.segments&&e.segments.length>0&&z!==null){let pe=Ze-ue;A(pe);}}else if(u==="resize-start"){let Fe=ze.x,Ze=be(Fe),Ie=t+r-Ze;Ie>=s&&(M(Ze),L(Ie));}else if(u==="resize-end"){let Fe=ze.x,Ie=be(Fe)-t;Ie>=s&&L(Ie);}},[u,t,r,s,v,e,be,z,ue,Kt,I,C,M,L,A,c]),et=react.useCallback(()=>{if(u!=="none"){if(u==="connect")W&&g&&g(e,W),C(null),I(null);else {let X=e.endDate.getTime()-e.startDate.getTime(),Te,ee,ze=true;if(u==="move"){if(Te=Ne(T),ee=new Date(Te.getTime()+X),e.segments&&e.segments.length>0&&z!==null){let Fe=Math.round(B/s),Ze=e.segments.map((ot,Y)=>{if(Y===z){let re=new Date(ot.startDate),Pe=new Date(ot.endDate);return re.setDate(re.getDate()+Fe),Pe.setDate(Pe.getDate()+Fe),{startDate:re,endDate:Pe}}return ot}),Ie=Ze.flatMap(ot=>[ot.startDate,ot.endDate]),pe=new Date(Math.min(...Ie.map(ot=>ot.getTime()))),Re=new Date(Math.max(...Ie.map(ot=>ot.getTime())));n?.({...e,segments:Ze},pe,Re),He(t,r);return}}else u==="resize-start"?(Te=Ne(T),ee=e.endDate,Te>ee&&(console.warn("Invalid date range: start date must be before or equal to end date"),ze=false)):u==="resize-end"?(Te=e.startDate,ee=Ne(T+x),ee<Te&&(console.warn("Invalid date range: end date must be after or equal to start date"),ze=false)):ze=false;ze&&Te&&ee&&(ee.getTime()<Te.getTime()?console.warn("Invalid date range: end date cannot be before start date"):n?.(e,Te,ee));}c?.(e.id,0,false),He(t,r);}},[u,T,x,e,n,W,g,t,r,s,Ne,B,z,He,c]);react.useEffect(()=>{if(u==="none")return;let X=ee=>{Se(ee);},Te=()=>{et();};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",Te),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",Te);}},[u,Se,et]);let Ce=$&&!Ae?T:t,Ee=$&&!Ae?x:r,ae=p.taskClass(e);return jsxRuntime.jsxs("g",{ref:k,onMouseEnter:()=>!$&&q(true),onMouseLeave:()=>{$||(q(false),V(null));},onClick:()=>!$&&m?.(e),onDoubleClick:X=>{$||(X.stopPropagation(),d?.(e));},onContextMenu:X=>{X.preventDefault(),l?.(e,X);},children:[J&&!$&&!Me&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:De,height:we,fill:K==="resize-start"?o.accent:"transparent",opacity:K==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>V("resize-start"),onMouseDown:X=>H(X,"resize-start")}),jsxRuntime.jsx("rect",{x:t+De,y:a,width:r-De*2,height:we,fill:K==="move"?o.accent:"transparent",opacity:K==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>V("move"),onMouseDown:X=>H(X,"move")}),jsxRuntime.jsx("rect",{x:t+r-De,y:a,width:De,height:we,fill:K==="resize-end"?o.accent:"transparent",opacity:K==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>V("resize-end"),onMouseDown:X=>H(X,"resize-end")})]}),J&&!$&&st&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:we,fill:K==="move"?o.accent:"transparent",opacity:K==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>V("move"),onMouseDown:X=>H(X,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:we,fill:K==="resize-end"?o.accent:"transparent",opacity:K==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>V("resize-end"),onMouseDown:X=>H(X,"resize-end")}),J&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+we-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),$&&!Ae&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:T,y:a,width:x,height:we,rx:Je,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ce,y:a,width:Ee,height:we,rx:Je,fill:ie,"data-task-class":ae,initial:{opacity:0,scale:.95},animate:{opacity:$&&!Ae?.15:e.parentId?.6:J?.9:.8,scale:J&&!$?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:X=>H(X),style:{cursor:$?Ae?"crosshair":ke?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Ce,y:a,width:Ee*(e.progress/100),height:we,rx:Je,fill:ie,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((X,Te)=>{let ee=(X.startDate.getTime()-i.getTime())/864e5*s,Fe=(X.endDate.getTime()-i.getTime())/(1e3*60*60*24)*s-ee+s,Ze=$&&u==="move"&&z===Te,Ie=R===Te,pe=Ze?ee+B:ee;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!$&&P(Te),onMouseLeave:()=>!$&&P(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:pe,y:a,width:Fe,height:we,rx:Je,fill:ie,initial:{opacity:0,scale:.95},animate:{opacity:Ze||e.parentId?.6:Ie?.9:.8,scale:Ie&&!$?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Re=>{Re.stopPropagation(),Q(Te),ve(ee),H(Re,void 0,ee);},style:{cursor:$?Ae?"crosshair":ke?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:pe,y:a,width:Fe*(e.progress/100),height:we,rx:Je,fill:ie,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Te}`)}),Pt&&(Be||at)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[at&&!Be&&jsxRuntime.jsx("rect",{x:Ce,y:a,width:Ee,height:we,rx:Je,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Be&&jsxRuntime.jsx("rect",{x:Ce,y:a,width:Ee,height:we,rx:Je,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Ee>60&&!e.segments&&(()=>{let X=p.taskLabel(e),Te=typeof X=="string"?X:e.name,ee=Te.length>Math.floor(Ee/8)?`${Te.substring(0,Math.floor(Ee/8))}...`:Te;return jsxRuntime.jsx("text",{x:Ce+12,y:a+we/2,dominantBaseline:"middle",fill:bt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:bt?"line-through":"none"},children:ee})})(),Ee>100&&e.progress>0&&e.progress<100&&!$&&!e.segments&&jsxRuntime.jsxs("text",{x:Ce+Ee-12,y:a+we/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&Ee>80&&!$&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Ce+Ee-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Ce+Ee-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(J||ke)&&!Ae&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Me?Ce-15:Ce-10,y:a-5,width:Me?25:20,height:we+10,fill:"transparent",onMouseDown:X=>H(X,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Me?Ce-8:Ce-3,y:a+6,width:Me?8:6,height:Me?we-12:we-16,rx:3,fill:u==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:u==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Ce+Ee-10,y:a-5,width:Me?25:20,height:we+10,fill:"transparent",onMouseDown:X=>H(X,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Me?Ce+Ee:Ce+Ee-3,y:a+6,width:Me?8:6,height:Me?we-12:we-16,rx:3,fill:u==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:u==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:J&&!$&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+8,cy:a+we/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:X=>{X.stopPropagation(),H(X,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+we/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Ae&&N&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+we/2,x2:N.x,y2:N.y,stroke:W?o.statusCompleted:o.accent,strokeWidth:W?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:W?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:N.x,cy:N.y,r:W?8:6,fill:W?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),W&&jsxRuntime.jsx(framerMotion.motion.text,{x:N.x+15,y:N.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:N.x+10},animate:{opacity:1,x:N.x+15},transition:{duration:.2},children:"Connect"})]}),(J||$)&&!Ae&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ce-2,y:a-2,width:Ee+4,height:we+4,rx:Je+2,fill:"none",stroke:$?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:$?.6:.4,initial:{opacity:0},animate:{opacity:$?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ke&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:T,y1:0,x2:T,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:T+x,y1:0,x2:T+x,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:J&&!$&&!e.segments&&!w&&(()=>{let ee=a<100,ze=ee?a+we+13:a-82-13,Fe=ee?`M ${Ce+Ee/2-6} ${a+we+3} L ${Ce+Ee/2} ${a+we+13} L ${Ce+Ee/2+6} ${a+we+3}`:`M ${Ce+Ee/2-6} ${a-13} L ${Ce+Ee/2} ${a-3} L ${Ce+Ee/2+6} ${a-13}`,Ze=ze+22,Ie=ze+40,pe=ze+55,Re=ze+70,ot=ee?ze+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:ee?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ee?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Fe,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Ce+Ee/2-120,y:ze,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:Ce+Ee/2,y:Ze,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Ce+Ee/2-110,y:Ie,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Ce+Ee/2-70,y:Ie,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:wt(e.startDate)}),jsxRuntime.jsx("text",{x:Ce+Ee/2-110,y:pe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Ce+Ee/2-70,y:pe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:wt(e.endDate)}),jsxRuntime.jsx("text",{x:Ce+Ee/2+10,y:Ie,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Ce+Ee/2+65,y:Ie,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$e()}),jsxRuntime.jsx("text",{x:Ce+Ee/2+10,y:pe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Ce+Ee/2+65,y:pe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:Ce+Ee/2-110,y:Re,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Ce+Ee/2-50,y:Re,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Y=>Y.name).join(", ").substring(0,30),e.assignees.map(Y=>Y.name).join(", ").length>30?"...":""]})]}),!ee&&jsxRuntime.jsx("text",{x:Ce+Ee/2,y:ot,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:st?"Left: move \u2022 Right: resize":Me?"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 tc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:i,showBelow:p}=e,m=82,d=13,l=p?o+i+d:o-m-d,n=p?`M ${r+s/2-6} ${o+i+3} L ${r+s/2} ${o+i+13} L ${r+s/2+6} ${o+i+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,g=l+22,f=l+40,c=l+55,w=l+70,h=v=>v.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),k=()=>{if(!a.startDate||!a.endDate)return "N/A";let v=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${v} day${v!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:p?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:p?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:n,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:l,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y: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:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:f,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: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?h(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:k()}),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:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(v=>v.name).join(", ").substring(0,30),a.assignees.map(v=>v.name).join(", ").length>30?"...":""]})]})]})})}function vn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:i}){let[p,m]=react.useState(false),d=a-e,l=r-t,n=e+d/2,g=`M ${e} ${t} C ${n} ${t}, ${n} ${r}, ${a} ${r}`,f=6,c=Math.atan2(l,d),w=a-f*Math.cos(c-Math.PI/6),h=r-f*Math.sin(c-Math.PI/6),k=a-f*Math.cos(c+Math.PI/6),u=r-f*Math.sin(c+Math.PI/6),y=o.dependency;react.useEffect(()=>{i&&s&&i(p?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[p,e,t,a,r,s,i]);let v=!s&&!i;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!v&&m(true),onMouseLeave:()=>!v&&m(false),style:{pointerEvents:v?"none":"auto"},children:[!v&&jsxRuntime.jsx("path",{d:g,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:g,fill:"none",stroke:y,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:p&&i?0:p?1:.8,strokeWidth:p?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${w} ${h} M ${a} ${r} L ${k} ${u}`,fill:"none",stroke:y,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:p&&i?0:p?1:.8,scale:p?1.1:1,strokeWidth:p?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:y,initial:{scale:0},animate:{scale:p&&i?0:p?1.3:1,opacity:p&&i?0:p?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),p&&s&&!i&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:D=>{D.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:n,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:n-4,y1:(t+r)/2-4,x2:n+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:n+4,y1:(t+r)/2-4,x2:n-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function kn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,i]=react.useState(false),p=16,m=d=>d.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:p+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-p/2,y:a+16-p/2,width:p,height:p,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-(p+4)/2,y:a+16-(p+4)/2,width:p+4,height:p+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var de={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=d=>{d.forEach(l=>{l.dependencies&&r.set(l.id,l.dependencies),l.subtasks&&o(l.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let i=new Set,p=new Set,m=d=>{if(!i.has(d)){i.add(d),p.add(d);let l=r.get(d)||[];for(let n of l){if(!i.has(n)&&m(n))return true;if(p.has(n))return true}}return p.delete(d),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=de.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=de.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=de.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=de.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=de.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=de.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)=>de.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=de.findTaskById(e,t);return !a||!a.dependencies?[]:de.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>de.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>de.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=de.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=>de.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=de.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 i=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],p=s.map(m=>{let d=m.startDate&&m.endDate?de.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?de.formatDate(m.startDate):"N/A",m.endDate?de.formatDate(m.endDate):"N/A",d>0?`${d} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:i,body:p,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=de.flattenTasks(e).map(m=>{let d=m.startDate&&m.endDate?de.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?de.formatDate(m.startDate):"","End Date":m.endDate?de.formatDate(m.endDate):"","Duration (days)":d>0?d:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(l=>l.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),s=a.utils.json_to_sheet(o),i=[{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"]=i;let p=a.utils.book_new();a.utils.book_append_sheet(p,s,"Gantt Tasks"),a.writeFile(p,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=de.flattenTasks(e),o=new Map;r.forEach((g,f)=>{o.set(g.id,f+1);});let s=g=>g.toISOString().replace("Z",""),i=de.getEarliestStartDate(e)||new Date,p=de.getLatestEndDate(e)||new Date,m=r.map((g,f)=>{let c=o.get(g.id),w=g.startDate&&g.endDate?de.calculateDuration(g.startDate,g.endDate):0,h=(g.dependencies||[]).filter(k=>o.has(k)).map(k=>`
113
113
  <PredecessorLink>
114
- <PredecessorUID>${o.get(w)}</PredecessorUID>
114
+ <PredecessorUID>${o.get(k)}</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>${f}</UID>
122
- <ID>${u+1}</ID>
123
- <Name>${i.name.replace(/[<>&'"]/g,w=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[w]||w)}</Name>
121
+ <UID>${c}</UID>
122
+ <ID>${f+1}</ID>
123
+ <Name>${g.name.replace(/[<>&'"]/g,k=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[k]||k)}</Name>
124
124
  <Type>0</Type>
125
125
  <IsNull>0</IsNull>
126
126
  <CreateDate>${s(new Date)}</CreateDate>
127
- <WBS>${u+1}</WBS>
128
- <OutlineNumber>${u+1}</OutlineNumber>
129
- <OutlineLevel>${i.level||0}</OutlineLevel>
127
+ <WBS>${f+1}</WBS>
128
+ <OutlineNumber>${f+1}</OutlineNumber>
129
+ <OutlineLevel>${g.level||0}</OutlineLevel>
130
130
  <Priority>500</Priority>
131
- <Start>${i.startDate?s(i.startDate):""}</Start>
132
- <Finish>${i.endDate?s(i.endDate):""}</Finish>
133
- <Duration>PT${h*8}H0M0S</Duration>
131
+ <Start>${g.startDate?s(g.startDate):""}</Start>
132
+ <Finish>${g.endDate?s(g.endDate):""}</Finish>
133
+ <Duration>PT${w*8}H0M0S</Duration>
134
134
  <DurationFormat>7</DurationFormat>
135
- <Work>PT${h*8}H0M0S</Work>
136
- <Stop>${i.endDate?s(i.endDate):""}</Stop>
137
- <Resume>${i.startDate?s(i.startDate):""}</Resume>
135
+ <Work>PT${w*8}H0M0S</Work>
136
+ <Stop>${g.endDate?s(g.endDate):""}</Stop>
137
+ <Resume>${g.startDate?s(g.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>${i.isMilestone?"1":"0"}</Milestone>
144
- <Summary>${i.subtasks&&i.subtasks.length>0?"1":"0"}</Summary>
145
- <Critical>${i.isCriticalPath?"1":"0"}</Critical>
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>
146
146
  <IsSubproject>0</IsSubproject>
147
147
  <IsSubprojectReadOnly>0</IsSubprojectReadOnly>
148
148
  <ExternalTask>0</ExternalTask>
149
- <EarlyStart>${i.startDate?s(i.startDate):""}</EarlyStart>
150
- <EarlyFinish>${i.endDate?s(i.endDate):""}</EarlyFinish>
151
- <LateStart>${i.startDate?s(i.startDate):""}</LateStart>
152
- <LateFinish>${i.endDate?s(i.endDate):""}</LateFinish>
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>
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>${i.progress}</PercentComplete>
161
- <PercentWorkComplete>${i.progress}</PercentWorkComplete>
160
+ <PercentComplete>${g.progress}</PercentComplete>
161
+ <PercentWorkComplete>${g.progress}</PercentWorkComplete>
162
162
  <Cost>0</Cost>
163
163
  <OvertimeCost>0</OvertimeCost>
164
164
  <OvertimeWork>PT0H0M0S</OvertimeWork>
165
- <ActualStart>${i.progress>0&&i.startDate?s(i.startDate):""}</ActualStart>
166
- <ActualFinish>${i.progress===100&&i.endDate?s(i.endDate):""}</ActualFinish>
167
- <ActualDuration>PT${Math.round(h*i.progress/100)*8}H0M0S</ActualDuration>
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(w*g.progress/100)*8}H0M0S</ActualDuration>
168
168
  <ActualCost>0</ActualCost>
169
169
  <ActualOvertimeCost>0</ActualOvertimeCost>
170
- <ActualWork>PT${Math.round(h*i.progress/100)*8}H0M0S</ActualWork>
170
+ <ActualWork>PT${Math.round(w*g.progress/100)*8}H0M0S</ActualWork>
171
171
  <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
172
- <RegularWork>PT${h*8}H0M0S</RegularWork>
173
- <RemainingDuration>PT${Math.round(h*(100-i.progress)/100)*8}H0M0S</RemainingDuration>
172
+ <RegularWork>PT${w*8}H0M0S</RegularWork>
173
+ <RemainingDuration>PT${Math.round(w*(100-g.progress)/100)*8}H0M0S</RemainingDuration>
174
174
  <RemainingCost>0</RemainingCost>
175
- <RemainingWork>PT${Math.round(h*(100-i.progress)/100)*8}H0M0S</RemainingWork>
175
+ <RemainingWork>PT${Math.round(w*(100-g.progress)/100)*8}H0M0S</RemainingWork>
176
176
  <RemainingOvertimeCost>0</RemainingOvertimeCost>
177
177
  <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
178
178
  <ACWP>0</ACWP>
@@ -191,16 +191,16 @@
191
191
  <PhysicalPercentComplete>0</PhysicalPercentComplete>
192
192
  <EarnedValueMethod>0</EarnedValueMethod>
193
193
  <IsPublished>1</IsPublished>
194
- <CommitmentType>0</CommitmentType>${g}
195
- </Task>`}).join(""),n=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
194
+ <CommitmentType>0</CommitmentType>${h}
195
+ </Task>`}).join(""),d=`<?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,i=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[i]||i)}</Name>
199
- <Title>${t.replace(/[<>&'"]/g,i=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[i]||i)}</Title>
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>
200
200
  <CreationDate>${s(new Date)}</CreationDate>
201
201
  <LastSaved>${s(new Date)}</LastSaved>
202
202
  <ScheduleFromStart>1</ScheduleFromStart>
203
- <StartDate>${s(l)}</StartDate>
203
+ <StartDate>${s(i)}</StartDate>
204
204
  <FinishDate>${s(p)}</FinishDate>
205
205
  <FYStartDate>1</FYStartDate>
206
206
  <CriticalSlackLimit>0</CriticalSlackLimit>
@@ -339,9 +339,9 @@
339
339
  </Calendars>
340
340
  <Tasks>${m}
341
341
  </Tasks>
342
- </Project>`,d=new Blob([n],{type:"application/xml;charset=utf-8;"}),c=document.createElement("a");c.href=URL.createObjectURL(d),c.download=a,c.click(),URL.revokeObjectURL(c.href);},calculateCriticalPath:e=>{let t=me.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let d=n.startDate&&n.endDate?me.calculateDuration(n.startDate,n.endDate):0,c=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let f=t.find(h=>h.id===u);if(f){o(f);let h=r.get(u)?.ef||0;c=Math.max(c,h);}}let i=c+d;r.set(n.id,{es:c,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),l=new Map,p=n=>{if(l.has(n.id))return;let d=n.startDate&&n.endDate?me.calculateDuration(n.startDate,n.endDate):0,c=t.filter(f=>f.dependencies&&f.dependencies.includes(n.id)),i=s;if(c.length>0)for(let f of c){p(f);let h=l.get(f.id)?.ls||0;i=Math.min(i,h);}let u=i-d;l.set(n.id,{ls:u,lf:i});};a.forEach(p);let m=[];for(let n of a){let d=r.get(n.id),c=l.get(n.id);if(d&&c){let i=c.ls-d.es;Math.abs(i)<.01&&m.push(n.id);}}return m},calculateSlack:(e,t)=>{let a=me.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(me.calculateCriticalPath(e).includes(t))return 0;let o=me.getDependentTasks(e,t);if(o.length===0){let p=me.getLatestEndDate(e);if(!p)return null;let m=me.calculateDuration(a.endDate,p);return Math.max(0,m)}let s=o.filter(p=>p.startDate).map(p=>p.startDate.getTime()).sort((p,m)=>p-m)[0];if(!s)return null;let l=me.calculateDuration(a.endDate,new Date(s));return Math.max(0,l)},isOnCriticalPath:(e,t)=>me.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=me.findTaskById(e,t);if(!r||!r.endDate)return e;let o=me.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let p=me.calculateDuration(l.startDate,l.endDate),m;a!==void 0?(m=new Date(l.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let n=me.calculateEndDate(m,p),d=c=>c.map(i=>i.id===l.id?{...i,startDate:m,endDate:n}:i.subtasks?{...i,subtasks:d(i.subtasks)}:i);s=d(s),s=me.autoScheduleDependents(s,l.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,l,p)=>{if(a===0)return [];let m=[],n=o.getTime(),d=1e3*60*60*24,c=me.findTaskById(e,t);if(!c||!c.endDate)return [];let i=(u,f,h=new Set)=>{if(h.has(u))return;h.add(u);let g=me.getDependentTasks(e,u);for(let w of g){if(!w.startDate||!w.endDate)continue;let b=r.findIndex(C=>C.id===w.id);if(b===-1)continue;let v=w.startDate.getTime(),T=(w.endDate.getTime()-v)/d,M=(v-n)/d*s,k=M+f*s,B=Math.max(T*s,s),N=p+b*l+12;m.push({taskId:w.id,taskName:w.name,originalX:M,previewX:k,width:B,y:N,rowIndex:b,daysDelta:f,color:w.color}),i(w.id,f,h);}};return i(t,a),m},splitTask:(e,t,a,r=3)=>{let o=me.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let l=new Date(a);l.setDate(l.getDate()+r);let p=new Date(o.endDate);p.setDate(p.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:l,endDate:p}],n=d=>d.map(c=>c.id===o.id?{...c,endDate:p,segments:m}:c.subtasks?{...c,subtasks:n(c.subtasks)}:c);return n(e)}};function Cn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:l,templates:p,onTaskClick:m,onTaskDblClick:n,onTaskContextMenu:d,onTaskDateChange:c,onDependencyCreate:i,onDependencyDelete:u}){let[h,g]=react.useState([]),[w,b]=react.useState(null),[v,x]=react.useState(null),T=react.useCallback(R=>{b(R);},[]),D=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),M=r==="day"?60:r==="week"?20:8,k=D*M*l,B=R=>{let A=new Date(Date.UTC(R.getFullYear(),R.getMonth(),R.getDate())),O=A.getUTCDay()||7;A.setUTCDate(A.getUTCDate()+4-O);let P=new Date(Date.UTC(A.getUTCFullYear(),0,1));return Math.ceil(((A.getTime()-P.getTime())/864e5+1)/7)},N=R=>{let A=R.getDay();return A===0||A===6},C=react.useCallback(R=>{let A=Math.round(R/(M*l)),O=new Date(o);return O.setDate(O.getDate()+A),O},[o,M,l]),H=react.useCallback((R,A)=>{if(A.startDate&&A.endDate)return;let O=R.currentTarget.ownerSVGElement;if(!O)return;let P=O.createSVGPoint();P.x=R.clientX,P.y=R.clientY;let X=P.matrixTransform(O.getScreenCTM()?.inverse()),Y=C(X.x),U=new Date(Y);U.setDate(U.getDate()+1),c?.(A,Y,U);},[C,c]),I=react.useMemo(()=>{let R=X=>X.map(Y=>{if(Y.subtasks&&Y.subtasks.length>0){let U=R(Y.subtasks),Se=U.filter(Te=>Te.startDate&&Te.endDate);if(Se.length>0){let Te=Se.map(Le=>Le.startDate.getTime()),He=Se.map(Le=>Le.endDate.getTime()),xe=new Date(Math.min(...Te)),at=new Date(Math.max(...He));return {...Y,subtasks:U,startDate:xe,endDate:at}}return {...Y,subtasks:U}}return Y}),A=(X,Y=[])=>{for(let U of X)Y.push(U),U.subtasks&&U.subtasks.length>0&&(U.isExpanded===void 0||U.isExpanded)&&A(U.subtasks,Y);return Y},O=R(e);return A(O)},[e]),K=react.useCallback(R=>{if(!R.startDate||!R.endDate)return {x:0,width:0};let A=R.startDate.getTime(),O=R.endDate.getTime(),P=o.getTime(),X=(A-P)/(1e3*60*60*24),Y=(O-A)/(1e3*60*60*24),U=X*M*l,Se=Math.max(M*l,40),Te=Math.max(Y*M*l,Se);return {x:U,width:Te}},[o,M,l]),j=react.useMemo(()=>I.filter(R=>R.startDate&&R.endDate).map(R=>{let{x:A,width:O}=K(R),X=I.findIndex(Y=>Y.id===R.id)*a+12;return {id:R.id,x:A,y:X,width:O,height:32}}),[I,K]),$=react.useCallback((R,A,O)=>{if(!O||A===0){g([]);return}let P=me.calculateCascadePreview(e,R,A,I,o,M*l,a,48);g(P);},[e,I,o,M,l,a,48]),Z=react.useMemo(()=>{let R=[],A=new Date(o);for(;A<=s;){let X=(A.getTime()-o.getTime())/864e5*M*l;if(r==="day")R.push({date:new Date(A),label:A.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:X}),A.setDate(A.getDate()+1);else if(r==="week"){let Y=B(A);R.push({date:new Date(A),label:`Week ${Y}`,x:X}),A.setDate(A.getDate()+7);}else R.push({date:new Date(A),label:A.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:X}),A.setMonth(A.getMonth()+1);}return R},[o,s,r,M,l]),ce=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*M*l,[o,M,l]),he=Math.max(I.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(k,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(k,1e3),height:48,fill:t.bgGrid}),Z.map((R,A)=>jsxRuntime.jsxs("g",{children:[A>0&&jsxRuntime.jsx("line",{x1:R.x,y1:0,x2:R.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:R.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:R.label})]},`header-${A}`)),ce>=0&&ce<=k&&jsxRuntime.jsx("circle",{cx:ce,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(k,1e3),height:he,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(k,1e3),height:he,fill:t.bgPrimary}),Z.map((R,A)=>{let O=Z[A+1]?.x||k,P=N(R.date);return jsxRuntime.jsxs("g",{children:[P&&jsxRuntime.jsx("rect",{x:R.x,y:0,width:O-R.x,height:I.length*a,fill:t.bgWeekend,opacity:1}),A>0&&jsxRuntime.jsx("line",{x1:R.x,y1:0,x2:R.x,y2:I.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},A)}),I.map((R,A)=>{let O=R.startDate&&R.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:A*a,width:k,height:a,fill:A%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${R.id}`),!O&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:A*a,width:k,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:P=>H(P,R),onMouseEnter:P=>{P.currentTarget.setAttribute("fill",t.accentLight),P.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:P=>{P.currentTarget.setAttribute("fill","transparent"),P.currentTarget.setAttribute("opacity","1");}},`clickable-${R.id}`),jsxRuntime.jsx("text",{x:ce>0?ce:100,y:A*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${R.id}`)]})]},`row-group-${R.id}`)}),I.map((R,A)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(O=>{let P=I.find(Se=>Se.id===O);if(!P||!P.startDate||!P.endDate)return null;let X=I.findIndex(Se=>Se.id===O),Y=K(P),U=K(R);return jsxRuntime.jsx(vn,{x1:Y.x+Y.width,y1:X*a+a/2,x2:U.x,y2:A*a+a/2,theme:t},`dep-${O}-${R.id}`)})),I.map((R,A)=>{if(!R.startDate||!R.endDate)return null;let{x:O,width:P}=K(R),X=A*a+12,Y=R.subtasks&&R.subtasks.length>0&&!R.isMilestone;return R.isMilestone?jsxRuntime.jsx(kn,{task:R,x:O+P/2,y:X+16,theme:t,onClick:m},R.id):Y?jsxRuntime.jsxs("g",{onClick:()=>m?.(R),onContextMenu:U=>{U.preventDefault(),U.stopPropagation(),d?.(R,U);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:O,y:X,width:P,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:O,y1:X,x2:O+P,y2:X,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:O,y1:X,x2:O,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:O+P,y1:X,x2:O+P,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:O,y1:X+32,x2:O+P,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),P>60&&jsxRuntime.jsx("text",{x:O+12,y:X+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:R.name})]},R.id):jsxRuntime.jsx(hn,{task:R,x:O,y:X,width:P,theme:t,dayWidth:M*l,startDate:o,templates:p,onClick:m,onDoubleClick:n,onContextMenu:d,onDateChange:c,onDependencyCreate:i,allTaskPositions:j,onDragMove:$,onHoverChange:T},R.id)}),I.map((R,A)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(O=>{let P=I.find(fe=>fe.id===O);if(!P||!P.startDate||!P.endDate)return null;let X=I.findIndex(fe=>fe.id===O),Y=K(P),U=K(R),Se=Y.x+Y.width,Te=X*a+a/2,He=U.x,xe=A*a+a/2,at=He-Se,Le=Se+at/2,et=fe=>{let Ne=1-fe,Ae=Ne*Ne,rt=Ae*Ne,ft=fe*fe,Re=ft*fe,L=rt*Se+3*Ae*fe*Le+3*Ne*ft*Le+Re*He,Q=rt*Te+3*Ae*fe*Te+3*Ne*ft*xe+Re*xe;return {x:L,y:Q}},vt=20,Pt=[];for(let fe=0;fe<=vt;fe++){let Ne=.1+fe/vt*.8;Pt.push(et(Ne));}let ct=Pt[0],z=`M ${ct.x} ${ct.y} `+Pt.slice(1).map(fe=>`L ${fe.x} ${fe.y}`).join(" ");return v&&v.x1===Se&&v.y1===Te&&v.x2===He&&v.y2===xe?null:jsxRuntime.jsx("path",{d:z,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{x({x1:Se,y1:Te,x2:He,y2:xe,onDelete:()=>u?.(R.id,O)});}},`dep-hover-${O}-${R.id}`)})),h.map(R=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:R.previewX,y:R.y-48,width:R.width,height:32,rx:8,fill:R.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(R.daysDelta)>0&&jsxRuntime.jsx("text",{x:R.previewX+R.width/2,y:R.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:R.daysDelta>0?`+${R.daysDelta}d`:`${R.daysDelta}d`})]},`cascade-preview-${R.taskId}`)),v&&(()=>{let{x1:R,y1:A,x2:O,y2:P,onDelete:X}=v,Y=O-R,U=P-A,Se=R+Y/2,Te=(A+P)/2,He=`M ${R} ${A} C ${Se} ${A}, ${Se} ${P}, ${O} ${P}`,xe=6,at=Math.atan2(U,Y),Le=O-xe*Math.cos(at-Math.PI/6),et=P-xe*Math.sin(at-Math.PI/6),vt=O-xe*Math.cos(at+Math.PI/6),Pt=P-xe*Math.sin(at+Math.PI/6),ct=t.dependency,z="#f87171";return jsxRuntime.jsxs("g",{onMouseLeave:()=>x(null),children:[jsxRuntime.jsx("path",{d:He,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:Se,cy:Te,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:He,fill:"none",stroke:ct,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:He,fill:"none",stroke:ct,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${O} ${P} L ${Le} ${et} M ${O} ${P} L ${vt} ${Pt}`,fill:"none",stroke:ct,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:O,cy:P,r:4,fill:ct,opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:fe=>{fe.stopPropagation(),x(null),X();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:Se,cy:Te,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:z,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsxRuntime.jsx("line",{x1:Se-3,y1:Te-3,x2:Se+3,y2:Te+3,stroke:z,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Se+3,y1:Te-3,x2:Se-3,y2:Te+3,stroke:z,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),ce>=0&&ce<=k&&jsxRuntime.jsx("line",{x1:ce,y1:0,x2:ce,y2:he,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),w&&jsxRuntime.jsx(tc,{tooltipData:w,theme:t})]})]})}var Tn=[{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"}];var ci=[{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 Dn({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:l=false,mode:p=a?"edit":"create",theme:m="dark",customStatuses:n=[],availableTags:d=[],onCreateTag:c,attachments:i=[],onUploadAttachments:u,onDeleteAttachment:f}){let h=[...ci,...n.filter(z=>!ci.some(se=>se.id===z.id))],g=je[m]||je.dark,[w,b]=react.useState(false),[v,x]=react.useState(false),[T,D]=react.useState(false),[M,k]=react.useState(false),[B,N]=react.useState({top:0,left:0}),[C,H]=react.useState(null),[I,K]=react.useState(new Date),[j,$]=react.useState({top:0,left:0}),[Z,ce]=react.useState(false),[he,R]=react.useState([]),A=react.useRef(null),O=react.useRef(null),P=react.useRef(null),X=react.useRef(null),Y=react.useRef(null),[U,Se]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Te,He]=react.useState({});react.useEffect(()=>{a?(Se({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)):(Se({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),ce(false),R([]));},[a,e]),react.useEffect(()=>{let z=se=>{A.current&&!A.current.contains(se.target)&&b(false),O.current&&!O.current.contains(se.target)&&x(false),P.current&&!P.current.contains(se.target)&&D(false),X.current&&!X.current.contains(se.target)&&k(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let xe=()=>{let z={};return U.name.trim()||(z.name="El nombre es requerido"),U.startDate&&U.endDate&&U.startDate>U.endDate&&(z.endDate="La fecha de fin debe ser posterior a la de inicio"),He(z),Object.keys(z).length===0},at=async z=>{if(z.preventDefault(),!!xe())try{let se=p==="create"&&he.length>0?{...U,pendingFiles:he}:U;await s(se),R([]),t();}catch(se){console.error("Error submitting task:",se);}},Le=(z,se)=>{Se(fe=>{let Ne={...fe,[z]:se};if(z==="status"){let Ae=se;Ae==="todo"?Ne.progress=0:Ae==="in-progress"?(fe.progress===0||fe.progress===100)&&(Ne.progress=50):Ae==="completed"||Ae==="closed"?Ne.progress=100:(Ae==="in-review"||Ae==="review")&&(Ne.progress=75);}if(z==="progress"){let Ae=typeof se=="number"?se:parseInt(se,10);Ae===100&&fe.status!=="completed"?Ne.status="completed":Ae>0&&Ae<100&&fe.status==="todo"?Ne.status="in-progress":Ae===0&&fe.status!=="todo"&&(Ne.status="todo");}return Ne}),Te[z]&&He(fe=>{let Ne={...fe};return delete Ne[z],Ne});},et=h.find(z=>z.id===U.status)??ci[0],vt=pi.find(z=>z.id===U.priority)??pi[1],Pt=Tn.find(z=>z.value===U.color)??Tn[0],ct={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:z=>z.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:et.color||g.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:p==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:z=>{z.currentTarget.style.backgroundColor=g.hoverBg,z.currentTarget.style.color=g.textPrimary;},onMouseLeave:z=>{z.currentTarget.style.backgroundColor="transparent",z.currentTarget.style.color=g.textTertiary;},disabled:l,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:at,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:U.name,onChange:z=>Le("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:g.textPrimary},placeholder:"Nombre de la tarea",disabled:l,autoFocus:true}),Te.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),Te.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:U.description||"",onChange:z=>Le("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:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:l})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.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:()=>!l&&b(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ct,borderColor:et.color,backgroundColor:`${et.color}15`},disabled:l,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:et.color}}),jsxRuntime.jsx("span",{style:{color:et.color},children:et.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:et.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:h.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:g.textPrimary},onMouseEnter:se=>se.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{Le("status",z.id),b(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:z.color}}),z.title,U.status===z.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},z.id))})})]}),jsxRuntime.jsxs("div",{ref:O,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&x(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ct,disabled:l,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:vt.color}}),jsxRuntime.jsx("span",{children:vt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&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:g.bgPrimary,border:`1px solid ${g.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:g.textPrimary},onMouseEnter:se=>se.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{Le("priority",z.id),x(false);},children:[jsxRuntime.jsx("span",{children:z.icon}),z.label,U.priority===z.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},z.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:P,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&D(!T),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ct,disabled:l,children:[U.assignees&&U.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:U.assignees.slice(0,3).map((z,se)=>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||g.accent,borderColor:g.bgSecondary},children:z.initials},se))}),U.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:g.textTertiary},children:["+",U.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&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:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(z=>{let se=U.assignees?.some(fe=>fe.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:g.textPrimary},onMouseEnter:fe=>fe.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:fe=>fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let fe=se?(U.assignees||[]).filter(Ne=>Ne.name!==z.name):[...U.assignees||[],{name:z.name,avatar:z.avatar,initials:z.name.split(" ").map(Ne=>Ne[0]).join("").toUpperCase().slice(0,2),color:g.accent}];Le("assignees",fe);},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:g.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:se&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},z.id)})})})]}),jsxRuntime.jsxs("div",{ref:X,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!l)if(M)k(false);else {if(X.current){let z=X.current.getBoundingClientRect(),se=window.innerHeight,fe=120,Ae=se-z.bottom<fe?z.top-fe-8:z.bottom+8;N({top:Ae,left:z.left});}k(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ct,disabled:l,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:U.color}}),jsxRuntime.jsx("span",{children:Pt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&jsxRuntime.jsxs(nt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>k(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${B.top}px`,left:`${B.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.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:Tn.slice(0,18).map(z=>{let se=U.color===z.value;return jsxRuntime.jsx("button",{type:"button",onClick:fe=>{fe.preventDefault(),fe.stopPropagation(),Le("color",z.value),k(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:z.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:z.value,outline:se?`2px solid ${z.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},z.value)})})})})]})})]}),d.length>0||c?jsxRuntime.jsx(sr,{selectedTags:U.tags||[],availableTags:d,onChange:z=>Le("tags",z),onCreateTag:c,theme:g,disabled:l}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{ref:Y,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!l&&!U.isMilestone)if(C==="start")H(null);else {if(Y.current){let z=Y.current.getBoundingClientRect(),se=window.innerHeight,fe=320,Ae=se-z.bottom<fe?z.top-fe-8:z.bottom+8;$({top:Ae,left:z.left});}H("start"),K(U.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ct,opacity:U.isMilestone?.5:1,cursor:U.isMilestone?"not-allowed":"pointer"},disabled:l||U.isMilestone,children:U.startDate?U.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!l&&!U.isMilestone)if(C==="end")H(null);else {if(Y.current){let z=Y.current.getBoundingClientRect(),se=window.innerHeight,fe=320,Ae=se-z.bottom<fe?z.top-fe-8:z.bottom+8;$({top:Ae,left:z.left});}H("end"),K(U.endDate||U.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ct,opacity:U.isMilestone?.5:1,cursor:U.isMilestone?"not-allowed":"pointer"},disabled:l||U.isMilestone,children:U.endDate?U.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(nt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>H(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${j.top}px`,left:`${j.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:z=>z.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let z=new Date,se=new Date(z);se.setDate(z.getDate()+1);let fe=new Date(z);fe.setDate(z.getDate()+7);let Ne=new Date(z);return Ne.setDate(z.getDate()+14),[{label:"Hoy",date:z},{label:"Ma\xF1ana",date:se},{label:"Pr\xF3xima semana",date:fe},{label:"2 semanas",date:Ne}].map((rt,ft)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:Re=>Re.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Re=>Re.currentTarget.style.backgroundColor="transparent",onClick:()=>{C==="start"?(Le("startDate",rt.date),(!U.endDate||rt.date>U.endDate)&&Le("endDate",rt.date),H("end")):(Le("endDate",rt.date),(!U.startDate||rt.date<U.startDate)&&Le("startDate",rt.date),H(null));},children:rt.label},ft))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.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=g.hoverBg,onMouseLeave:z=>z.currentTarget.style.backgroundColor="transparent",onClick:()=>{Le("startDate",void 0),Le("endDate",void 0),H(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>K(new Date(I.getFullYear(),I.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:I.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>K(new Date(I.getFullYear(),I.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((z,se)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:z},se))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let z=I.getFullYear(),se=I.getMonth(),fe=new Date(z,se,1).getDay(),Ne=new Date(z,se+1,0).getDate(),Ae=new Date,rt=[];for(let Re=fe-1;Re>=0;Re--)rt.push({day:new Date(z,se,-Re).getDate(),date:new Date(z,se-1,new Date(z,se,-Re).getDate()),isCurrentMonth:false});for(let Re=1;Re<=Ne;Re++)rt.push({day:Re,date:new Date(z,se,Re),isCurrentMonth:true});let ft=42-rt.length;for(let Re=1;Re<=ft;Re++)rt.push({day:Re,date:new Date(z,se+1,Re),isCurrentMonth:false});return rt.map((Re,L)=>{let Q=Re.date.toDateString()===Ae.toDateString(),_e=U.startDate?.toDateString()===Re.date.toDateString(),Ge=U.endDate?.toDateString()===Re.date.toDateString(),kt=U.startDate&&U.endDate&&Re.date>=U.startDate&&Re.date<=U.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Re.isCurrentMonth?_e||Ge?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:_e?"#3B82F6":Ge?"#7C3AED":kt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Q&&!_e&&!Ge?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{C==="start"?(Le("startDate",Re.date),U.endDate&&Re.date>U.endDate&&Le("endDate",Re.date),H("end")):(Le("endDate",Re.date),U.startDate&&Re.date<U.startDate&&Le("startDate",Re.date),H(null));},children:Re.day},L)})})()})]})]})]})})]}),Te.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Te.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:U.progress,onChange:z=>Le("progress",parseInt(z.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:U.progress<30?"#EF4444":U.progress<70?"#F59E0B":"#10B981"},disabled:l}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${U.progress<30?"#EF4444":U.progress<70?"#F59E0B":"#10B981"}20`,color:U.progress<30?"#EF4444":U.progress<70?"#F59E0B":"#10B981"},children:[U.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>ce(!Z),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${Z?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Z&&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:[(u||i.length>0||p==="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:g.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:g.textTertiary},children:["Adjuntos ",p==="create"?he.length>0&&`(${he.length})`:i.length>0&&`(${i.length})`]})]}),p==="create"?jsxRuntime.jsx(Wa,{cardId:"pending",attachments:he.map((z,se)=>({id:`pending-${se}`,cardId:"pending",name:z.name,size:z.size,type:z.type,url:URL.createObjectURL(z),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:z=>R(se=>[...se,...z]),onDelete:z=>{let se=parseInt(z.replace("pending-",""),10);R(fe=>fe.filter((Ne,Ae)=>Ae!==se));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Wa,{cardId:a?.id||"new",attachments:i,onUpload:u&&a?.id?z=>u(a.id,z):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),p==="create"&&he.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[he.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:U.isMilestone,onChange:z=>Le("isMilestone",z.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:l}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:g.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:g.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:g.bgSecondary},children:r.filter(z=>z.id!==a?.id).map(z=>{let se=U.dependencies?.includes(z.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let fe=se?(U.dependencies||[]).filter(Ne=>Ne!==z.id):[...U.dependencies||[],z.id];Le("dependencies",fe);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:se?`${g.accent}30`:g.bgPrimary,color:se?g.accent:g.textSecondary,border:`1px solid ${se?g.accent:g.borderLight}`},disabled:l,children:z.name},z.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:z=>z.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:z=>z.currentTarget.style.backgroundColor="transparent",disabled:l,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:l,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:z=>!l&&(z.currentTarget.style.opacity="0.9"),onMouseLeave:z=>!l&&(z.currentTarget.style.opacity="1"),children:l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:p==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var a0=['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"'],sc=()=>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"})]}),r0=()=>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"})}),o0=()=>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"})}),n0=()=>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"})}),s0=()=>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 Nn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:l,onDependencyCreate:p,onDependencyDelete:m}){let[n,d]=react.useState(false),[c,i]=react.useState(false),[u,f]=react.useState([]),[h,g]=react.useState(""),[w,b]=react.useState(false),[v,x]=react.useState(true),T=react.useRef(null),D=react.useRef(null),M=react.useRef(null),{enabled:k=true,placeholder:B='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:N="bottom-right",onCommand:C,suggestions:H=a0,maxHistory:I=50,persistHistory:K}=a,j=K?.storageKey||"gantt-ai-history",$=K?.maxMessages??5;react.useEffect(()=>{if(K?.enabled)try{let O=localStorage.getItem(j);if(O){let X=JSON.parse(O).map(Y=>({...Y,timestamp:new Date(Y.timestamp)}));f(X.slice(-$));}}catch(O){console.warn("[GanttAIAssistant] Failed to load persisted history:",O);}},[K?.enabled,j,$]),react.useEffect(()=>{if(K?.enabled&&u.length>0)try{let O=u.filter(P=>!P.isLoading).slice(-$);localStorage.setItem(j,JSON.stringify(O));}catch(O){console.warn("[GanttAIAssistant] Failed to persist history:",O);}},[u,K?.enabled,j,$]),react.useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!c&&T.current&&setTimeout(()=>T.current?.focus(),100);},[n,c]);let Z=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&&l?.(O.taskId);break;case "link_tasks":O.dependencyFrom&&O.dependencyTo&&p?.(O.dependencyFrom,O.dependencyTo);break;case "unlink_tasks":O.taskId&&O.dependencyFrom&&m?.(O.taskId,O.dependencyFrom);break}},[o,s,l,p,m]),ce=react.useCallback(async O=>{if(!O.trim()||w)return;let P={id:`user-${Date.now()}`,role:"user",content:O,timestamp:new Date};f(Y=>[...Y.slice(-(I-1)),P]),g(""),x(false),b(true);let X={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(Y=>[...Y,X]);try{if(C){let Y=await C(O,e);f(U=>{let Se=U.filter(He=>!He.isLoading),Te={id:`assistant-${Date.now()}`,role:"assistant",content:Y.message,timestamp:new Date,command:Y};return [...Se,Te]}),Z(Y);}else f(Y=>[...Y.filter(Se=>!Se.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(Y){f(U=>[...U.filter(Te=>!Te.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${Y instanceof Error?Y.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[w,I,C,e,Z]),he=O=>{O.preventDefault(),ce(h);},R=O=>{g(O),T.current?.focus();};if(react.useEffect(()=>{let O=P=>{(P.metaKey||P.ctrlKey)&&P.key==="k"&&(P.preventDefault(),d(X=>!X),n||i(false)),P.key==="Escape"&&n&&d(false);};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[n]),react.useEffect(()=>{if(!n)return;let O=X=>{let Y=X.target;M.current&&!M.current.contains(Y)&&d(false);},P=setTimeout(()=>{document.addEventListener("mousedown",O);},100);return ()=>{clearTimeout(P),document.removeEventListener("mousedown",O);}},[n]),!k)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(nt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${A[N]} 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:()=>d(true),children:[jsxRuntime.jsx(sc,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:M,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:c?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${A[N]} 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(sc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>i(O=>!O),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(n0,{})}),jsxRuntime.jsx("button",{onClick:()=>d(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(o0,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!c&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[u.length===0&&v&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:H.slice(0,4).map((O,P)=>jsxRuntime.jsx("button",{onClick:()=>R(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},P))})]}),u.map(O=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${O.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${O.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:O.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:O.role==="user"?"white":t.textPrimary},children:[O.isLoading?jsxRuntime.jsx(s0,{}):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:D})]}),jsxRuntime.jsxs("form",{onSubmit:he,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:T,type:"text",value:h,onChange:O=>g(O.target.value),placeholder:B,disabled:w,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!h.trim()||w,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:h.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:h.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(r0,{})})]}),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((n,d=true)=>{r(c=>{let i=typeof n=="function"?n(c.present):n;if(o.current)return {...c,present:i};if(!d)return {...c,present:i};let u=[...c.past,c.present];return u.length>t&&u.shift(),{past:u,present:i,future:[]}});},[t]),l=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let d=n.past[n.past.length-1],c=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:c,present:d,future:[n.present,...n.future]}});},[]),p=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let d=n.future[0],c=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:d,future:c}});},[]),m=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:l,redo:p,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function lc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=l=>{let p=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=p?l.metaKey:l.ctrlKey;if(m&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!p&&m&&l.key==="y"){l.preventDefault(),t();return}if(p&&m&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var c0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${me.formatDate(e.startDate)} - ${me.formatDate(e.endDate)}`);let a=me.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>me.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function dc(e){return {...c0,...e}}var b0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},mc=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:l="week",rowDensity:p="comfortable",showThemeSelector:m=true,showExportButton:n=true,availableUsers:d=[],templates:c,enableAutoCriticalPath:i=true,persistExpandedState:u,aiAssistant:f,locale:h="en",customTranslations:g,showCreateTaskButton:w=false,createTaskLabel:b,onCreateTask:v,onThemeChange:x,onTaskClick:T,onTaskDblClick:D,onTaskContextMenu:M,onTaskUpdate:k,onProgressChange:B,onTaskEdit:N,onTaskAddSubtask:C,onTaskMarkIncomplete:H,onTaskSetInProgress:I,onDependencyCreate:K,onDependencyDelete:j,onBeforeTaskAdd:$,onAfterTaskAdd:Z,onBeforeTaskUpdate:ce,onAfterTaskUpdate:he,onBeforeTaskDelete:R,onAfterTaskDelete:A}=a,P=react.useContext(dn)?.theme,[X,Y]=react.useState(P||s||"dark"),[U,Se]=react.useState(l),[Te,He]=react.useState(p),[xe,at]=react.useState(1),[Le,et]=react.useState(0),[vt,Pt]=react.useState(false),[ct,z]=react.useState(null),[se,fe]=react.useState({isOpen:false,x:0,y:0,task:null}),[Ne,Ae]=react.useState(null),[rt,ft]=react.useState(null);react.useEffect(()=>{P&&P!==X&&Y(P);},[P]),react.useEffect(()=>{s&&s!==X&&Y(s);},[s]);let Re=react.useCallback(S=>{Y(S),x?.(S);},[x]),{state:L,setState:Q,undo:_e,redo:Ge,canUndo:kt,canRedo:ae,clearHistory:ie}=ic(t,50),we=react.useCallback(()=>u?typeof u=="string"?u:"gantt-expanded-tasks":null,[u]),De=react.useRef(new Map),le=react.useRef(false);if(!le.current&&u){le.current=true;let S=typeof u=="string"?u:"gantt-expanded-tasks";try{let E=localStorage.getItem(S);if(E){let G=JSON.parse(E);Array.isArray(G)&&(De.current=new Map(G));}}catch(E){console.warn("[GanttBoard] Error loading expanded state from localStorage:",E);}}let Pe=react.useCallback(()=>{let S=we();if(S)try{let E=Array.from(De.current.entries());localStorage.setItem(S,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving expanded state to localStorage:",E);}},[we]);react.useEffect(()=>{let S=E=>E.map(G=>{let re=De.current.get(G.id),ge=re!==void 0?{...G,isExpanded:re}:G;return ge.subtasks?.length?{...ge,subtasks:S(ge.subtasks)}:ge});De.current.size>0?Q(S(t)):Q(t);},[t,Q]);let ke=react.useRef(t),Ee=react.useRef(true);react.useEffect(()=>{if(Ee.current){Ee.current=false,ke.current=L;return}if(!r)return;let S=JSON.stringify(ke.current),E=JSON.stringify(L);S!==E&&(ke.current=L,r(L));},[L,r]);let pe=react.useMemo(()=>Ys(h,g),[h,g]),ze=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}],[]),[Be,Ye]=react.useState(()=>ze(pe));react.useEffect(()=>{Ye(S=>S.map(E=>({...E,label:pe.columns[E.id==="name"?"taskName":E.id]||E.label})));},[pe]);let ht=react.useMemo(()=>Be.filter(E=>E.visible).reduce((E,G)=>E+G.width,0),[Be]),Kt=react.useRef(Be.filter(S=>S.visible).map(S=>S.id).join(","));react.useEffect(()=>{let S=Be.filter(re=>re.visible),E=S.map(re=>re.id).join(","),G=Kt.current;if(E!==G){let re=S.some(Ce=>Ce.id!=="name"),ge=G.includes(",");re?!ge&&re&&z(null):z(null),Kt.current=E;}},[Be]);let q=60,te=.6,Me=react.useMemo(()=>{let E=ht+q,G=typeof window<"u"?window.innerWidth*te:800,re=Math.max(E,G);return ct!==null?Math.max(200,Math.min(ct,re)):Math.max(200,E)},[ct,ht]),Ve=react.useRef(null),$e=react.useRef(null),W=react.useRef(null),J=react.useMemo(()=>Sd(X),[X]),Ie=react.useMemo(()=>({theme:J,themeName:X}),[J,X]),wt=react.useMemo(()=>dc(c),[c]),ot=react.useMemo(()=>{if(!i)return L;let S=me.calculateCriticalPath(L),E=G=>G.map(re=>({...re,isCriticalPath:S.includes(re.id),subtasks:re.subtasks?E(re.subtasks):void 0}));return E(L)},[L,i]),_a=b0(Te);lc({undo:_e,redo:Ge,canUndo:kt,canRedo:ae,enabled:true}),react.useImperativeHandle(o,()=>({getTask:S=>me.findTaskById(L,S),addTask:(S,E)=>{Q(G=>{if(!E)return [...G,{...S,level:0}];let re=ge=>ge.map(Ce=>Ce.id===E?{...Ce,subtasks:[...Ce.subtasks||[],{...S,parentId:E,level:(Ce.level||0)+1}],isExpanded:true}:Ce.subtasks?{...Ce,subtasks:re(Ce.subtasks)}:Ce);return re(G)});},updateTask:(S,E)=>{Q(G=>{let re=ge=>ge.map(Ce=>Ce.id===S?{...Ce,...E}:Ce.subtasks?{...Ce,subtasks:re(Ce.subtasks)}:Ce);return re(G)});},deleteTask:S=>{Q(E=>{let G=re=>re.filter(ge=>ge.id===S?false:(ge.subtasks&&(ge.subtasks=G(ge.subtasks)),true));return G(E)});},deleteTasks:S=>{Q(E=>ti(E,S));},duplicateTask:S=>{Q(E=>ai(E,[S]));},splitTask:(S,E,G=3)=>{Q(re=>me.splitTask(re,S,E,G));},calculateEndDate:me.calculateEndDate,calculateDuration:me.calculateDuration,validateDependency:(S,E)=>!me.validateDependencies(L,S,E),getAllTasks:()=>me.flattenTasks(L),getTasksByStatus:S=>me.flattenTasks(L).filter(E=>E.status===S),getTasksByParent:S=>S?me.findTaskById(L,S)?.subtasks||[]:L.filter(G=>!G.parentId),getCriticalPath:()=>me.flattenTasks(L).filter(S=>S.isCriticalPath),indentTask:S=>{Q(E=>Zs(E,[S]));},outdentTask:S=>{Q(E=>Qs(E,[S]));},moveTask:(S,E)=>{Q(G=>ei(G,[S],E));},createSubtask:async S=>{let{tasks:E,newTask:G}=ni(L,S);if($){let re=$({...G,parentId:S});if((re instanceof Promise?await re:re)===false)return}Q(E),Z&&Z({...G,parentId:S});},scrollToTask:S=>{let G=me.flattenTasks(L).findIndex(re=>re.id===S);if(G!==-1&&Ve.current){let re=G*_a;Ve.current.scrollTo({top:re,behavior:"smooth"}),$e.current&&$e.current.scrollTo({top:re,behavior:"smooth"});}},highlightTask:(S,E=2e3)=>{},expandTask:S=>{Q(E=>{let G=re=>re.map(ge=>ge.id===S?{...ge,isExpanded:true}:ge.subtasks?{...ge,subtasks:G(ge.subtasks)}:ge);return G(E)});},collapseTask:S=>{Q(E=>{let G=re=>re.map(ge=>ge.id===S?{...ge,isExpanded:false}:ge.subtasks?{...ge,subtasks:G(ge.subtasks)}:ge);return G(E)});},expandAll:()=>{Q(S=>{let E=G=>G.map(re=>({...re,isExpanded:true,subtasks:re.subtasks?E(re.subtasks):void 0}));return E(S)});},collapseAll:()=>{Q(S=>{let E=G=>G.map(re=>({...re,isExpanded:false,subtasks:re.subtasks?E(re.subtasks):void 0}));return E(S)});},undo:_e,redo:Ge,canUndo:()=>kt,canRedo:()=>ae,clearHistory:ie,exportToPNG:async()=>{if(!W.current||!Ve.current||!$e.current)throw new Error("Gantt container not found");let S=W.current,E=Ve.current.querySelector(".gantt-grid-scroll"),G=$e.current,re=E?.scrollTop||0,ge=G.scrollTop,Ce=S.style.overflow,pt=S.style.height;try{let Wt=E?.querySelector(".gantt-taskgrid-content"),oa=G.querySelector("svg"),na=Wt?.scrollHeight||E?.scrollHeight||600,ga=oa?.getBoundingClientRect().height||G.scrollHeight,vr=(S.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(na,ga)+20;E&&(E.scrollTop=0),G.scrollTop=0,S.style.overflow="visible",S.style.height=`${vr}px`,await new Promise(ar=>setTimeout(ar,100));let tr=await pc__default.default(S,{backgroundColor:J.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:ar=>{let Wr=window.getComputedStyle(ar),xr=parseInt(Wr.zIndex,10);return !isNaN(xr)&&xr>=50||Wr.position==="fixed"}});return new Promise((ar,Wr)=>{tr.toBlob(xr=>{xr?ar(xr):Wr(new Error("Failed to create blob from canvas"));},"image/png");})}finally{S.style.overflow=Ce,S.style.height=pt,E&&(E.scrollTop=re),G.scrollTop=ge;}},exportToPDF:async S=>{await me.exportToPDF(L,S);},exportToExcel:async S=>{await me.exportToExcel(L,S);},exportToJSON:()=>me.exportToJSON(L),exportToCSV:()=>me.exportToCSV(L),importFromJSON:S=>{let E=me.importFromJSON(S);Q(E);},getTasks:()=>L,refresh:()=>{Q(S=>[...S]);},clearAll:()=>{Q([]);}}),[L,_e,Ge,kt,ae,ie,J,_a]);let br=react.useCallback(S=>{Ye(E=>E.map(G=>G.id===S?{...G,visible:!G.visible}:G));},[]),Za=react.useCallback((S,E)=>{Ye(G=>G.map(re=>{if(re.id!==S)return re;let ge=re.minWidth??100,Ce=re.maxWidth??800,pt=Math.max(ge,Math.min(Ce,E));return {...re,width:pt}}));},[]),po=react.useCallback(S=>{Q(E=>{let G=oi(E,S),re=ge=>{for(let Ce of ge){if(Ce.id===S){De.current.set(S,Ce.isExpanded??true);return}Ce.subtasks?.length&&re(Ce.subtasks);}};return re(G),Pe(),G}),a.onTaskToggleExpand?.(S);},[a,Pe]),ue=react.useCallback((S,E)=>{if(ce&&ce(S,E)===false)return;let re=me.findTaskById(L,S)?.progress,ge=pt=>pt.map(Wt=>Wt.id===S?{...Wt,...E}:Wt.subtasks?{...Wt,subtasks:ge(Wt.subtasks)}:Wt);Q(ge(L));let Ce=me.findTaskById(ge(L),S);Ce&&(k?.(Ce),he?.(Ce),E.progress!==void 0&&re!==void 0&&E.progress!==re&&B?.(S,re,E.progress));},[L,k,ce,he,B]),Mt=react.useCallback(S=>{S.length!==0&&(Q(E=>Zs(E,S)),a.onTaskIndent?.(S[0]));},[a]),ea=react.useCallback(S=>{S.length!==0&&(Q(E=>Qs(E,S)),a.onTaskOutdent?.(S[0]));},[a]),$r=react.useCallback((S,E,G)=>{Q(re=>Kd(re,S,E,G)),a.onTaskReparent?.(S,E,G);},[a]),Wo=react.useCallback((S,E)=>{S.length!==0&&(Q(G=>ei(G,S,E)),a.onTaskMove?.(S[0],E));},[a]),Qa=react.useCallback(async S=>{let E=[];for(let G of S)R&&await Promise.resolve(R(G))===false||E.push(G);E.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(E):(Q(G=>ti(G,E)),E.forEach(G=>a.onTaskDelete?.(G))),A&&E.forEach(G=>A(G)));},[a,R,A]),Va=react.useCallback(S=>{Q(E=>ai(E,S)),S.forEach(E=>a.onTaskDuplicate?.(E));},[a]),yr=react.useCallback((S,E)=>{Q(G=>{let{tasks:re,newTask:ge}=jd(G,S,E);return $&&$(ge)===false?G:(a.onTaskCreate?.(ge.parentId,ge.position||0),Z?.(ge),re)});},[a,$,Z]),$t=react.useCallback((S,E)=>{Q(G=>ri(G,S,E)),a.onTaskRename?.(S,E);},[a]),mo=react.useCallback(S=>{Q(E=>{let{tasks:G}=ni(E,S);return a.onTaskCreate?.(S,0),G});},[a]),jn=react.useCallback((S,E,G)=>{let re=S.startDate?Math.round((E.getTime()-S.startDate.getTime())/864e5):0,ge=Wt=>Wt.map(oa=>oa.id===S.id?{...oa,startDate:E,endDate:G,...S.segments&&{segments:S.segments}}:oa.subtasks?{...oa,subtasks:ge(oa.subtasks)}:oa),Ce=ge(L);Ce=me.autoScheduleDependents(Ce,S.id,re),Q(Ce);let pt={...S,startDate:E,endDate:G};k?.(pt);},[L,k]),sl=react.useCallback((S,E)=>{M?.(S,E),fe({isOpen:true,x:E.clientX,y:E.clientY,task:S});},[M]),uo=react.useCallback((S,E)=>{let G=me.splitTask(L,S.id,E);Q(G),fe({isOpen:false,x:0,y:0,task:null});},[L]),il=react.useCallback(S=>{let E=me.findTaskById(L,S.id)||S;D?.(E),N||Ae(E);},[L,D,N]),ll=react.useCallback((S,E,G)=>{let re=new Map,ge=na=>{na.forEach(ga=>{ga.dependencies&&re.set(ga.id,ga.dependencies),ga.subtasks&&ge(ga.subtasks);});};ge(G);let Ce=re.get(E)||[];re.set(E,[...Ce,S]);let pt=new Set,Wt=new Set,oa=na=>{if(!pt.has(na)){pt.add(na),Wt.add(na);let ga=re.get(na)||[];for(let er of ga){if(!pt.has(er)&&oa(er))return true;if(Wt.has(er))return true}}return Wt.delete(na),false};return oa(E)},[]),dl=react.useCallback((S,E)=>{if(ll(S.id,E,L)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
342
+ </Project>`,l=new Blob([d],{type:"application/xml;charset=utf-8;"}),n=document.createElement("a");n.href=URL.createObjectURL(l),n.download=a,n.click(),URL.revokeObjectURL(n.href);},calculateCriticalPath:e=>{let t=de.flattenTasks(e),a=t.filter(d=>d.startDate&&d.endDate);if(a.length===0)return [];let r=new Map,o=d=>{if(r.has(d.id))return;let l=d.startDate&&d.endDate?de.calculateDuration(d.startDate,d.endDate):0,n=0;if(d.dependencies&&d.dependencies.length>0)for(let f of d.dependencies){let c=t.find(w=>w.id===f);if(c){o(c);let w=r.get(f)?.ef||0;n=Math.max(n,w);}}let g=n+l;r.set(d.id,{es:n,ef:g});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(d=>d.ef)),i=new Map,p=d=>{if(i.has(d.id))return;let l=d.startDate&&d.endDate?de.calculateDuration(d.startDate,d.endDate):0,n=t.filter(c=>c.dependencies&&c.dependencies.includes(d.id)),g=s;if(n.length>0)for(let c of n){p(c);let w=i.get(c.id)?.ls||0;g=Math.min(g,w);}let f=g-l;i.set(d.id,{ls:f,lf:g});};a.forEach(p);let m=[];for(let d of a){let l=r.get(d.id),n=i.get(d.id);if(l&&n){let g=n.ls-l.es;Math.abs(g)<.01&&m.push(d.id);}}return m},calculateSlack:(e,t)=>{let a=de.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(de.calculateCriticalPath(e).includes(t))return 0;let o=de.getDependentTasks(e,t);if(o.length===0){let p=de.getLatestEndDate(e);if(!p)return null;let m=de.calculateDuration(a.endDate,p);return Math.max(0,m)}let s=o.filter(p=>p.startDate).map(p=>p.startDate.getTime()).sort((p,m)=>p-m)[0];if(!s)return null;let i=de.calculateDuration(a.endDate,new Date(s));return Math.max(0,i)},isOnCriticalPath:(e,t)=>de.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=de.findTaskById(e,t);if(!r||!r.endDate)return e;let o=de.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let i of o){if(!i.startDate||!i.endDate)continue;let p=de.calculateDuration(i.startDate,i.endDate),m;a!==void 0?(m=new Date(i.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let d=de.calculateEndDate(m,p),l=n=>n.map(g=>g.id===i.id?{...g,startDate:m,endDate:d}:g.subtasks?{...g,subtasks:l(g.subtasks)}:g);s=l(s),s=de.autoScheduleDependents(s,i.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,i,p)=>{if(a===0)return [];let m=[],d=o.getTime(),l=1e3*60*60*24,n=de.findTaskById(e,t);if(!n||!n.endDate)return [];let g=(f,c,w=new Set)=>{if(w.has(f))return;w.add(f);let h=de.getDependentTasks(e,f);for(let k of h){if(!k.startDate||!k.endDate)continue;let u=r.findIndex(C=>C.id===k.id);if(u===-1)continue;let y=k.startDate.getTime(),D=(k.endDate.getTime()-y)/l,M=(y-d)/l*s,x=M+c*s,L=Math.max(D*s,s),N=p+u*i+12;m.push({taskId:k.id,taskName:k.name,originalX:M,previewX:x,width:L,y:N,rowIndex:u,daysDelta:c,color:k.color}),g(k.id,c,w);}};return g(t,a),m},splitTask:(e,t,a,r=3)=>{let o=de.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 i=new Date(a);i.setDate(i.getDate()+r);let p=new Date(o.endDate);p.setDate(p.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:i,endDate:p}],d=l=>l.map(n=>n.id===o.id?{...n,endDate:p,segments:m}:n.subtasks?{...n,subtasks:d(n.subtasks)}:n);return d(e)}};function Cn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:i,templates:p,onTaskClick:m,onTaskDblClick:d,onTaskContextMenu:l,onTaskDateChange:n,onDependencyCreate:g,onDependencyDelete:f}){let[w,h]=react.useState([]),[k,u]=react.useState(null),[y,v]=react.useState(null),D=react.useCallback(B=>{u(B);},[]),T=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),M=r==="day"?60:r==="week"?20:8,x=T*M*i,L=B=>{let A=new Date(Date.UTC(B.getFullYear(),B.getMonth(),B.getDate())),R=A.getUTCDay()||7;A.setUTCDate(A.getUTCDate()+4-R);let P=new Date(Date.UTC(A.getUTCFullYear(),0,1));return Math.ceil(((A.getTime()-P.getTime())/864e5+1)/7)},N=B=>{let A=B.getDay();return A===0||A===6},C=react.useCallback(B=>{let A=Math.round(B/(M*i)),R=new Date(o);return R.setDate(R.getDate()+A),R},[o,M,i]),W=react.useCallback((B,A)=>{if(A.startDate&&A.endDate)return;let R=B.currentTarget.ownerSVGElement;if(!R)return;let P=R.createSVGPoint();P.x=B.clientX,P.y=B.clientY;let J=P.matrixTransform(R.getScreenCTM()?.inverse()),q=C(J.x),$=new Date(q);$.setDate($.getDate()+1),n?.(A,q,$);},[C,n]),I=react.useMemo(()=>{let B=J=>J.map(q=>{if(q.subtasks&&q.subtasks.length>0){let $=B(q.subtasks),ke=$.filter(Ae=>Ae.startDate&&Ae.endDate);if(ke.length>0){let Ae=ke.map(Be=>Be.startDate.getTime()),He=ke.map(Be=>Be.endDate.getTime()),we=new Date(Math.min(...Ae)),Je=new Date(Math.max(...He));return {...q,subtasks:$,startDate:we,endDate:Je}}return {...q,subtasks:$}}return q}),A=(J,q=[])=>{for(let $ of J)q.push($),$.subtasks&&$.subtasks.length>0&&($.isExpanded===void 0||$.isExpanded)&&A($.subtasks,q);return q},R=B(e);return A(R)},[e]),K=react.useCallback(B=>{if(!B.startDate||!B.endDate)return {x:0,width:0};let A=B.startDate.getTime(),R=B.endDate.getTime(),P=o.getTime(),J=(A-P)/(1e3*60*60*24),q=(R-A)/(1e3*60*60*24),$=J*M*i,ke=Math.max(M*i,40),Ae=Math.max(q*M*i,ke);return {x:$,width:Ae}},[o,M,i]),V=react.useMemo(()=>I.filter(B=>B.startDate&&B.endDate).map(B=>{let{x:A,width:R}=K(B),J=I.findIndex(q=>q.id===B.id)*a+12;return {id:B.id,x:A,y:J,width:R,height:32}}),[I,K]),z=react.useCallback((B,A,R)=>{if(!R||A===0){h([]);return}let P=de.calculateCascadePreview(e,B,A,I,o,M*i,a,48);h(P);},[e,I,o,M,i,a,48]),Q=react.useMemo(()=>{let B=[],A=new Date(o);for(;A<=s;){let J=(A.getTime()-o.getTime())/864e5*M*i;if(r==="day")B.push({date:new Date(A),label:A.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:J}),A.setDate(A.getDate()+1);else if(r==="week"){let q=L(A);B.push({date:new Date(A),label:`Week ${q}`,x:J}),A.setDate(A.getDate()+7);}else B.push({date:new Date(A),label:A.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:J}),A.setMonth(A.getMonth()+1);}return B},[o,s,r,M,i]),ue=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*M*i,[o,M,i]),ve=Math.max(I.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(x,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(x,1e3),height:48,fill:t.bgGrid}),Q.map((B,A)=>jsxRuntime.jsxs("g",{children:[A>0&&jsxRuntime.jsx("line",{x1:B.x,y1:0,x2:B.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:B.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:B.label})]},`header-${A}`)),ue>=0&&ue<=x&&jsxRuntime.jsx("circle",{cx:ue,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(x,1e3),height:ve,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(x,1e3),height:ve,fill:t.bgPrimary}),Q.map((B,A)=>{let R=Q[A+1]?.x||x,P=N(B.date);return jsxRuntime.jsxs("g",{children:[P&&jsxRuntime.jsx("rect",{x:B.x,y:0,width:R-B.x,height:I.length*a,fill:t.bgWeekend,opacity:1}),A>0&&jsxRuntime.jsx("line",{x1:B.x,y1:0,x2:B.x,y2:I.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},A)}),I.map((B,A)=>{let R=B.startDate&&B.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:A*a,width:x,height:a,fill:A%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${B.id}`),!R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:A*a,width:x,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:P=>W(P,B),onMouseEnter:P=>{P.currentTarget.setAttribute("fill",t.accentLight),P.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:P=>{P.currentTarget.setAttribute("fill","transparent"),P.currentTarget.setAttribute("opacity","1");}},`clickable-${B.id}`),jsxRuntime.jsx("text",{x:ue>0?ue:100,y:A*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${B.id}`)]})]},`row-group-${B.id}`)}),I.map((B,A)=>!B.dependencies||B.dependencies.length===0||!B.startDate||!B.endDate?null:B.dependencies.map(R=>{let P=I.find(ke=>ke.id===R);if(!P||!P.startDate||!P.endDate)return null;let J=I.findIndex(ke=>ke.id===R),q=K(P),$=K(B);return jsxRuntime.jsx(vn,{x1:q.x+q.width,y1:J*a+a/2,x2:$.x,y2:A*a+a/2,theme:t},`dep-${R}-${B.id}`)})),I.map((B,A)=>{if(!B.startDate||!B.endDate)return null;let{x:R,width:P}=K(B),J=A*a+12,q=B.subtasks&&B.subtasks.length>0&&!B.isMilestone;return B.isMilestone?jsxRuntime.jsx(kn,{task:B,x:R+P/2,y:J+16,theme:t,onClick:m},B.id):q?jsxRuntime.jsxs("g",{onClick:()=>m?.(B),onContextMenu:$=>{$.preventDefault(),$.stopPropagation(),l?.(B,$);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:R,y:J,width:P,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:R,y1:J,x2:R+P,y2:J,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:R,y1:J,x2:R,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:R+P,y1:J,x2:R+P,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:R,y1:J+32,x2:R+P,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),P>60&&jsxRuntime.jsx("text",{x:R+12,y:J+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:B.name})]},B.id):jsxRuntime.jsx(hn,{task:B,x:R,y:J,width:P,theme:t,dayWidth:M*i,startDate:o,templates:p,onClick:m,onDoubleClick:d,onContextMenu:l,onDateChange:n,onDependencyCreate:g,allTaskPositions:V,onDragMove:z,onHoverChange:D},B.id)}),I.map((B,A)=>!B.dependencies||B.dependencies.length===0||!B.startDate||!B.endDate?null:B.dependencies.map(R=>{let P=I.find(ge=>ge.id===R);if(!P||!P.startDate||!P.endDate)return null;let J=I.findIndex(ge=>ge.id===R),q=K(P),$=K(B),ke=q.x+q.width,Ae=J*a+a/2,He=$.x,we=A*a+a/2,Je=He-ke,Be=ke+Je/2,at=ge=>{let De=1-ge,Me=De*De,st=Me*De,wt=ge*ge,$e=wt*ge,be=st*ke+3*Me*ge*Be+3*De*wt*Be+$e*He,Ne=st*Ae+3*Me*ge*Ae+3*De*wt*we+$e*we;return {x:be,y:Ne}},Pt=20,bt=[];for(let ge=0;ge<=Pt;ge++){let De=.1+ge/Pt*.8;bt.push(at(De));}let rt=bt[0],O=`M ${rt.x} ${rt.y} `+bt.slice(1).map(ge=>`L ${ge.x} ${ge.y}`).join(" ");return y&&y.x1===ke&&y.y1===Ae&&y.x2===He&&y.y2===we?null:jsxRuntime.jsx("path",{d:O,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{v({x1:ke,y1:Ae,x2:He,y2:we,onDelete:()=>f?.(B.id,R)});}},`dep-hover-${R}-${B.id}`)})),w.map(B=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:B.previewX,y:B.y-48,width:B.width,height:32,rx:8,fill:B.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(B.daysDelta)>0&&jsxRuntime.jsx("text",{x:B.previewX+B.width/2,y:B.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:B.daysDelta>0?`+${B.daysDelta}d`:`${B.daysDelta}d`})]},`cascade-preview-${B.taskId}`)),y&&(()=>{let{x1:B,y1:A,x2:R,y2:P,onDelete:J}=y,q=R-B,$=P-A,ke=B+q/2,Ae=(A+P)/2,He=`M ${B} ${A} C ${ke} ${A}, ${ke} ${P}, ${R} ${P}`,we=6,Je=Math.atan2($,q),Be=R-we*Math.cos(Je-Math.PI/6),at=P-we*Math.sin(Je-Math.PI/6),Pt=R-we*Math.cos(Je+Math.PI/6),bt=P-we*Math.sin(Je+Math.PI/6),rt=t.dependency,O="#f87171";return jsxRuntime.jsxs("g",{onMouseLeave:()=>v(null),children:[jsxRuntime.jsx("path",{d:He,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:ke,cy:Ae,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:He,fill:"none",stroke:rt,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:He,fill:"none",stroke:rt,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${R} ${P} L ${Be} ${at} M ${R} ${P} L ${Pt} ${bt}`,fill:"none",stroke:rt,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:R,cy:P,r:4,fill:rt,opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ge=>{ge.stopPropagation(),v(null),J();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:ke,cy:Ae,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:O,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsxRuntime.jsx("line",{x1:ke-3,y1:Ae-3,x2:ke+3,y2:Ae+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:ke+3,y1:Ae-3,x2:ke-3,y2:Ae+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),ue>=0&&ue<=x&&jsxRuntime.jsx("line",{x1:ue,y1:0,x2:ue,y2:ve,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),k&&jsxRuntime.jsx(tc,{tooltipData:k,theme:t})]})]})}var Tn=[{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"}];var ci=[{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 Dn({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:i=false,mode:p=a?"edit":"create",theme:m="dark",customStatuses:d=[],availableTags:l=[],onCreateTag:n,attachments:g=[],onUploadAttachments:f,onDeleteAttachment:c}){let w=[...ci,...d.filter(O=>!ci.some(ie=>ie.id===O.id))],h=je[m]||je.dark,[k,u]=react.useState(false),[y,v]=react.useState(false),[D,T]=react.useState(false),[M,x]=react.useState(false),[L,N]=react.useState({top:0,left:0}),[C,W]=react.useState(null),[I,K]=react.useState(new Date),[V,z]=react.useState({top:0,left:0}),[Q,ue]=react.useState(false),[ve,B]=react.useState([]),A=react.useRef(null),R=react.useRef(null),P=react.useRef(null),J=react.useRef(null),q=react.useRef(null),[$,ke]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Ae,He]=react.useState({});react.useEffect(()=>{a?(ke({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&ue(true)):(ke({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),ue(false),B([]));},[a,e]),react.useEffect(()=>{let O=ie=>{A.current&&!A.current.contains(ie.target)&&u(false),R.current&&!R.current.contains(ie.target)&&v(false),P.current&&!P.current.contains(ie.target)&&T(false),J.current&&!J.current.contains(ie.target)&&x(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let we=()=>{let O={};return $.name.trim()||(O.name="El nombre es requerido"),$.startDate&&$.endDate&&$.startDate>$.endDate&&(O.endDate="La fecha de fin debe ser posterior a la de inicio"),He(O),Object.keys(O).length===0},Je=async O=>{if(O.preventDefault(),!!we())try{let ie=p==="create"&&ve.length>0?{...$,pendingFiles:ve}:$;await s(ie),B([]),t();}catch(ie){console.error("Error submitting task:",ie);}},Be=(O,ie)=>{ke(ge=>{let De={...ge,[O]:ie};if(O==="status"){let Me=ie;Me==="todo"?De.progress=0:Me==="in-progress"?(ge.progress===0||ge.progress===100)&&(De.progress=50):Me==="completed"||Me==="closed"?De.progress=100:(Me==="in-review"||Me==="review")&&(De.progress=75);}if(O==="progress"){let Me=typeof ie=="number"?ie:parseInt(ie,10);Me===100&&ge.status!=="completed"?De.status="completed":Me>0&&Me<100&&ge.status==="todo"?De.status="in-progress":Me===0&&ge.status!=="todo"&&(De.status="todo");}return De}),Ae[O]&&He(ge=>{let De={...ge};return delete De[O],De});},at=w.find(O=>O.id===$.status)??ci[0],Pt=pi.find(O=>O.id===$.priority)??pi[1],bt=Tn.find(O=>O.value===$.color)??Tn[0],rt={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":m,style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},onClick:O=>O.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:at.color||h.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:h.textSecondary},children:p==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:h.textTertiary},onMouseEnter:O=>{O.currentTarget.style.backgroundColor=h.hoverBg,O.currentTarget.style.color=h.textPrimary;},onMouseLeave:O=>{O.currentTarget.style.backgroundColor="transparent",O.currentTarget.style.color=h.textTertiary;},disabled:i,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Je,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:$.name,onChange:O=>Be("name",O.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:i,autoFocus:true}),Ae.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"}),Ae.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:$.description||"",onChange:O=>Be("description",O.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:i})}),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:()=>!i&&u(!k),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...rt,borderColor:at.color,backgroundColor:`${at.color}15`},disabled:i,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:at.color}}),jsxRuntime.jsx("span",{style:{color:at.color},children:at.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:at.color}})]}),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-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},children:w.map(O=>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:ie=>ie.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{Be("status",O.id),u(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:O.color}}),O.title,$.status===O.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},O.id))})})]}),jsxRuntime.jsxs("div",{ref:R,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!i&&v(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:rt,disabled:i,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:Pt.color}}),jsxRuntime.jsx("span",{children:Pt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),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-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},children:pi.map(O=>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:ie=>ie.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{Be("priority",O.id),v(false);},children:[jsxRuntime.jsx("span",{children:O.icon}),O.label,$.priority===O.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},O.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:P,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!i&&T(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:rt,disabled:i,children:[$.assignees&&$.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:$.assignees.slice(0,3).map((O,ie)=>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:O.color||h.accent,borderColor:h.bgSecondary},children:O.initials},ie))}),$.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:h.textTertiary},children:["+",$.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:D&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},children:o.map(O=>{let ie=$.assignees?.some(ge=>ge.name===O.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:ge=>ge.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:ge=>ge.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ge=ie?($.assignees||[]).filter(De=>De.name!==O.name):[...$.assignees||[],{name:O.name,avatar:O.avatar,initials:O.name.split(" ").map(De=>De[0]).join("").toUpperCase().slice(0,2),color:h.accent}];Be("assignees",ge);},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:O.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:O.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:ie&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:h.accent}})})]},O.id)})})})]}),jsxRuntime.jsxs("div",{ref:J,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!i)if(M)x(false);else {if(J.current){let O=J.current.getBoundingClientRect(),ie=window.innerHeight,ge=120,Me=ie-O.bottom<ge?O.top-ge-8:O.bottom+8;N({top:Me,left:O.left});}x(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:rt,disabled:i,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:$.color}}),jsxRuntime.jsx("span",{children:bt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>x(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:`${L.top}px`,left:`${L.left}px`,zIndex:99999,backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:O=>O.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Tn.slice(0,18).map(O=>{let ie=$.color===O.value;return jsxRuntime.jsx("button",{type:"button",onClick:ge=>{ge.preventDefault(),ge.stopPropagation(),Be("color",O.value),x(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:O.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:O.value,outline:ie?`2px solid ${O.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},O.value)})})})})]})})]}),l.length>0||n?jsxRuntime.jsx($a,{selectedTags:$.tags||[],availableTags:l,onChange:O=>Be("tags",O),onCreateTag:n,theme:h,disabled:i}):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:q,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!i&&!$.isMilestone)if(C==="start")W(null);else {if(q.current){let O=q.current.getBoundingClientRect(),ie=window.innerHeight,ge=320,Me=ie-O.bottom<ge?O.top-ge-8:O.bottom+8;z({top:Me,left:O.left});}W("start"),K($.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...rt,opacity:$.isMilestone?.5:1,cursor:$.isMilestone?"not-allowed":"pointer"},disabled:i||$.isMilestone,children:$.startDate?$.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(!i&&!$.isMilestone)if(C==="end")W(null);else {if(q.current){let O=q.current.getBoundingClientRect(),ie=window.innerHeight,ge=320,Me=ie-O.bottom<ge?O.top-ge-8:O.bottom+8;z({top:Me,left:O.left});}W("end"),K($.endDate||$.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...rt,opacity:$.isMilestone?.5:1,cursor:$.isMilestone?"not-allowed":"pointer"},disabled:i||$.isMilestone,children:$.endDate?$.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(lt,{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:`${V.top}px`,left:`${V.left}px`,zIndex:99999,backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${h.border}`},children:[(()=>{let O=new Date,ie=new Date(O);ie.setDate(O.getDate()+1);let ge=new Date(O);ge.setDate(O.getDate()+7);let De=new Date(O);return De.setDate(O.getDate()+14),[{label:"Hoy",date:O},{label:"Ma\xF1ana",date:ie},{label:"Pr\xF3xima semana",date:ge},{label:"2 semanas",date:De}].map((st,wt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:h.textPrimary},onMouseEnter:$e=>$e.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:$e=>$e.currentTarget.style.backgroundColor="transparent",onClick:()=>{C==="start"?(Be("startDate",st.date),(!$.endDate||st.date>$.endDate)&&Be("endDate",st.date),W("end")):(Be("endDate",st.date),(!$.startDate||st.date<$.startDate)&&Be("startDate",st.date),W(null));},children:st.label},wt))})(),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:O=>O.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",onClick:()=>{Be("startDate",void 0),Be("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:()=>K(new Date(I.getFullYear(),I.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:I.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>K(new Date(I.getFullYear(),I.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((O,ie)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:h.textTertiary},children:O},ie))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=I.getFullYear(),ie=I.getMonth(),ge=new Date(O,ie,1).getDay(),De=new Date(O,ie+1,0).getDate(),Me=new Date,st=[];for(let $e=ge-1;$e>=0;$e--)st.push({day:new Date(O,ie,-$e).getDate(),date:new Date(O,ie-1,new Date(O,ie,-$e).getDate()),isCurrentMonth:false});for(let $e=1;$e<=De;$e++)st.push({day:$e,date:new Date(O,ie,$e),isCurrentMonth:true});let wt=42-st.length;for(let $e=1;$e<=wt;$e++)st.push({day:$e,date:new Date(O,ie+1,$e),isCurrentMonth:false});return st.map(($e,be)=>{let Ne=$e.date.toDateString()===Me.toDateString(),Kt=$.startDate?.toDateString()===$e.date.toDateString(),H=$.endDate?.toDateString()===$e.date.toDateString(),Se=$.startDate&&$.endDate&&$e.date>=$.startDate&&$e.date<=$.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:$e.isCurrentMonth?Kt||H?"#FFF":h.textPrimary:h.textTertiary,backgroundColor:Kt?"#3B82F6":H?"#7C3AED":Se?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ne&&!Kt&&!H?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{C==="start"?(Be("startDate",$e.date),$.endDate&&$e.date>$.endDate&&Be("endDate",$e.date),W("end")):(Be("endDate",$e.date),$.startDate&&$e.date<$.startDate&&Be("startDate",$e.date),W(null));},children:$e.day},be)})})()})]})]})]})})]}),Ae.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Ae.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:$.progress,onChange:O=>Be("progress",parseInt(O.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:h.bgSecondary,accentColor:$.progress<30?"#EF4444":$.progress<70?"#F59E0B":"#10B981"},disabled:i}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${$.progress<30?"#EF4444":$.progress<70?"#F59E0B":"#10B981"}20`,color:$.progress<30?"#EF4444":$.progress<70?"#F59E0B":"#10B981"},children:[$.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>ue(!Q),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 ${Q?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Q&&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:[(f||g.length>0||p==="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 ",p==="create"?ve.length>0&&`(${ve.length})`:g.length>0&&`(${g.length})`]})]}),p==="create"?jsxRuntime.jsx(Ha,{cardId:"pending",attachments:ve.map((O,ie)=>({id:`pending-${ie}`,cardId:"pending",name:O.name,size:O.size,type:O.type,url:URL.createObjectURL(O),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:O=>B(ie=>[...ie,...O]),onDelete:O=>{let ie=parseInt(O.replace("pending-",""),10);B(ge=>ge.filter((De,Me)=>Me!==ie));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Ha,{cardId:a?.id||"new",attachments:g,onUpload:f&&a?.id?O=>f(a.id,O):void 0,onDelete:c,maxSizeMB:10,maxFiles:20}),p==="create"&&ve.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:h.textTertiary},children:[ve.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:$.isMilestone,onChange:O=>Be("isMilestone",O.target.checked),className:"w-4 h-4 rounded",style:{accentColor:h.accent},disabled:i}),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(O=>O.id!==a?.id).map(O=>{let ie=$.dependencies?.includes(O.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ge=ie?($.dependencies||[]).filter(De=>De!==O.id):[...$.dependencies||[],O.id];Be("dependencies",ge);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:ie?`${h.accent}30`:h.bgPrimary,color:ie?h.accent:h.textSecondary,border:`1px solid ${ie?h.accent:h.borderLight}`},disabled:i,children:O.name},O.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:O=>O.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",disabled:i,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:i,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:O=>!i&&(O.currentTarget.style.opacity="0.9"),onMouseLeave:O=>!i&&(O.currentTarget.style.opacity="1"),children:i?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:p==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var a0=['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"'],sc=()=>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"})]}),r0=()=>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"})}),o0=()=>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"})}),n0=()=>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"})}),s0=()=>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 Nn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:i,onDependencyCreate:p,onDependencyDelete:m}){let[d,l]=react.useState(false),[n,g]=react.useState(false),[f,c]=react.useState([]),[w,h]=react.useState(""),[k,u]=react.useState(false),[y,v]=react.useState(true),D=react.useRef(null),T=react.useRef(null),M=react.useRef(null),{enabled:x=true,placeholder:L='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:N="bottom-right",onCommand:C,suggestions:W=a0,maxHistory:I=50,persistHistory:K}=a,V=K?.storageKey||"gantt-ai-history",z=K?.maxMessages??5;react.useEffect(()=>{if(K?.enabled)try{let R=localStorage.getItem(V);if(R){let J=JSON.parse(R).map(q=>({...q,timestamp:new Date(q.timestamp)}));c(J.slice(-z));}}catch(R){console.warn("[GanttAIAssistant] Failed to load persisted history:",R);}},[K?.enabled,V,z]),react.useEffect(()=>{if(K?.enabled&&f.length>0)try{let R=f.filter(P=>!P.isLoading).slice(-z);localStorage.setItem(V,JSON.stringify(R));}catch(R){console.warn("[GanttAIAssistant] Failed to persist history:",R);}},[f,K?.enabled,V,z]),react.useEffect(()=>{T.current&&T.current.scrollIntoView({behavior:"smooth"});},[f]),react.useEffect(()=>{d&&!n&&D.current&&setTimeout(()=>D.current?.focus(),100);},[d,n]);let Q=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&&i?.(R.taskId);break;case "link_tasks":R.dependencyFrom&&R.dependencyTo&&p?.(R.dependencyFrom,R.dependencyTo);break;case "unlink_tasks":R.taskId&&R.dependencyFrom&&m?.(R.taskId,R.dependencyFrom);break}},[o,s,i,p,m]),ue=react.useCallback(async R=>{if(!R.trim()||k)return;let P={id:`user-${Date.now()}`,role:"user",content:R,timestamp:new Date};c(q=>[...q.slice(-(I-1)),P]),h(""),v(false),u(true);let J={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};c(q=>[...q,J]);try{if(C){let q=await C(R,e);c($=>{let ke=$.filter(He=>!He.isLoading),Ae={id:`assistant-${Date.now()}`,role:"assistant",content:q.message,timestamp:new Date,command:q};return [...ke,Ae]}),Q(q);}else c(q=>[...q.filter(ke=>!ke.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(q){c($=>[...$.filter(Ae=>!Ae.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${q instanceof Error?q.message:"Unknown error"}`,timestamp:new Date}]);}finally{u(false);}},[k,I,C,e,Q]),ve=R=>{R.preventDefault(),ue(w);},B=R=>{h(R),D.current?.focus();};if(react.useEffect(()=>{let R=P=>{(P.metaKey||P.ctrlKey)&&P.key==="k"&&(P.preventDefault(),l(J=>!J),d||g(false)),P.key==="Escape"&&d&&l(false);};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[d]),react.useEffect(()=>{if(!d)return;let R=J=>{let q=J.target;M.current&&!M.current.contains(q)&&l(false);},P=setTimeout(()=>{document.addEventListener("mousedown",R);},100);return ()=>{clearTimeout(P),document.removeEventListener("mousedown",R);}},[d]),!x)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(lt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&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[N]} 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:()=>l(true),children:[jsxRuntime.jsx(sc,{}),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:d&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:M,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:n?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${A[N]} 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(sc,{}),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(R=>!R),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(n0,{})}),jsxRuntime.jsx("button",{onClick:()=>l(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(o0,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&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:[f.length===0&&y&&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,P)=>jsxRuntime.jsx("button",{onClick:()=>B(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},P))})]}),f.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(s0,{}):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:T})]}),jsxRuntime.jsxs("form",{onSubmit:ve,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:D,type:"text",value:w,onChange:R=>h(R.target.value),placeholder:L,disabled:k,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!w.trim()||k,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:w.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:w.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(r0,{})})]}),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((d,l=true)=>{r(n=>{let g=typeof d=="function"?d(n.present):d;if(o.current)return {...n,present:g};if(!l)return {...n,present:g};let f=[...n.past,n.present];return f.length>t&&f.shift(),{past:f,present:g,future:[]}});},[t]),i=react.useCallback(()=>{r(d=>{if(d.past.length===0)return d;let l=d.past[d.past.length-1],n=d.past.slice(0,d.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:n,present:l,future:[d.present,...d.future]}});},[]),p=react.useCallback(()=>{r(d=>{if(d.future.length===0)return d;let l=d.future[0],n=d.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...d.past,d.present],present:l,future:n}});},[]),m=react.useCallback(()=>{r(d=>({past:[],present:d.present,future:[]}));},[]);return {state:a.present,setState:s,undo:i,redo:p,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function lc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=i=>{let p=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=p?i.metaKey:i.ctrlKey;if(m&&i.key==="z"&&!i.shiftKey&&a){i.preventDefault(),e();return}if(r){if(!p&&m&&i.key==="y"){i.preventDefault(),t();return}if(p&&m&&i.shiftKey&&i.key==="z"){i.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var c0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${de.formatDate(e.startDate)} - ${de.formatDate(e.endDate)}`);let a=de.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=>de.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function dc(e){return {...c0,...e}}var b0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},mc=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:i="week",rowDensity:p="comfortable",showThemeSelector:m=true,showExportButton:d=true,availableUsers:l=[],templates:n,enableAutoCriticalPath:g=true,persistExpandedState:f,aiAssistant:c,locale:w="en",customTranslations:h,showCreateTaskButton:k=false,createTaskLabel:u,onCreateTask:y,onThemeChange:v,onTaskClick:D,onTaskDblClick:T,onTaskContextMenu:M,onTaskUpdate:x,onProgressChange:L,onTaskEdit:N,onTaskAddSubtask:C,onTaskMarkIncomplete:W,onTaskSetInProgress:I,onDependencyCreate:K,onDependencyDelete:V,onBeforeTaskAdd:z,onAfterTaskAdd:Q,onBeforeTaskUpdate:ue,onAfterTaskUpdate:ve,onBeforeTaskDelete:B,onAfterTaskDelete:A}=a,P=react.useContext(dn)?.theme,[J,q]=react.useState(P||s||"dark"),[$,ke]=react.useState(i),[Ae,He]=react.useState(p),[we,Je]=react.useState(1),[Be,at]=react.useState(0),[Pt,bt]=react.useState(false),[rt,O]=react.useState(null),[ie,ge]=react.useState({isOpen:false,x:0,y:0,task:null}),[De,Me]=react.useState(null),[st,wt]=react.useState(null);react.useEffect(()=>{P&&P!==J&&q(P);},[P]),react.useEffect(()=>{s&&s!==J&&q(s);},[s]);let $e=react.useCallback(S=>{q(S),v?.(S);},[v]),{state:be,setState:Ne,undo:Kt,redo:H,canUndo:Se,canRedo:et,clearHistory:Ce}=ic(t,50),Ee=react.useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),ae=react.useRef(new Map),X=react.useRef(false);if(!X.current&&f){X.current=true;let S=typeof f=="string"?f:"gantt-expanded-tasks";try{let E=localStorage.getItem(S);if(E){let G=JSON.parse(E);Array.isArray(G)&&(ae.current=new Map(G));}}catch(E){console.warn("[GanttBoard] Error loading expanded state from localStorage:",E);}}let Te=react.useCallback(()=>{let S=Ee();if(S)try{let E=Array.from(ae.current.entries());localStorage.setItem(S,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving expanded state to localStorage:",E);}},[Ee]);react.useEffect(()=>{let S=E=>E.map(G=>{let oe=ae.current.get(G.id),me=oe!==void 0?{...G,isExpanded:oe}:G;return me.subtasks?.length?{...me,subtasks:S(me.subtasks)}:me});ae.current.size>0?Ne(S(t)):Ne(t);},[t,Ne]);let ee=react.useRef(t),ze=react.useRef(true);react.useEffect(()=>{if(ze.current){ze.current=false,ee.current=be;return}if(!r)return;let S=JSON.stringify(ee.current),E=JSON.stringify(be);S!==E&&(ee.current=be,r(be));},[be,r]);let Fe=react.useMemo(()=>Ys(w,h),[w,h]),Ze=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}],[]),[Ie,pe]=react.useState(()=>Ze(Fe));react.useEffect(()=>{pe(S=>S.map(E=>({...E,label:Fe.columns[E.id==="name"?"taskName":E.id]||E.label})));},[Fe]);let Re=react.useMemo(()=>Ie.filter(E=>E.visible).reduce((E,G)=>E+G.width,0),[Ie]),ot=react.useRef(Ie.filter(S=>S.visible).map(S=>S.id).join(","));react.useEffect(()=>{let S=Ie.filter(oe=>oe.visible),E=S.map(oe=>oe.id).join(","),G=ot.current;if(E!==G){let oe=S.some(xe=>xe.id!=="name"),me=G.includes(",");oe?!me&&oe&&O(null):O(null),ot.current=E;}},[Ie]);let Y=60,re=.6,Pe=react.useMemo(()=>{let E=Re+Y,G=typeof window<"u"?window.innerWidth*re:800,oe=Math.max(E,G);return rt!==null?Math.max(200,Math.min(rt,oe)):Math.max(200,E)},[rt,Re]),Ve=react.useRef(null),We=react.useRef(null),U=react.useRef(null),Z=react.useMemo(()=>Sd(J),[J]),Le=react.useMemo(()=>({theme:Z,themeName:J}),[Z,J]),kt=react.useMemo(()=>dc(n),[n]),it=react.useMemo(()=>{if(!g)return be;let S=de.calculateCriticalPath(be),E=G=>G.map(oe=>({...oe,isCriticalPath:S.includes(oe.id),subtasks:oe.subtasks?E(oe.subtasks):void 0}));return E(be)},[be,g]),Va=b0(Ae);lc({undo:Kt,redo:H,canUndo:Se,canRedo:et,enabled:true}),react.useImperativeHandle(o,()=>({getTask:S=>de.findTaskById(be,S),addTask:(S,E)=>{Ne(G=>{if(!E)return [...G,{...S,level:0}];let oe=me=>me.map(xe=>xe.id===E?{...xe,subtasks:[...xe.subtasks||[],{...S,parentId:E,level:(xe.level||0)+1}],isExpanded:true}:xe.subtasks?{...xe,subtasks:oe(xe.subtasks)}:xe);return oe(G)});},updateTask:(S,E)=>{Ne(G=>{let oe=me=>me.map(xe=>xe.id===S?{...xe,...E}:xe.subtasks?{...xe,subtasks:oe(xe.subtasks)}:xe);return oe(G)});},deleteTask:S=>{Ne(E=>{let G=oe=>oe.filter(me=>me.id===S?false:(me.subtasks&&(me.subtasks=G(me.subtasks)),true));return G(E)});},deleteTasks:S=>{Ne(E=>ti(E,S));},duplicateTask:S=>{Ne(E=>ai(E,[S]));},splitTask:(S,E,G=3)=>{Ne(oe=>de.splitTask(oe,S,E,G));},calculateEndDate:de.calculateEndDate,calculateDuration:de.calculateDuration,validateDependency:(S,E)=>!de.validateDependencies(be,S,E),getAllTasks:()=>de.flattenTasks(be),getTasksByStatus:S=>de.flattenTasks(be).filter(E=>E.status===S),getTasksByParent:S=>S?de.findTaskById(be,S)?.subtasks||[]:be.filter(G=>!G.parentId),getCriticalPath:()=>de.flattenTasks(be).filter(S=>S.isCriticalPath),indentTask:S=>{Ne(E=>Zs(E,[S]));},outdentTask:S=>{Ne(E=>Qs(E,[S]));},moveTask:(S,E)=>{Ne(G=>ei(G,[S],E));},createSubtask:async S=>{let{tasks:E,newTask:G}=ni(be,S);if(z){let oe=z({...G,parentId:S});if((oe instanceof Promise?await oe:oe)===false)return}Ne(E),Q&&Q({...G,parentId:S});},scrollToTask:S=>{let G=de.flattenTasks(be).findIndex(oe=>oe.id===S);if(G!==-1&&Ve.current){let oe=G*Va;Ve.current.scrollTo({top:oe,behavior:"smooth"}),We.current&&We.current.scrollTo({top:oe,behavior:"smooth"});}},highlightTask:(S,E=2e3)=>{},expandTask:S=>{Ne(E=>{let G=oe=>oe.map(me=>me.id===S?{...me,isExpanded:true}:me.subtasks?{...me,subtasks:G(me.subtasks)}:me);return G(E)});},collapseTask:S=>{Ne(E=>{let G=oe=>oe.map(me=>me.id===S?{...me,isExpanded:false}:me.subtasks?{...me,subtasks:G(me.subtasks)}:me);return G(E)});},expandAll:()=>{Ne(S=>{let E=G=>G.map(oe=>({...oe,isExpanded:true,subtasks:oe.subtasks?E(oe.subtasks):void 0}));return E(S)});},collapseAll:()=>{Ne(S=>{let E=G=>G.map(oe=>({...oe,isExpanded:false,subtasks:oe.subtasks?E(oe.subtasks):void 0}));return E(S)});},undo:Kt,redo:H,canUndo:()=>Se,canRedo:()=>et,clearHistory:Ce,exportToPNG:async()=>{if(!U.current||!Ve.current||!We.current)throw new Error("Gantt container not found");let S=U.current,E=Ve.current.querySelector(".gantt-grid-scroll"),G=We.current,oe=E?.scrollTop||0,me=G.scrollTop,xe=S.style.overflow,ut=S.style.height;try{let Wt=E?.querySelector(".gantt-taskgrid-content"),oa=G.querySelector("svg"),na=Wt?.scrollHeight||E?.scrollHeight||600,ga=oa?.getBoundingClientRect().height||G.scrollHeight,vr=(S.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(na,ga)+20;E&&(E.scrollTop=0),G.scrollTop=0,S.style.overflow="visible",S.style.height=`${vr}px`,await new Promise(rr=>setTimeout(rr,100));let ar=await pc__default.default(S,{backgroundColor:Z.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:rr=>{let Wr=window.getComputedStyle(rr),xr=parseInt(Wr.zIndex,10);return !isNaN(xr)&&xr>=50||Wr.position==="fixed"}});return new Promise((rr,Wr)=>{ar.toBlob(xr=>{xr?rr(xr):Wr(new Error("Failed to create blob from canvas"));},"image/png");})}finally{S.style.overflow=xe,S.style.height=ut,E&&(E.scrollTop=oe),G.scrollTop=me;}},exportToPDF:async S=>{await de.exportToPDF(be,S);},exportToExcel:async S=>{await de.exportToExcel(be,S);},exportToJSON:()=>de.exportToJSON(be),exportToCSV:()=>de.exportToCSV(be),importFromJSON:S=>{let E=de.importFromJSON(S);Ne(E);},getTasks:()=>be,refresh:()=>{Ne(S=>[...S]);},clearAll:()=>{Ne([]);}}),[be,Kt,H,Se,et,Ce,Z,Va]);let br=react.useCallback(S=>{pe(E=>E.map(G=>G.id===S?{...G,visible:!G.visible}:G));},[]),Qa=react.useCallback((S,E)=>{pe(G=>G.map(oe=>{if(oe.id!==S)return oe;let me=oe.minWidth??100,xe=oe.maxWidth??800,ut=Math.max(me,Math.min(xe,E));return {...oe,width:ut}}));},[]),po=react.useCallback(S=>{Ne(E=>{let G=oi(E,S),oe=me=>{for(let xe of me){if(xe.id===S){ae.current.set(S,xe.isExpanded??true);return}xe.subtasks?.length&&oe(xe.subtasks);}};return oe(G),Te(),G}),a.onTaskToggleExpand?.(S);},[a,Te]),ce=react.useCallback((S,E)=>{if(ue&&ue(S,E)===false)return;let oe=de.findTaskById(be,S)?.progress,me=ut=>ut.map(Wt=>Wt.id===S?{...Wt,...E}:Wt.subtasks?{...Wt,subtasks:me(Wt.subtasks)}:Wt);Ne(me(be));let xe=de.findTaskById(me(be),S);xe&&(x?.(xe),ve?.(xe),E.progress!==void 0&&oe!==void 0&&E.progress!==oe&&L?.(S,oe,E.progress));},[be,x,ue,ve,L]),Mt=react.useCallback(S=>{S.length!==0&&(Ne(E=>Zs(E,S)),a.onTaskIndent?.(S[0]));},[a]),ea=react.useCallback(S=>{S.length!==0&&(Ne(E=>Qs(E,S)),a.onTaskOutdent?.(S[0]));},[a]),$r=react.useCallback((S,E,G)=>{Ne(oe=>Kd(oe,S,E,G)),a.onTaskReparent?.(S,E,G);},[a]),Wo=react.useCallback((S,E)=>{S.length!==0&&(Ne(G=>ei(G,S,E)),a.onTaskMove?.(S[0],E));},[a]),er=react.useCallback(async S=>{let E=[];for(let G of S)B&&await Promise.resolve(B(G))===false||E.push(G);E.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(E):(Ne(G=>ti(G,E)),E.forEach(G=>a.onTaskDelete?.(G))),A&&E.forEach(G=>A(G)));},[a,B,A]),ja=react.useCallback(S=>{Ne(E=>ai(E,S)),S.forEach(E=>a.onTaskDuplicate?.(E));},[a]),yr=react.useCallback((S,E)=>{Ne(G=>{let{tasks:oe,newTask:me}=jd(G,S,E);return z&&z(me)===false?G:(a.onTaskCreate?.(me.parentId,me.position||0),Q?.(me),oe)});},[a,z,Q]),$t=react.useCallback((S,E)=>{Ne(G=>ri(G,S,E)),a.onTaskRename?.(S,E);},[a]),mo=react.useCallback(S=>{Ne(E=>{let{tasks:G}=ni(E,S);return a.onTaskCreate?.(S,0),G});},[a]),jn=react.useCallback((S,E,G)=>{let oe=S.startDate?Math.round((E.getTime()-S.startDate.getTime())/864e5):0,me=Wt=>Wt.map(oa=>oa.id===S.id?{...oa,startDate:E,endDate:G,...S.segments&&{segments:S.segments}}:oa.subtasks?{...oa,subtasks:me(oa.subtasks)}:oa),xe=me(be);xe=de.autoScheduleDependents(xe,S.id,oe),Ne(xe);let ut={...S,startDate:E,endDate:G};x?.(ut);},[be,x]),sl=react.useCallback((S,E)=>{M?.(S,E),ge({isOpen:true,x:E.clientX,y:E.clientY,task:S});},[M]),uo=react.useCallback((S,E)=>{let G=de.splitTask(be,S.id,E);Ne(G),ge({isOpen:false,x:0,y:0,task:null});},[be]),il=react.useCallback(S=>{let E=de.findTaskById(be,S.id)||S;T?.(E),N||Me(E);},[be,T,N]),ll=react.useCallback((S,E,G)=>{let oe=new Map,me=na=>{na.forEach(ga=>{ga.dependencies&&oe.set(ga.id,ga.dependencies),ga.subtasks&&me(ga.subtasks);});};me(G);let xe=oe.get(E)||[];oe.set(E,[...xe,S]);let ut=new Set,Wt=new Set,oa=na=>{if(!ut.has(na)){ut.add(na),Wt.add(na);let ga=oe.get(na)||[];for(let tr of ga){if(!ut.has(tr)&&oa(tr))return true;if(Wt.has(tr))return true}}return Wt.delete(na),false};return oa(E)},[]),dl=react.useCallback((S,E)=>{if(ll(S.id,E,be)){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 G=re=>re.map(ge=>{if(ge.id===E){let Ce=ge.dependencies||[];if(!Ce.includes(S.id))return {...ge,dependencies:[...Ce,S.id]}}return ge.subtasks?{...ge,subtasks:G(ge.subtasks)}:ge});Q(G(L)),K?.(S.id,E);},[L,K,ll]),cl=react.useCallback((S,E)=>{let G=re=>re.map(ge=>{if(ge.id===S&&ge.dependencies){let Ce=ge.dependencies.filter(pt=>pt!==E);return {...ge,dependencies:Ce}}return ge.subtasks?{...ge,subtasks:G(ge.subtasks)}:ge});Q(G(L)),j?.(S,E);},[L,j]),{startDate:Np,endDate:Sp}=react.useMemo(()=>{let S=L.filter(Ce=>Ce.startDate&&Ce.endDate);if(S.length===0){let Ce=new Date,pt=new Date(Ce);pt.setDate(pt.getDate()-30);let Wt=new Date(Ce);return Wt.setDate(Wt.getDate()+60),{startDate:pt,endDate:Wt}}let E=S.flatMap(Ce=>[Ce.startDate,Ce.endDate]).filter(Ce=>Ce!==void 0),G=new Date(Math.min(...E.map(Ce=>Ce.getTime()))),re=new Date(Math.max(...E.map(Ce=>Ce.getTime()))),ge=U==="day"?7:U==="week"?14:30;return G.setDate(G.getDate()-ge),re.setDate(re.getDate()+ge),{startDate:G,endDate:re}},[L,U]),Ep=react.useCallback(async()=>{if(!W.current||!Ve.current||!$e.current)return;await new Promise(vr=>setTimeout(vr,200));let S=W.current,E=Ve.current.querySelector(".gantt-grid-scroll"),G=$e.current,re=E?.scrollTop||0,ge=E?.scrollLeft||0,Ce=G.scrollTop,pt=G.scrollLeft,Wt=S.style.overflow,oa=S.style.height,na=E?.style.overflow||"",ga=G.style.overflow,er=S.style.width,Ho=G.style.width;try{let vr=E?.querySelector(".gantt-taskgrid-content"),tr=G.querySelector("svg"),ar=tr?.getAttribute("height")?parseInt(tr.getAttribute("height"),10):tr?.getBoundingClientRect().height||0,Wr=vr?.scrollHeight||E?.scrollHeight||600,xr=Math.max(ar,G.scrollHeight),pl=tr?.getAttribute("width")?parseInt(tr.getAttribute("width"),10):tr?.getBoundingClientRect().width||G.scrollWidth,Bp=S.querySelector('[class*="h-12"]')?.offsetHeight||48,Kn=Math.max(Wr,xr,ar),Yn=Bp+Kn+50,qn=(E?.offsetWidth||300)+pl+10;E&&(E.scrollTop=0,E.scrollLeft=0),G.scrollTop=0,G.scrollLeft=0,S.style.overflow="visible",S.style.height=`${Yn}px`,S.style.width=`${qn}px`,E&&(E.style.overflow="visible",E.style.height=`${Kn+50}px`),G.style.overflow="visible",G.style.height=`${Kn+50}px`,G.style.width=`${pl+10}px`,await new Promise(Jn=>setTimeout(Jn,150));let Rp=await pc__default.default(S,{backgroundColor:J.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:qn,height:Yn,windowWidth:qn+100,windowHeight:Yn+100,scrollX:0,scrollY:0,ignoreElements:Jn=>{let ml=window.getComputedStyle(Jn),ul=parseInt(ml.zIndex,10);return !isNaN(ul)&&ul>=50||ml.position==="fixed"}}),Xn=document.createElement("a");Xn.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Xn.href=Rp.toDataURL("image/png"),Xn.click();}finally{S.style.overflow=Wt,S.style.height=oa,S.style.width=er,E&&(E.style.overflow=na,E.style.height="",E.scrollTop=re,E.scrollLeft=ge),G.style.overflow=ga,G.style.height="",G.style.width=Ho,G.scrollTop=Ce,G.scrollLeft=pt;}},[J]),Pp=react.useCallback(async()=>{await me.exportToPDF(L);},[L]),Mp=react.useCallback(async()=>{await me.exportToExcel(L);},[L]),Ap=react.useCallback(()=>{let S=me.exportToCSV(L),E=new Blob([S],{type:"text/csv;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(E),G.download="gantt-chart.csv",G.click(),URL.revokeObjectURL(G.href);},[L]),Ip=react.useCallback(()=>{let S=me.exportToJSON(L),E=new Blob([S],{type:"application/json;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(E),G.download="gantt-chart.json",G.click(),URL.revokeObjectURL(G.href);},[L]),Lp=react.useCallback(()=>{me.exportToMSProject(L,"Gantt Project","project.xml");},[L]),Fp=S=>{S.preventDefault(),Pt(true);},Ur=react.useRef(false);return react.useEffect(()=>{let S=$e.current,E=Ve.current?.querySelector(".gantt-grid-scroll");if(!S||!E)return;let G=()=>{if(Ur.current)return;Ur.current=true;let pt=S.scrollTop;et(pt),E.scrollTop=pt,requestAnimationFrame(()=>{Ur.current=false;});},re=()=>{if(Ur.current)return;Ur.current=true;let pt=E.scrollTop;et(pt),S.scrollTop=pt,requestAnimationFrame(()=>{Ur.current=false;});},ge=pt=>{if(vt&&E){let oa=E.parentElement?.getBoundingClientRect()?.left||0,na=pt.clientX-oa,ga=200,er=ht+q,Ho=window.innerWidth*te,vr=Math.max(er,Ho);na>=ga&&na<=vr&&z(na);}},Ce=()=>{Pt(false);};return S.addEventListener("scroll",G),E.addEventListener("scroll",re),document.addEventListener("mousemove",ge),document.addEventListener("mouseup",Ce),()=>{S.removeEventListener("scroll",G),E.removeEventListener("scroll",re),document.removeEventListener("mousemove",ge),document.removeEventListener("mouseup",Ce);}},[vt,ht]),jsxRuntime.jsx(ao.Provider,{value:pe,children:jsxRuntime.jsx(as.Provider,{value:Ie,children:jsxRuntime.jsxs("div",{ref:W,className:"flex flex-col h-full w-full",style:{backgroundColor:J.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(pn,{theme:J,timeScale:U,onTimeScaleChange:Se,zoom:xe,onZoomChange:at,currentTheme:X,onThemeChange:Re,rowDensity:Te,onRowDensityChange:He,showThemeSelector:m,showCreateTaskButton:w,createTaskLabel:b,onCreateTask:v,onExportPNG:n?Ep:void 0,onExportPDF:n?Pp:void 0,onExportExcel:n?Mp:void 0,onExportCSV:n?Ap:void 0,onExportJSON:n?Ip:void 0,onExportMSProject:n?Lp:void 0}),jsxRuntime.jsxs("div",{ref:Ve,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Me,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(fn,{tasks:ot,theme:J,rowHeight:_a,availableUsers:d,templates:wt,onTaskClick:T,onTaskDblClick:il,onTaskContextMenu:M,onTaskToggle:po,scrollTop:Le,columns:Be,onToggleColumn:br,onColumnResize:Za,onTaskUpdate:ue,onTaskIndent:Mt,onTaskOutdent:ea,onTaskMove:Wo,onMultiTaskDelete:Qa,onTaskDuplicate:Va,onTaskCreate:yr,onTaskRename:$t,onCreateSubtask:mo,onOpenTaskModal:T?S=>T(S):void 0,onDeleteRequest:(S,E)=>ft({taskId:S,taskName:E}),onTaskReparent:$r})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:J.border,zIndex:15},onMouseDown:Fp}),jsxRuntime.jsx("div",{ref:$e,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Cn,{tasks:ot,theme:J,rowHeight:_a,timeScale:U,startDate:Np,endDate:Sp,zoom:xe,templates:wt,onTaskClick:T,onTaskDblClick:il,onTaskContextMenu:sl,onTaskDateChange:jn,onDependencyCreate:dl,onDependencyDelete:cl})})]}),se.task&&jsxRuntime.jsx(ro,{isOpen:se.isOpen,x:se.x,y:se.y,theme:J,onClose:()=>fe({isOpen:false,x:0,y:0,task:null}),items:(()=>{let S=se.task;if(!S)return [];let E=me.findTaskById(L,S.id)||S;return E.subtasks&&E.subtasks.length>0?[{id:"addSubtask",label:pe.contextMenu?.addSubtask||"Add Subtask",icon:St.Add,onClick:()=>{C?C(E):mo(E.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:pe.contextMenu?.deleteTask||"Delete Task",icon:St.Delete,onClick:()=>{ft({taskId:E.id,taskName:E.name});}}]:[{id:"edit",label:pe.contextMenu?.editTask||"Edit Task",icon:St.Pencil,onClick:()=>{N?N(E):Ae(E);}},{id:"addSubtask",label:pe.contextMenu?.addSubtask||"Add Subtask",icon:St.Add,onClick:()=>{C?C(E):mo(E.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:pe.contextMenu?.markIncomplete||"Mark Incomplete",icon:St.MarkIncomplete,onClick:()=>{H?H(E):ue(E.id,{status:"todo",progress:0});},disabled:E.status==="todo"},{id:"setInProgress",label:pe.contextMenu?.setInProgress||"Set In Progress",icon:St.SetInProgress,onClick:()=>{I?I(E):ue(E.id,{status:"in-progress"});},disabled:E.status==="in-progress"},{id:"markComplete",label:pe.contextMenu?.markComplete||"Mark Complete",icon:St.MarkComplete,onClick:()=>{ue(E.id,{status:"completed",progress:100});},disabled:E.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:pe.contextMenu?.splitTask||"Split Task",icon:St.Split,onClick:()=>{if(!E.startDate||!E.endDate){console.warn("Cannot split task without dates");return}let re=E.startDate.getTime(),ge=E.endDate.getTime(),Ce=re+(ge-re)/2,pt=new Date(Ce);uo(E,pt);},disabled:!E.startDate||!E.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:pe.contextMenu?.deleteTask||"Delete Task",icon:St.Delete,onClick:()=>{ft({taskId:E.id,taskName:E.name});}}]})()}),Ne&&jsxRuntime.jsx(Dn,{isOpen:true,onClose:()=>Ae(null),task:Ne,onSubmit:S=>{ue(Ne.id,S),Ae(null);},mode:"edit",theme:X}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:rt&&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:()=>ft(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:J.bgSecondary,border:`1px solid ${J.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${J.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:J.textPrimary,fontFamily:"Inter, sans-serif"},children:[pe.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:J.textSecondary,fontFamily:"Inter, sans-serif"},children:h==="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:J.textSecondary,fontFamily:"Inter, sans-serif"},children:[h==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:J.textPrimary},children:['"',rt.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:J.bgPrimary,borderTop:`1px solid ${J.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>ft(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:J.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=J.hoverBg;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:h==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Qa([rt.taskId]),ft(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"}),h==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsxRuntime.jsx(Nn,{tasks:L,theme:J,config:f,onTasksUpdate:Q,onTaskUpdate:ue,onTaskCreate:S=>{Q(E=>[...E,S]);},onTaskDelete:S=>{Qa([S]);},onDependencyCreate:(S,E)=>{let G=me.findTaskById(L,S);G&&dl(G,E);},onDependencyDelete:cl})]})})})});var uc=`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 G=oe=>oe.map(me=>{if(me.id===E){let xe=me.dependencies||[];if(!xe.includes(S.id))return {...me,dependencies:[...xe,S.id]}}return me.subtasks?{...me,subtasks:G(me.subtasks)}:me});Ne(G(be)),K?.(S.id,E);},[be,K,ll]),cl=react.useCallback((S,E)=>{let G=oe=>oe.map(me=>{if(me.id===S&&me.dependencies){let xe=me.dependencies.filter(ut=>ut!==E);return {...me,dependencies:xe}}return me.subtasks?{...me,subtasks:G(me.subtasks)}:me});Ne(G(be)),V?.(S,E);},[be,V]),{startDate:Np,endDate:Sp}=react.useMemo(()=>{let S=be.filter(xe=>xe.startDate&&xe.endDate);if(S.length===0){let xe=new Date,ut=new Date(xe);ut.setDate(ut.getDate()-30);let Wt=new Date(xe);return Wt.setDate(Wt.getDate()+60),{startDate:ut,endDate:Wt}}let E=S.flatMap(xe=>[xe.startDate,xe.endDate]).filter(xe=>xe!==void 0),G=new Date(Math.min(...E.map(xe=>xe.getTime()))),oe=new Date(Math.max(...E.map(xe=>xe.getTime()))),me=$==="day"?7:$==="week"?14:30;return G.setDate(G.getDate()-me),oe.setDate(oe.getDate()+me),{startDate:G,endDate:oe}},[be,$]),Ep=react.useCallback(async()=>{if(!U.current||!Ve.current||!We.current)return;await new Promise(vr=>setTimeout(vr,200));let S=U.current,E=Ve.current.querySelector(".gantt-grid-scroll"),G=We.current,oe=E?.scrollTop||0,me=E?.scrollLeft||0,xe=G.scrollTop,ut=G.scrollLeft,Wt=S.style.overflow,oa=S.style.height,na=E?.style.overflow||"",ga=G.style.overflow,tr=S.style.width,Ho=G.style.width;try{let vr=E?.querySelector(".gantt-taskgrid-content"),ar=G.querySelector("svg"),rr=ar?.getAttribute("height")?parseInt(ar.getAttribute("height"),10):ar?.getBoundingClientRect().height||0,Wr=vr?.scrollHeight||E?.scrollHeight||600,xr=Math.max(rr,G.scrollHeight),pl=ar?.getAttribute("width")?parseInt(ar.getAttribute("width"),10):ar?.getBoundingClientRect().width||G.scrollWidth,Bp=S.querySelector('[class*="h-12"]')?.offsetHeight||48,Kn=Math.max(Wr,xr,rr),Yn=Bp+Kn+50,qn=(E?.offsetWidth||300)+pl+10;E&&(E.scrollTop=0,E.scrollLeft=0),G.scrollTop=0,G.scrollLeft=0,S.style.overflow="visible",S.style.height=`${Yn}px`,S.style.width=`${qn}px`,E&&(E.style.overflow="visible",E.style.height=`${Kn+50}px`),G.style.overflow="visible",G.style.height=`${Kn+50}px`,G.style.width=`${pl+10}px`,await new Promise(Jn=>setTimeout(Jn,150));let Rp=await pc__default.default(S,{backgroundColor:Z.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:qn,height:Yn,windowWidth:qn+100,windowHeight:Yn+100,scrollX:0,scrollY:0,ignoreElements:Jn=>{let ml=window.getComputedStyle(Jn),ul=parseInt(ml.zIndex,10);return !isNaN(ul)&&ul>=50||ml.position==="fixed"}}),Xn=document.createElement("a");Xn.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Xn.href=Rp.toDataURL("image/png"),Xn.click();}finally{S.style.overflow=Wt,S.style.height=oa,S.style.width=tr,E&&(E.style.overflow=na,E.style.height="",E.scrollTop=oe,E.scrollLeft=me),G.style.overflow=ga,G.style.height="",G.style.width=Ho,G.scrollTop=xe,G.scrollLeft=ut;}},[Z]),Pp=react.useCallback(async()=>{await de.exportToPDF(be);},[be]),Mp=react.useCallback(async()=>{await de.exportToExcel(be);},[be]),Ap=react.useCallback(()=>{let S=de.exportToCSV(be),E=new Blob([S],{type:"text/csv;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(E),G.download="gantt-chart.csv",G.click(),URL.revokeObjectURL(G.href);},[be]),Ip=react.useCallback(()=>{let S=de.exportToJSON(be),E=new Blob([S],{type:"application/json;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(E),G.download="gantt-chart.json",G.click(),URL.revokeObjectURL(G.href);},[be]),Fp=react.useCallback(()=>{de.exportToMSProject(be,"Gantt Project","project.xml");},[be]),Lp=S=>{S.preventDefault(),bt(true);},Ur=react.useRef(false);return react.useEffect(()=>{let S=We.current,E=Ve.current?.querySelector(".gantt-grid-scroll");if(!S||!E)return;let G=()=>{if(Ur.current)return;Ur.current=true;let ut=S.scrollTop;at(ut),E.scrollTop=ut,requestAnimationFrame(()=>{Ur.current=false;});},oe=()=>{if(Ur.current)return;Ur.current=true;let ut=E.scrollTop;at(ut),S.scrollTop=ut,requestAnimationFrame(()=>{Ur.current=false;});},me=ut=>{if(Pt&&E){let oa=E.parentElement?.getBoundingClientRect()?.left||0,na=ut.clientX-oa,ga=200,tr=Re+Y,Ho=window.innerWidth*re,vr=Math.max(tr,Ho);na>=ga&&na<=vr&&O(na);}},xe=()=>{bt(false);};return S.addEventListener("scroll",G),E.addEventListener("scroll",oe),document.addEventListener("mousemove",me),document.addEventListener("mouseup",xe),()=>{S.removeEventListener("scroll",G),E.removeEventListener("scroll",oe),document.removeEventListener("mousemove",me),document.removeEventListener("mouseup",xe);}},[Pt,Re]),jsxRuntime.jsx(ao.Provider,{value:Fe,children:jsxRuntime.jsx(as.Provider,{value:Le,children:jsxRuntime.jsxs("div",{ref:U,className:"flex flex-col h-full w-full",style:{backgroundColor:Z.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(pn,{theme:Z,timeScale:$,onTimeScaleChange:ke,zoom:we,onZoomChange:Je,currentTheme:J,onThemeChange:$e,rowDensity:Ae,onRowDensityChange:He,showThemeSelector:m,showCreateTaskButton:k,createTaskLabel:u,onCreateTask:y,onExportPNG:d?Ep:void 0,onExportPDF:d?Pp:void 0,onExportExcel:d?Mp:void 0,onExportCSV:d?Ap:void 0,onExportJSON:d?Ip:void 0,onExportMSProject:d?Fp:void 0}),jsxRuntime.jsxs("div",{ref:Ve,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:Pe,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(fn,{tasks:it,theme:Z,rowHeight:Va,availableUsers:l,templates:kt,onTaskClick:D,onTaskDblClick:il,onTaskContextMenu:M,onTaskToggle:po,scrollTop:Be,columns:Ie,onToggleColumn:br,onColumnResize:Qa,onTaskUpdate:ce,onTaskIndent:Mt,onTaskOutdent:ea,onTaskMove:Wo,onMultiTaskDelete:er,onTaskDuplicate:ja,onTaskCreate:yr,onTaskRename:$t,onCreateSubtask:mo,onOpenTaskModal:D?S=>D(S):void 0,onDeleteRequest:(S,E)=>wt({taskId:S,taskName:E}),onTaskReparent:$r})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Z.border,zIndex:15},onMouseDown:Lp}),jsxRuntime.jsx("div",{ref:We,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Cn,{tasks:it,theme:Z,rowHeight:Va,timeScale:$,startDate:Np,endDate:Sp,zoom:we,templates:kt,onTaskClick:D,onTaskDblClick:il,onTaskContextMenu:sl,onTaskDateChange:jn,onDependencyCreate:dl,onDependencyDelete:cl})})]}),ie.task&&jsxRuntime.jsx(ro,{isOpen:ie.isOpen,x:ie.x,y:ie.y,theme:Z,onClose:()=>ge({isOpen:false,x:0,y:0,task:null}),items:(()=>{let S=ie.task;if(!S)return [];let E=de.findTaskById(be,S.id)||S;return E.subtasks&&E.subtasks.length>0?[{id:"addSubtask",label:Fe.contextMenu?.addSubtask||"Add Subtask",icon:St.Add,onClick:()=>{C?C(E):mo(E.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Fe.contextMenu?.deleteTask||"Delete Task",icon:St.Delete,onClick:()=>{wt({taskId:E.id,taskName:E.name});}}]:[{id:"edit",label:Fe.contextMenu?.editTask||"Edit Task",icon:St.Pencil,onClick:()=>{N?N(E):Me(E);}},{id:"addSubtask",label:Fe.contextMenu?.addSubtask||"Add Subtask",icon:St.Add,onClick:()=>{C?C(E):mo(E.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:Fe.contextMenu?.markIncomplete||"Mark Incomplete",icon:St.MarkIncomplete,onClick:()=>{W?W(E):ce(E.id,{status:"todo",progress:0});},disabled:E.status==="todo"},{id:"setInProgress",label:Fe.contextMenu?.setInProgress||"Set In Progress",icon:St.SetInProgress,onClick:()=>{I?I(E):ce(E.id,{status:"in-progress"});},disabled:E.status==="in-progress"},{id:"markComplete",label:Fe.contextMenu?.markComplete||"Mark Complete",icon:St.MarkComplete,onClick:()=>{ce(E.id,{status:"completed",progress:100});},disabled:E.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:Fe.contextMenu?.splitTask||"Split Task",icon:St.Split,onClick:()=>{if(!E.startDate||!E.endDate){console.warn("Cannot split task without dates");return}let oe=E.startDate.getTime(),me=E.endDate.getTime(),xe=oe+(me-oe)/2,ut=new Date(xe);uo(E,ut);},disabled:!E.startDate||!E.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Fe.contextMenu?.deleteTask||"Delete Task",icon:St.Delete,onClick:()=>{wt({taskId:E.id,taskName:E.name});}}]})()}),De&&jsxRuntime.jsx(Dn,{isOpen:true,onClose:()=>Me(null),task:De,onSubmit:S=>{ce(De.id,S),Me(null);},mode:"edit",theme:J}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:st&&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:()=>wt(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:Z.bgSecondary,border:`1px solid ${Z.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Z.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:Z.textPrimary,fontFamily:"Inter, sans-serif"},children:[Fe.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Z.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:Z.textSecondary,fontFamily:"Inter, sans-serif"},children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Z.textPrimary},children:['"',st.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Z.bgPrimary,borderTop:`1px solid ${Z.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>wt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Z.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=Z.hoverBg;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{er([st.taskId]),wt(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"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),c?.enabled&&jsxRuntime.jsx(Nn,{tasks:be,theme:Z,config:c,onTasksUpdate:Ne,onTaskUpdate:ce,onTaskCreate:S=>{Ne(E=>[...E,S]);},onTaskDelete:S=>{er([S]);},onDependencyCreate:(S,E)=>{let G=de.findTaskById(be,S);G&&dl(G,E);},onDependencyDelete:cl})]})})})});var uc=`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
@@ -383,13 +383,13 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
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
385
  If ambiguous, ask for clarification in the message field.`;function gc(e){return `CURRENT TASKS:
386
- ${fc(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",l=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${l}`}).join(`
386
+ ${fc(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",i=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${i}`}).join(`
387
387
  `)}
388
388
 
389
- Today's date: ${new Date().toISOString().split("T")[0]}`}function fc(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Xa(e,t){let a=fc(e),r=t.toLowerCase().trim(),o=a.find(p=>p.name.toLowerCase()===r);if(o)return o;let s=a.find(p=>p.name.toLowerCase().includes(r));if(s)return s;let l=r.split(/\s+/);return a.find(p=>{let m=p.name.toLowerCase();return l.every(n=>m.includes(n))})}function gi(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let i=new Date(r);return i.setDate(i.getDate()+1),i}if(a==="yesterday"||a==="ayer"){let i=new Date(r);return i.setDate(i.getDate()-1),i}if(a==="next week"||a==="la pr\xF3xima semana"){let i=new Date(r);return i.setDate(i.getDate()+7),i}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let u={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(u!==void 0){let f=new Date(r),h=f.getDay(),g=u-h;return g<=0&&(g+=7),f.setDate(f.getDate()+g),f}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let i=parseInt(s[1],10),u=s[2].toLowerCase(),f=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?f.setDate(f.getDate()+i):u==="week"||u==="semana"||u==="semanas"?f.setDate(f.getDate()+i*7):(u==="month"||u==="mes"||u==="meses")&&f.setMonth(f.getMonth()+i),f}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let p=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(p&&p[1]&&p[2]&&p[3]){let i=parseInt(p[1],10),u=parseInt(p[2],10)-1,f=parseInt(p[3],10);return new Date(f,u,i)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},n=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(n&&n[1]&&n[2]){let i=parseInt(n[1],10),u=m[n[2].toLowerCase()],f=n[3]?parseInt(n[3],10):r.getFullYear();if(u!==void 0)return new Date(f,u,i)}let d={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},c=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(c&&c[1]&&c[2]){let i=d[c[1].toLowerCase()],u=parseInt(c[2],10),f=c[3]?parseInt(c[3],10):r.getFullYear();if(i!==void 0)return new Date(f,i,u)}return null}function fi(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 hi(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 hc(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 bc(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let n=r[1].trim(),d=r[2].trim(),c=Xa(t,n),i=gi(d);if(!c)return {type:"move_task",taskName:n,message:`Could not find a task named "${n}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!i)return {type:"move_task",taskId:c.id,taskName:c.name,message:`Could not parse the date "${d}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=c.startDate&&c.endDate?Math.round((c.endDate.getTime()-c.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(i);return f.setDate(f.getDate()+u),{type:"move_task",taskId:c.id,taskName:c.name,updates:{startDate:i,endDate:f},message:`Moved "${c.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let n=o[1].trim(),d=o[2].trim(),c=Xa(t,n),i=fi(d);if(!c)return {type:"resize_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"};if(!i||!c.endDate)return {type:"resize_task",taskId:c.id,taskName:c.name,message:`Could not parse the duration "${d}".`,success:false,error:"Invalid duration"};let u=new Date(c.endDate);return u.setDate(u.getDate()+i),{type:"resize_task",taskId:c.id,taskName:c.name,updates:{endDate:u},message:`Extended "${c.name}" by ${i} days. New end date: ${u.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let n=s[1].trim(),d=s[2].trim(),c=Xa(t,n),i=hi(d);return c?i===null?{type:"set_progress",taskId:c.id,taskName:c.name,message:`Could not parse the progress value "${d}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:c.id,taskName:c.name,updates:{progress:i},message:`Set "${c.name}" progress to ${i}%.`,success:true}:{type:"set_progress",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let l=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let n=l[1].trim(),d=l[2].trim(),c=Xa(t,n);return c?{type:"rename_task",taskId:c.id,taskName:c.name,updates:{name:d},message:`Renamed "${c.name}" to "${d}".`,success:true}:{type:"rename_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let p=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]&&p[2]){let n=p[1].trim(),d=p[2].trim(),c=Xa(t,n),i=Xa(t,d);return c?i?{type:"link_tasks",taskId:i.id,taskName:i.name,dependencyFrom:c.id,dependencyTo:i.id,message:`Linked "${c.name}" \u2192 "${i.name}".`,success:true}:{type:"link_tasks",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let n=m[1].trim(),d=Xa(t,n);return d?{type:"delete_task",taskId:d.id,taskName:d.name,message:`Deleted "${d.name}".`,success:true}:{type:"delete_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}return null}function yc(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 y0(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 v0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function En(e,t=[],a=[]){let r=e.assignedUserIds?.map(d=>{let c=a.find(i=>i.id===d);return c?{name:c.name,initials:c.initials,color:c.color}:null}).filter(d=>d!==null),o=t.filter(d=>d.metadata?.parentCardId===e.id).map(d=>En(d,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(d=>d.type==="finish-to-start").map(d=>d.taskId));let l=d=>{if(d)return typeof d=="string"?new Date(d):d},p=l(e.startDate),m=l(e.endDate),n=e.metadata?.isMilestone===true||p&&m&&Math.abs(m.getTime()-p.getTime())<=864e5;return {id:e.id,name:e.title,startDate:p,endDate:m,progress:e.progress||0,status:y0(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:n,isCriticalPath:e.metadata?.isCriticalPath===true}}function vc(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:v0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function xc(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>En(r,e,t))}var bi={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"}},yi={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"}},Pn={en:bi,es:yi};function vi(e){return Pn[e]||Pn.en}function Mn(e,t){let a=vi(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 Tc(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(...Tc(r.subtasks,t+1));return a}function M0({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 Dc({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:l}){let{theme:p="dark",locale:m="en",customTranslations:n,showSearch:d=true,showHierarchy:c=true}=t,i=Mn(m,n),u=p==="dark",[f,h]=react.useState(new Set),[g,w]=react.useState("startDate"),[b,v]=react.useState("asc"),[x,T]=react.useState("");react.useMemo(()=>{let N=new Set;function C(H){for(let I of H)I.subtasks?.length&&(N.add(I.id),C(I.subtasks));}C(e),h(N);},[e]);let D=react.useCallback(N=>{h(C=>{let H=new Set(C);return H.has(N)?H.delete(N):H.add(N),H}),a.onTaskToggleExpand?.(N);},[a]),M=react.useCallback(N=>{g===N?v(C=>C==="asc"?"desc":"asc"):(w(N),v("asc")),a.onSortChange?.({column:N,direction:b==="asc"?"desc":"asc"});},[g,b,a]),k=react.useMemo(()=>{let N=Tc(e);if(x.trim()){let H=x.toLowerCase();N=N.filter(I=>I.name.toLowerCase().includes(H));}let C=[];for(let H of N){let I=H.level===0;H.level>0&&(I=true),(I||x.trim())&&C.push(H);}return x.trim()&&C.sort((H,I)=>{let K,j;switch(g){case "name":K=H.name.toLowerCase(),j=I.name.toLowerCase();break;case "startDate":K=H.startDate?.getTime()||0,j=I.startDate?.getTime()||0;break;case "endDate":K=H.endDate?.getTime()||0,j=I.endDate?.getTime()||0;break;case "progress":K=H.progress||0,j=I.progress||0;break;case "status":K=H.status||"todo",j=I.status||"todo";break;default:return 0}return K<j?b==="asc"?-1:1:K>j?b==="asc"?1:-1:0}),C},[e,x,g,b]),B=N=>N?(N instanceof Date?N:new Date(N)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:y("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:y("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:y("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:y("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsxRuntime.jsx("p",{className:y("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:y("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",s),style:l,children:[jsxRuntime.jsx("div",{className:y("flex-shrink-0 px-6 py-4 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[d&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:y("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:x,onChange:N=>T(N.target.value),placeholder:i.toolbar.searchPlaceholder,className:y("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",u?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsxs("div",{className:y("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[k.length," ",i.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:y("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",u?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>M("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>M("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>M("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>M("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>M("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k.map((N,C)=>{let H=f.has(N.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:C*.02},className:y("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",u?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:c?`${24+N.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(N),onDoubleClick:()=>a.onTaskDoubleClick?.(N),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[c&&N.hasChildren&&jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),D(N.id);},className:y("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:H?jsxRuntime.jsx(lucideReact.ChevronDown,{className:y("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:y("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),c&&!N.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),a.onTaskUpdate?.({...N,progress:N.progress===100?0:100,status:N.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(M0,{status:N.status,progress:N.progress})}),jsxRuntime.jsx("span",{className:y("truncate",u?"text-white":"text-gray-900",N.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:N.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:y("px-2 py-1 rounded-full text-xs font-medium",N.progress===100||N.status==="completed"?"bg-green-500/10 text-green-500":N.progress&&N.progress>0||N.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:N.progress===100||N.status==="completed"?i.status.completed:N.progress&&N.progress>0||N.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxRuntime.jsxs("div",{className:y("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),B(N.startDate)]}),jsxRuntime.jsxs("div",{className:y("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),B(N.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:y("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:y("h-full rounded-full transition-all",N.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${N.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:y("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[N.progress||0,"%"]})]})})]},N.id)})}),k.length===0&&x&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:y("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:y(u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var xi={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"},ki={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"},wi={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"},In={dark:xi,light:ki,neutral:wi};function Nc(e){return In[e]||In.dark}var Ci={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"}},Ti={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"}},Ln={en:Ci,es:Ti};function Lo(e){return Ln[e]||Ln.en}function Fn(e,t){let a=Lo(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 Sc(e){let t=Lo(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 Ec(e,t=0,a=true){let r=Lo(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 G0(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 Pi(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 Ac({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 Lc({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:l,style:p}){let{theme:m="dark",locale:n="en",customTranslations:d}=t,c=Fn(n,d),i=m==="dark",[u,f]=react.useState(r||new Date),[h,g]=react.useState(null),[w,b]=react.useState(null),[v,x]=react.useState(null),[T,D]=react.useState(new Date),[M,k]=react.useState({}),B=4,N=3,[C,H]=react.useState(false),[I,K]=react.useState(false),[j,$]=react.useState(false),[Z,ce]=react.useState(null),[he,R]=react.useState(""),[A,O]=react.useState(void 0),[P,X]=react.useState(null),[Y,U]=react.useState(false),[Se,Te]=react.useState(false),[He,xe]=react.useState(null),[at,Le]=react.useState(false),[et,vt]=react.useState(new Date),Pt=react.useCallback(()=>{f(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),ct=react.useCallback(()=>{f(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),z=react.useCallback(()=>{f(new Date);},[]),se=react.useMemo(()=>{let L=u.getFullYear(),Q=u.getMonth(),_e=new Date(L,Q,1),Ge=new Date(L,Q+1,0),kt=_e.getDay(),ae=Ge.getDate(),ie=G0(e),we=new Date;we.setHours(0,0,0,0);let De=[],le=kt,Pe=new Date(L,Q,0).getDate();for(let Ee=le-1;Ee>=0;Ee--){let pe=new Date(L,Q-1,Pe-Ee);De.push({date:pe,isCurrentMonth:false,isToday:false,isWeekend:pe.getDay()===0||pe.getDay()===6,events:ie.filter(ze=>Pi(pe,ze)).map(ze=>({id:ze.id,title:ze.name,start:ze.startDate,end:ze.endDate,task:ze}))});}for(let Ee=1;Ee<=ae;Ee++){let pe=new Date(L,Q,Ee),ze=pe.getTime()===we.getTime();De.push({date:pe,isCurrentMonth:true,isToday:ze,isWeekend:pe.getDay()===0||pe.getDay()===6,events:ie.filter(Be=>Pi(pe,Be)).map(Be=>({id:Be.id,title:Be.name,start:Be.startDate,end:Be.endDate,task:Be}))});}let ke=42-De.length;for(let Ee=1;Ee<=ke;Ee++){let pe=new Date(L,Q+1,Ee);De.push({date:pe,isCurrentMonth:false,isToday:false,isWeekend:pe.getDay()===0||pe.getDay()===6,events:ie.filter(ze=>Pi(pe,ze)).map(ze=>({id:ze.id,title:ze.name,start:ze.startDate,end:ze.endDate,task:ze}))});}return De},[u,e]),fe=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Ne=u.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Ae=react.useCallback((L,Q)=>{if(!h)return;let _e={...h,[L]:Q};g(_e),a.onTaskUpdate?.(_e);},[h,a]),rt=react.useCallback(L=>{if(!h)return;let Q=h.progress||0;L==="completed"?Q=100:L==="todo"&&(Q=0);let _e={...h,status:L,progress:Q};g(_e),a.onTaskUpdate?.(_e),H(false);},[h,a]),ft=react.useCallback((L,Q)=>{if(!h)return;let _e={...h,startDate:L,endDate:Q};g(_e),a.onTaskUpdate?.(_e);},[h,a]),Re=react.useCallback(()=>{H(false),K(false),x(null);},[]);return o?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:p,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:y("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[c.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:p,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:y("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:y("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:p,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:y("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:c.labels.noEvents}),jsxRuntime.jsx("p",{className:y("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:c.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:y("flex-1 flex flex-col w-full h-full overflow-auto",i?"bg-[#0F1117]":"bg-white",l),style:p,children:[jsxRuntime.jsx("div",{className:y("flex-shrink-0 px-6 py-4 border-b",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:y("text-xl font-semibold capitalize",i?"text-white":"text-gray-900"),children:Ne}),jsxRuntime.jsx("button",{onClick:z,className:y("px-3 py-1.5 text-sm rounded-lg transition-colors",i?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:c.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Pt,className:y("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:y("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:ct,className:y("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:y("w-5 h-5",i?"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:fe.map(L=>jsxRuntime.jsx("div",{className:y("py-2 text-center text-xs font-medium uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:L},L))}),jsxRuntime.jsx("div",{className:y("grid grid-cols-7 auto-rows-min gap-px rounded-lg",i?"bg-[#2D2D2D]":"bg-gray-300"),children:se.map((L,Q)=>{let _e=L.date.getDay()===0||L.date.getDay()===6;return jsxRuntime.jsxs("div",{className:y("min-h-[120px] p-2 transition-colors flex flex-col relative group",i?_e?"bg-[#1C1F26]":L.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":_e?"bg-gray-100":L.isCurrentMonth?"bg-white":"bg-gray-50",L.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ge=M[Q]||B,kt=L.events.slice(0,Ge),ae=L.events.length-Ge;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[kt.map(ie=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{g(ie.task),a.onEventClick?.(ie);},whileHover:{scale:1.02},className:y("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",ie.task.progress===100?i?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":i?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Ac,{task:ie.task}),jsxRuntime.jsx("span",{className:"truncate",children:ie.title})]})},ie.id)),ae>0&&jsxRuntime.jsxs("button",{onClick:ie=>{ie.stopPropagation(),k(we=>({...we,[Q]:Ge+N}));},className:y("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",ae," ",n==="es"?"M\xC1S":"MORE"]}),Ge>B&&L.events.length>B&&jsxRuntime.jsx("button",{onClick:ie=>{ie.stopPropagation(),k(we=>({...we,[Q]:B}));},className:y("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ge=Q>=28,kt=Q%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:ae=>{ae.stopPropagation(),Z===Q?ce(null):(ce(Q),R(""),O(void 0),X(null),xe(null),U(false),Te(false),Le(false),vt(L.date));},className:y("w-5 h-5 rounded flex items-center justify-center transition-all",Z===Q?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",i?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:y("w-3.5 h-3.5 transition-transform",Z===Q&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Z===Q&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ce(null),R(""),O(void 0),X(null),xe(null),U(false),Te(false),Le(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:y("absolute w-[320px] rounded-lg shadow-2xl z-50",Ge?"bottom-full mb-1":"top-full mt-1",kt?"right-0":"left-0",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ae=>{ae.stopPropagation(),U(false),Te(false),Le(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:he,onChange:ae=>R(ae.target.value),placeholder:n==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:y("w-full bg-transparent text-sm outline-none placeholder:opacity-40",i?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:ae=>{if(ae.key==="Enter"&&he.trim()){let ie=t.availableUsers?.find(De=>De.id===P),we=He||L.date;a.onTaskCreate?.({name:he.trim(),startDate:we,endDate:we,priority:A,assignees:ie?[ie]:void 0}),R(""),O(void 0),X(null),xe(null),ce(null);}ae.key==="Escape"&&(ce(null),R(""),O(void 0),X(null),xe(null));}})}),jsxRuntime.jsxs("div",{className:y("px-2.5 py-2 flex items-center justify-between border-t",i?"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:ae=>{ae.stopPropagation(),U(!Y),Te(false);},className:y("p-1 rounded transition-colors",A?A==="urgent"||A==="high"?"text-red-400 bg-red-500/20":A==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":i?"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:Y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ae=>ae.stopPropagation(),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(ae=>jsxRuntime.jsxs("button",{onClick:()=>{O(ae.id),U(false);},className:y("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",A===ae.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:y("w-2 h-2 rounded-full",ae.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:ae.label})]},ae.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:ae=>{ae.stopPropagation(),Le(!at),U(false),Te(false),vt(He||L.date);},className:y("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",He?"bg-[#7C3AED]/20 text-[#7C3AED]":i?"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"}),(He||L.date).toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:at&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ae=>ae.stopPropagation(),children:[jsxRuntime.jsx("div",{className:y("w-40 py-2 border-r",i?"border-white/10":"border-gray-200"),children:(()=>{let ae=new Date,ie=new Date(ae);ie.setDate(ae.getDate()+1);let we=new Date(ae);we.setDate(ae.getDate()+((6-ae.getDay()+7)%7||7));let De=new Date(ae);De.setDate(ae.getDate()+((1-ae.getDay()+7)%7||7));let le=new Date(ae);le.setDate(ae.getDate()+14);let Pe=new Date(ae);return Pe.setDate(ae.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:ae,display:ae.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ie,display:ie.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:we,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:De,display:n==="es"?"lun.":"mon."},{label:n==="es"?"2 semanas":"2 weeks",date:le,display:le.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Pe,display:Pe.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ee,pe)=>jsxRuntime.jsxs("button",{className:y("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{xe(Ee.date),Le(false);},children:[jsxRuntime.jsx("span",{children:Ee.label}),jsxRuntime.jsx("span",{className:y("text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:Ee.display})]},pe))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:y("text-xs font-medium",i?"text-white":"text-gray-900"),children:et.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>vt(new Date),className:y("px-1.5 py-0.5 rounded text-[10px] transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>vt(new Date(et.getFullYear(),et.getMonth()-1)),className:y("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>vt(new Date(et.getFullYear(),et.getMonth()+1)),className:y("p-0.5 rounded",i?"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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(ae=>jsxRuntime.jsx("div",{className:y("w-6 h-6 flex items-center justify-center text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:ae},ae))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ae=et.getFullYear(),ie=et.getMonth(),we=new Date(ae,ie,1).getDay(),De=new Date(ae,ie+1,0).getDate(),le=new Date(ae,ie,0).getDate(),Pe=new Date,ke=[];for(let pe=we-1;pe>=0;pe--)ke.push({dayNum:le-pe,isCurrentMonth:false,date:new Date(ae,ie-1,le-pe)});for(let pe=1;pe<=De;pe++)ke.push({dayNum:pe,isCurrentMonth:true,date:new Date(ae,ie,pe)});let Ee=42-ke.length;for(let pe=1;pe<=Ee;pe++)ke.push({dayNum:pe,isCurrentMonth:false,date:new Date(ae,ie+1,pe)});return ke.map((pe,ze)=>{let Be=pe.date.toDateString()===Pe.toDateString(),Ye=(He||L.date).toDateString()===pe.date.toDateString();return jsxRuntime.jsx("button",{className:y("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!pe.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),pe.isCurrentMonth&&(i?"text-white":"text-gray-900"),Be&&"ring-1 ring-[#3B82F6]",Ye&&"bg-[#7C3AED] text-white",!Ye&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{xe(pe.date),Le(false);},children:pe.dayNum},ze)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:ae=>{ae.stopPropagation(),Te(!Se),U(false);},className:y("p-1 rounded transition-colors",P?"text-[#7C3AED] bg-[#7C3AED]/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:P?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(ae=>ae.id===P)?.color||"#7C3AED"},children:t.availableUsers?.find(ae=>ae.id===P)?.initials||t.availableUsers?.find(ae=>ae.id===P)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Se&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ae=>ae.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{X(null),Te(false);},className:y("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",!P&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:y("w-5 h-5 rounded-full flex items-center justify-center",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:i?"text-[#9CA3AF]":"text-gray-500",children:n==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(ae=>jsxRuntime.jsxs("button",{onClick:()=>{X(ae.id),Te(false);},className:y("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",P===ae.id&&(i?"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:ae.color||"#7C3AED"},children:ae.initials||ae.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:ae.name})]},ae.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:y("px-3 py-2 text-xs",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(he.trim()){let ae=t.availableUsers?.find(we=>we.id===P),ie=He||L.date;a.onTaskCreate?.({name:he.trim(),startDate:ie,endDate:ie,priority:A,assignees:ae?[ae]:void 0}),R(""),O(void 0),X(null),xe(null),ce(null);}},disabled:!he.trim(),className:y("px-2.5 py-1 rounded text-xs font-medium transition-colors",he.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":i?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:n==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:y("text-sm font-medium",L.isToday?"text-[#3B82F6]":L.isCurrentMonth?i?"text-white":"text-gray-900":i?"text-[#6B7280]":"text-gray-400"),children:L.date.getDate()})]})]},Q)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>g(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:y("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:y("px-6 py-3 border-b flex items-center gap-3",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:y("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:y("text-xs px-2 py-0.5 rounded",i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:y("text-xs font-mono",i?"text-[#6B7280]":"text-gray-400"),children:h.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:y("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",i?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:y("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:y("p-1.5 rounded transition-colors",i?"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:()=>g(null),className:y("p-1.5 rounded transition-colors",i?"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 L=h.progress===100?0:100,_e={...h,progress:L,status:L===100?"completed":"todo"};g(_e),a.onTaskUpdate?.(_e);},className:y("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",h.progress===100?"bg-green-500 border-green-500":i?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:h.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:y("text-xl font-semibold flex-1",h.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:h.name})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Re(),H(!C);},className:y("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",h.progress===100||h.status==="completed"?"bg-green-500/20 text-green-400":h.progress&&h.progress>0||h.status==="in-progress"?"bg-blue-500/20 text-blue-400":i?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:h.progress===100||h.status==="completed"?n==="es"?"COMPLETADO":"DONE":h.progress&&h.progress>0||h.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>H(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(L=>jsxRuntime.jsxs("button",{onClick:()=>rt(L.id),className:y("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",(h.status===L.id||L.id==="completed"&&h.progress===100||L.id==="in-progress"&&h.progress&&h.progress>0&&h.progress<100||L.id==="todo"&&(!h.progress||h.progress===0)&&h.status!=="in-progress"&&h.status!=="completed")&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:y("w-2 h-2 rounded-full",L.id==="completed"?"bg-green-500":L.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:L.label})]},L.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),h.assignees&&h.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[h.assignees.slice(0,3).map((L,Q)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:L.color||"#8B5CF6"},title:L.name,children:L.initials||L.name.slice(0,2).toUpperCase()},Q)),h.assignees.length>3&&jsxRuntime.jsxs("span",{className:y("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:["+",h.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:y("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{x(v?null:"start"),D(h.startDate||new Date);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[h.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:y("mx-1",i?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),h.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(h.startDate||h.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:L=>{L.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>x(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:y("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:L=>L.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:y("w-44 py-2 border-r",i?"border-white/10":"border-gray-200"),children:[(()=>{let L=new Date,Q=new Date(L);Q.setDate(L.getDate()+1);let _e=new Date(L);_e.setDate(L.getDate()+((6-L.getDay()+7)%7||7));let Ge=new Date(L);Ge.setDate(L.getDate()+((1-L.getDay()+7)%7||7));let kt=new Date(L);kt.setDate(L.getDate()+(6-L.getDay()+7)%7+7);let ae=new Date(L);ae.setDate(L.getDate()+14);let ie=new Date(L);return ie.setDate(L.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:L,display:L.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:_e,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ge,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:kt,display:kt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:ae,display:ae.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:ie,display:ie.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((De,le)=>jsxRuntime.jsxs("button",{className:y("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(v==="start"){let Pe=h.endDate&&De.date>h.endDate?De.date:h.endDate;ft(De.date,Pe),x("end");}else {let Pe=h.startDate&&De.date<h.startDate?De.date:h.startDate;ft(Pe,De.date),x(null);}},children:[jsxRuntime.jsx("span",{children:De.label}),jsxRuntime.jsx("span",{className:y("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:De.display})]},le))})(),jsxRuntime.jsx("div",{className:y("border-t mt-2 pt-2",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{ft(void 0,void 0),x(null);},className:y("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:y("text-xs mb-3 px-2 py-1 rounded",i?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:v==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:y("font-medium",i?"text-white":"text-gray-900"),children:T.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:()=>D(new Date),className:y("p-1 rounded text-sm transition-colors",i?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>D(new Date(T.getFullYear(),T.getMonth()-1)),className:y("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>D(new Date(T.getFullYear(),T.getMonth()+1)),className:y("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(L=>jsxRuntime.jsx("div",{className:y("w-8 h-8 flex items-center justify-center text-xs",i?"text-[#6B7280]":"text-gray-400"),children:L},L))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let L=T.getFullYear(),Q=T.getMonth(),_e=new Date(L,Q,1).getDay(),Ge=new Date(L,Q+1,0).getDate(),kt=new Date(L,Q,0).getDate(),ae=new Date,ie=[];for(let De=_e-1;De>=0;De--)ie.push({day:kt-De,isCurrentMonth:false,date:new Date(L,Q-1,kt-De)});for(let De=1;De<=Ge;De++)ie.push({day:De,isCurrentMonth:true,date:new Date(L,Q,De)});let we=42-ie.length;for(let De=1;De<=we;De++)ie.push({day:De,isCurrentMonth:false,date:new Date(L,Q+1,De)});return ie.map((De,le)=>{let Pe=De.date.toDateString()===ae.toDateString(),ke=h.startDate?.toDateString()===De.date.toDateString(),Ee=h.endDate?.toDateString()===De.date.toDateString(),pe=ke||Ee,ze=h.startDate&&h.endDate&&De.date>=h.startDate&&De.date<=h.endDate;return jsxRuntime.jsx("button",{className:y("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!De.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),De.isCurrentMonth&&(i?"text-white":"text-gray-900"),Pe&&"ring-2 ring-[#3B82F6]",ke&&"bg-[#3B82F6] text-white",Ee&&!ke&&"bg-[#7C3AED] text-white",ze&&!pe&&(i?"bg-[#7C3AED]/20":"bg-purple-100"),!pe&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let Be=new Date(De.date);if(v==="start"){let Ye=h.endDate&&Be>h.endDate?Be:h.endDate;ft(Be,Ye),x("end");}else {let Ye=h.startDate&&Be<h.startDate?Be:h.startDate;ft(Ye,Be),x(null);}},children:De.day},le)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Re(),K(!I);},className:y("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",h.priority==="high"||h.priority==="urgent"?"bg-red-500/20 text-red-400":h.priority==="medium"?"bg-yellow-500/20 text-yellow-400":h.priority==="low"?"bg-green-500/20 text-green-400":i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:h.priority?h.priority==="high"||h.priority==="urgent"?n==="es"?"Urgente":"Urgent":h.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>K(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"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(L=>jsxRuntime.jsxs("button",{onClick:()=>{Ae("priority",L.id),K(false);},className:y("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",h.priority===L.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:y("w-2 h-2 rounded-full",L.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:L.label})]},L.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:y("text-sm",i?"text-white":"text-gray-900"),children:h.startDate&&h.endDate?`${Math.ceil((h.endDate.getTime()-h.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:y("w-4 h-4 rounded-full border-2",i?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[j?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:h.progress||0,onChange:L=>{let Q=parseInt(L.target.value),_e=h.status;Q===100?_e="completed":Q>0?_e="in-progress":_e="todo";let Ge={...h,progress:Q,status:_e};g(Ge),a.onTaskUpdate?.(Ge);},onBlur:()=>$(false),className:y("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",i?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>$(true),className:y("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:y("h-full rounded-full transition-all",h.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${h.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:y("text-sm font-medium min-w-[40px]",i?"text-white":"text-gray-900"),children:[h.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:y("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Vac\xEDo":"Empty"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:y("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:h.dependencies&&h.dependencies.length>0?`${h.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:y("flex items-center gap-2 text-sm transition-colors",i?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),n==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:y("flex items-center gap-2 text-sm mt-2 transition-colors",i?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Agregar subtarea":"Add subtask"}),h.subtasks&&h.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:h.subtasks.map(L=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:y("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",L.progress===100?"bg-green-500 border-green-500":i?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:L.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:y("text-sm",L.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:L.name})]},L.id))}),jsxRuntime.jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"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"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold",i?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:y("p-1 rounded transition-colors",i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:y("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",i?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:y("w-6 h-6 mx-auto mb-2",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("p",{className:y("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Suelta tus archivos aqu\xED para ":"Drop your files here to ",jsxRuntime.jsx("span",{className:y("underline",i?"text-white":"text-gray-700"),children:n==="es"?"subir":"upload"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:y("w-[280px] border-l flex flex-col",i?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:y("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:y("font-medium",i?"text-white":"text-gray-900"),children:n==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:y("text-sm text-center py-8",i?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),n==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:y("p-3 border-t",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:y("flex items-center gap-2 px-3 py-2 rounded-lg",i?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",className:y("flex-1 bg-transparent text-sm outline-none",i?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>b(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:y("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:y("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:y("font-medium",i?"text-white":"text-gray-900"),children:w.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>b(null),className:y("p-1 rounded",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:w.events.map(L=>jsxRuntime.jsxs("button",{onClick:()=>{b(null),g(L.task);},className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",i?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Ac,{task:L.task}),jsxRuntime.jsx("span",{className:y("text-sm truncate flex-1",i?"text-white":"text-gray-900"),children:L.title}),L.task.priority==="high"||L.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},L.id))})]})]})})]})}var Mi={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"},Ai={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"},Ii={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"},zn={dark:Mi,light:Ai,neutral:Ii};function Fc(e){return zn[e]||zn.dark}function V0({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:l,className:p}){let[m,n]=react.useState(false),d=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),c=react.useMemo(()=>{let u=d.length,f=new Set(d.flatMap(w=>w.assignedUserIds||[])).size,h=d.map(w=>w.priority).filter(Boolean),g=new Set(d.flatMap(w=>w.labels||[])).size;return {totalCards:u,uniqueAssignees:f,priorities:h,labels:g}},[d]),i=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:y("card-stack",!e.isExpanded&&"card-stack-collapsed",p),onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:i,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:y("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:c.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:u=>{u.stopPropagation(),l?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[c.uniqueAssignees," assignees"]})]}),c.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:[c.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:d.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:d.map(u=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(u),children:a(u)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(u),children:[jsxRuntime.jsx("h4",{children:u.title}),u.description&&jsxRuntime.jsxs("p",{children:[u.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,u.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},u.id))})})]})}var Rc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Fo(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 Bo(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 Oc(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 zc({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:l,className:p}){let m=react.useMemo(()=>({...Rc,...l}),[l]),[n,d]=react.useState(new Set),c=react.useRef(null),i=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(v=>{let x=v.timestamp.toISOString().split("T")[0],T=b.get(x);T?T.push(v):b.set(x,[v]);}),Array.from(b.entries()).sort((v,x)=>x[0].localeCompare(v[0])).map(([v,x])=>({date:new Date(v),events:x.sort((T,D)=>D.timestamp.getTime()-T.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:u,uniqueTypes:f}=react.useMemo(()=>{let b=new Set,v=new Set;return e.forEach(x=>{b.add(x.userId),v.add(x.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(v)}},[e]),h=b=>{d(v=>{let x=new Set(v);return x.has(b)?x.delete(b):x.add(b),x});},g=b=>{let x=new Date().getTime()-b.getTime(),T=Math.floor(x/6e4),D=Math.floor(x/36e5),M=Math.floor(x/864e5);return T<1?"just now":T<60?`${T}m ago`:D<24?`${D}h ago`:M<7?`${M}d ago`:b.toLocaleDateString()},w=react.useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return react.useEffect(()=>{if(s&&c.current){let b=c.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:y("history-timeline-empty",p),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:y("history-timeline",m.compact&&"compact",p),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let v=b.target.value;a({...t,types:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),f.map(b=>jsxRuntime.jsxs("option",{value:b,children:[Bo(b)," ",b.replace("_"," ")]},b))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let v=b.target.value;a({...t,users:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),u.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),w>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",w,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:c,children:i.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&b.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:b.events.map((v,x)=>{let T=n.has(v.id),D=s===v.id,M=Oc(v.type);return jsxRuntime.jsxs("div",{"data-event-id":v.id,className:y("history-timeline-event",T&&"expanded",D&&"selected"),onClick:()=>o?.(v),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:M},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Bo(v.type)})}),x<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:M}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&v.userAvatar&&jsxRuntime.jsx("img",{src:v.userAvatar,alt:v.userName||v.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:v.userName||v.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Fo(v)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?g(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),h(v.id);},children:[T?"\u25BC":"\u25B6"," Show changes"]}),T&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([k,B])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(B.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(B.to)})]})]},k)),v.metadata&&Object.keys(v.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(v.metadata).map(([k,B])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(B)})]},k))]})]})]})]},v.id)})})]},b.date?.toISOString()||"all"))})]})}function Uc({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:l,onGoToEvent:p,onSpeedChange:m,className:n}){let d=[.5,1,1.5,2,3],c=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),i=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:y("history-replay-empty",n),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:y("history-replay",n),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:c&&Bo(c.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:c&&Fo(c)}),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:c&&c.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:u=>p(parseInt(u.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,f)=>jsxRuntime.jsx("div",{className:y("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>p(f),title:Fo(u)},u.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:l,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:d.map(u=>jsxRuntime.jsxs("button",{className:y("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>m(u),children:[u,"x"]},u))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:c&&c.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(u=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:u},u))})]})]})]})]}):jsxRuntime.jsxs("div",{className:y("history-replay-start",n),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Li(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 Fi(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 Wc(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 Hc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function J0(e,t,a,r,o,s=100){let l=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),p=new Map(l.map(m=>[m.id,m]));for(let m=0;m<s;m++){let n=1-m/s;l.forEach(d=>{let c=a/2,i=r/2;d.vx+=(c-d.x)*o.centerForce*n,d.vy+=(i-d.y)*o.centerForce*n,l.forEach(u=>{if(d.id===u.id)return;let f=d.x-u.x,h=d.y-u.y,g=Math.sqrt(f*f+h*h)||1,w=o.chargeStrength*n/(g*g);d.vx+=f/g*w,d.vy+=h/g*w;});}),t.forEach(d=>{let c=p.get(typeof d.source=="string"?d.source:d.source.id),i=p.get(typeof d.target=="string"?d.target:d.target.id);if(!c||!i)return;let u=i.x-c.x,f=i.y-c.y,h=Math.sqrt(u*u+f*f)||1,g=(h-o.linkDistance)/h*o.forceStrength*n;c.vx+=u*g,c.vy+=f*g,i.vx-=u*g,i.vy-=f*g;}),l.forEach(d=>{d.fx!==null&&d.fx!==void 0?(d.x=d.fx,d.vx=0):d.x+=d.vx,d.fy!==null&&d.fy!==void 0?(d.y=d.fy,d.vy=0):d.y+=d.vy,d.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,d.x)),d.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,d.y)),d.vx*=.9,d.vy*=.9;});}return l}function Gc({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:l,onInteraction:p,className:m}){let n=react.useRef(null),[d,c]=react.useState([]),[i,u]=react.useState(null),[f,h]=react.useState(null),[g,w]=react.useState(null),[b,v]=react.useState(1),[x,T]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let I=J0(e,t,a.width,a.height,a,150);c(I);},[e,t,a]);let D=react.useCallback((I,K)=>{a.enableDragging&&(K.stopPropagation(),u(I));},[a.enableDragging]),M=react.useCallback(I=>{if(!i||!n.current)return;let j=n.current.getBoundingClientRect(),$=(I.clientX-j.left-x.x)/b,Z=(I.clientY-j.top-x.y)/b;c(ce=>ce.map(he=>he.id===i?{...he,x:$,y:Z,fx:$,fy:Z}:he));},[i,b,x]),k=react.useCallback(()=>{u(null);},[]),B=react.useCallback((I,K)=>{K.stopPropagation(),p?.({type:"node-click",node:I,position:{x:K.clientX,y:K.clientY}});},[p]),N=react.useCallback((I,K)=>{K.stopPropagation(),p?.({type:"edge-click",edge:I,position:{x:K.clientX,y:K.clientY}});},[p]),C=react.useCallback(I=>{let K=d.find(j=>j.id===I);return K?{x:K.x,y:K.y}:{x:0,y:0}},[d]),H=react.useCallback(I=>{if(I.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return I.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let K=I.card.priority;return K==="URGENT"?"#ef4444":K==="HIGH"?"#f59e0b":K==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return I.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:y("relationships-graph-empty",m),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:y("relationships-graph",m),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:l.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:l.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),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:()=>v(I=>Math.min(I+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(I=>Math.max(I-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),T({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(I=>I.type))).map(I=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Li(I)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Wc(I)," ",Fi(I)]})]},I))}),jsxRuntime.jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:M,onMouseUp:k,onMouseLeave:k,children:[jsxRuntime.jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(I=>{let K=C(typeof I.source=="string"?I.source:I.source.id),j=C(typeof I.target=="string"?I.target:I.target.id),$=Hc(I.type),Z=g===I.id,ce=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:y("relationships-graph-edge",Z&&"hovered",ce&&"critical"),onMouseEnter:()=>w(I.id),onMouseLeave:()=>w(null),onClick:he=>N(I,he),children:[jsxRuntime.jsx("line",{x1:K.x,y1:K.y,x2:j.x,y2:j.y,stroke:Li(I.type),strokeWidth:ce?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Z?1:.6,markerEnd:$?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Z&&jsxRuntime.jsx("text",{x:(K.x+j.x)/2,y:(K.y+j.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Fi(I.type)})]},I.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:d.map(I=>{let K=f===I.id,j=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:y("relationships-graph-node",K&&"hovered",j&&"critical"),transform:`translate(${I.x}, ${I.y})`,onMouseDown:$=>D(I.id,$),onMouseEnter:()=>h(I.id),onMouseLeave:()=>h(null),onClick:$=>B(I,$),children:[jsxRuntime.jsx("circle",{r:j?a.nodeSize*1.2:a.nodeSize,fill:H(I),stroke:j?"#fbbf24":"#ffffff",strokeWidth:j?3:2,opacity:K?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:I.card.title.length>20?I.card.title.substring(0,20)+"...":I.card.title})]},I.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 jc({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,l]=react.useState(""),[p,m]=react.useState(false),[n,d]=react.useState(null),[c,i]=react.useState(null),u=react.useRef(null),f=p||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let b=v=>{v.key==="Escape"&&!f&&h();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,f]);let h=()=>{f||(l(""),d(null),i(null),t());},g=async()=>{if(!(!s.trim()||f)){m(true),d(null),i(null);try{let b=await r(s.trim());i(b);}catch(b){d(b instanceof Error?b.message:"Failed to generate plan");}finally{m(false);}}},w=()=>{c&&(a(c),h());};return e?jsxRuntime.jsxs(nt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:h}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:h,disabled:f,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:c?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!"})]}),c.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:c.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",c.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:c.columns.map((b,v)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},v))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",c.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[c.cards.slice(0,10).map((b,v)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},v)),c.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",c.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:u,value:s,onChange:b=>l(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:f}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),n&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:n}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,v)=>jsxRuntime.jsx("button",{onClick:()=>l(b),disabled:f,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},v))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:f&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:h,disabled:f,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"}),c?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:g,disabled:!s.trim()||f,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:f?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Bi={"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 Q0={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},eh={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 th(e,t,a){let r=Bi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Ro(e){return `$${e.toFixed(4)}`}var Ri=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=th(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(c=>c.timestamp>=t.start&&c.timestamp<=t.end));let r=a.length,o=a.reduce((c,i)=>c+i.cost,0),s=a.reduce((c,i)=>c+i.inputTokens,0),l=a.reduce((c,i)=>c+i.outputTokens,0),p=a.filter(c=>c.success),m=a.reduce((c,i)=>c+i.duration,0),n={},d={};return a.forEach(c=>{n[c.feature]=(n[c.feature]||0)+1,d[c.feature]=(d[c.feature]||0)+c.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:l,operationsByFeature:n,costsByFeature:d,averageDuration:r>0?m/r:0,successRate:r>0?p.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,l=new Date;a==="month"?l.setMonth(s.getMonth()-1):l.setDate(s.getDate()-1);let p=this.operations.filter(d=>d.timestamp>=l).length,m=Math.max(0,o-p),n=p/o*100;return {used:p,limit:o,remaining:m,percentUsed:n,isExceeded:p>=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)}},Br=new Ri;function qc({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Br.getStats()),[s,l]=react.useState(Br.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(Br.getStats()),l(Br.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=n=>{n.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let p=Br.getRecentOperations(5);return jsxRuntime.jsxs(nt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:m=>m.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ro(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([m,n])=>{let d=r.costsByFeature[m]||0,c=r.totalOperations>0?n/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:m.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[n," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ro(d)})]})]}),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:`${c}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),p.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:p.map(m=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ro(m.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function Zc({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[l,p]=react.useState(""),[m,n]=react.useState(""),[d,c]=react.useState(""),[i,u]=react.useState(false),[f,h]=react.useState(null),[g,w]=react.useState(null),[b,v]=react.useState(null),x=react.useRef(null),T=i||o;react.useEffect(()=>{e&&x.current&&x.current.focus();},[e]),react.useEffect(()=>{let N=C=>{C.key==="Escape"&&!T&&D();};if(e)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[e,T]);let D=()=>{T||(p(""),n(""),c(""),h(null),w(null),v(null),t());},M=async()=>{if(!(!l.trim()||T)){u(true),h(null),w(null),v(null);try{let N=await r({prompt:l.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:d||void 0});w(N.tasks.tasks),v({from_cache:N.from_cache,tokens_used:N.tokens_used,mock_mode:N.mock_mode,similarity:N.similarity,tokens_saved:N.tokens_saved});}catch(N){h(N instanceof Error?N.message:"Failed to generate tasks");}finally{u(false);}}},k=()=>{g&&(a(g),D());};if(!e)return null;let B=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(nt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:D}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:N=>N.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:D,disabled:T,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:g?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),b?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",B,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[b?.tokens_used||0," tokens"]}),b?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[b.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[g.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((N,C)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",C+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:N.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"})]}),N.start," \u2192 ",N.end]}),jsxRuntime.jsxs("span",{children:[N.duration," days"]}),N.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",N.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${N.priority==="high"?"bg-red-500/20 text-red-400":N.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:N.priority})]})},N.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:x,value:l,onChange:N=>p(N.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:T}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:N=>n(N.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:T})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:d,onChange:N=>c(N.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:T})]})]}),f&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),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((N,C)=>jsxRuntime.jsx("button",{onClick:()=>p(N),disabled:T,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:N},C))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:T&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:D,disabled:T,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?jsxRuntime.jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:M,disabled:!l.trim()||T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:T?"Generating...":"Generate Tasks"})]})]})]})})]})}function Wn({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(g=>{t&&jo(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(w,b,v)=>{console.warn(`Retry attempt ${b} after ${v}ms: ${w.message}`);}}).then(w=>{w.success||console.error(`Failed to persist board after ${w.attempts} attempts:`,w.error);});},[t]),s=react.useCallback(async(g,w,b)=>{r(v=>{let x=v.cards.find(N=>N.id===g);if(!x)return v;let T=x.columnId,D={...x,columnId:w,position:b},M=v.cards.map(N=>N.id===g?D:N),k=v.columns.map(N=>{if(N.id===T)return {...N,cardIds:N.cardIds.filter(C=>C!==g)};if(N.id===w){let C=M.filter(H=>H.columnId===w).sort((H,I)=>H.position-I.position);return {...N,cardIds:C.map(H=>H.id)}}return N}),B={...v,cards:M,columns:k};return o(B),B});},[o]),l=react.useCallback(async(g,w)=>{r(b=>{let v=b.cards.map(T=>T.id===g?{...T,...w}:T),x={...b,cards:v};return o(x),x});},[o]),p=react.useCallback(async g=>{let w=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let v={...g,id:w},x=b.columns.map(D=>D.id===g.columnId?{...D,cardIds:[...D.cardIds,w]}:D),T={...b,cards:[...b.cards,v],columns:x};return o(T),T});},[o]),m=react.useCallback(async g=>{r(w=>{let b=w.cards.find(D=>D.id===g);if(!b)return w;let v=w.cards.filter(D=>D.id!==g),x=w.columns.map(D=>D.id===b.columnId?{...D,cardIds:D.cardIds.filter(M=>M!==g)}:D),T={...w,cards:v,columns:x};return o(T),T});},[o]),n=react.useCallback(async g=>{let w=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let v={...g,id:w,cardIds:[]},x={...b,columns:[...b.columns,v]};return o(x),x});},[o]),d=react.useCallback(async(g,w)=>{r(b=>{let v=b.columns.map(T=>T.id===g?{...T,...w}:T),x={...b,columns:v};return o(x),x});},[o]),c=react.useCallback(async g=>{r(w=>{let b=w.cards.filter(T=>T.columnId!==g),v=w.columns.filter(T=>T.id!==g),x={...w,cards:b,columns:v};return o(x),x});},[o]),i=react.useCallback(g=>{let w=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return p(g),w},[p]),u=react.useCallback(g=>{let w=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(g),w},[n]),f=react.useCallback(()=>{r(g=>{let w={...g,cards:[],columns:[]};return o(w),w});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:l,onCardCreate:p,onCardDelete:m,onColumnCreate:n,onColumnUpdate:d,onColumnDelete:c},setBoard:r,helpers:{addCard:i,addColumn:u,deleteCard:m,deleteColumn:c,clearBoard:f}}}function ep({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Wn({initialBoard:e,onPersist:a}),l=react.useMemo(()=>({addCard:(m,n,d={})=>{s.addCard({title:n,columnId:m,position:r.cards.filter(c=>c.columnId===m).length,...d});},addColumn:(m,n)=>{let d=r.columns.length>0?Math.max(...r.columns.map(c=>c.position)):0;s.addColumn({title:m,position:n??d+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:l}}var Oo={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},ap={by:"none",order:"asc"};function rp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Oo,...e}),[s,l]=react.useState({...ap,...t}),p=react.useCallback(h=>{o(g=>({...g,...h}));},[]),m=react.useCallback(h=>{l(g=>({...g,...h}));},[]),n=react.useCallback(()=>{o(Oo),l(ap);},[]),d=react.useCallback(()=>{a&&o({...Oo,assignees:[a]});},[a]),c=react.useCallback(()=>{o({...Oo,dateFilter:"overdue"});},[]),i=react.useCallback(()=>{o({...Oo,priorities:["HIGH","URGENT"]});},[]),u=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),f=react.useCallback(h=>{let g=[...h];if(r.search){let w=r.search.toLowerCase();g=g.filter(b=>b.title.toLowerCase().includes(w)||b.description?.toLowerCase().includes(w));}if(r.dateFilter!=="all"){let w=new Date,b=w.getFullYear(),v=String(w.getMonth()+1).padStart(2,"0"),x=String(w.getDate()).padStart(2,"0"),T=`${b}-${v}-${x}`;g=g.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let M=D.endDate||D.dueDate;if(!M)return false;let k;if(typeof M=="string")k=M.split("T")[0]||M;else {let B=M.getUTCFullYear(),N=String(M.getUTCMonth()+1).padStart(2,"0"),C=String(M.getUTCDate()).padStart(2,"0");k=`${B}-${N}-${C}`;}switch(r.dateFilter){case "overdue":return k<T;case "today":return k===T;case "this-week":let B=new Date(T+"T00:00:00"),N=new Date(k+"T00:00:00"),C=new Date(B);return C.setDate(C.getDate()+7),N>=B&&N<=C;case "custom":if(r.dateRange){let H=typeof M=="string"?new Date(M):M;return H>=r.dateRange.start&&H<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(w=>w.priority&&r.priorities.includes(w.priority))),r.assignees.length>0&&(g=g.filter(w=>(w.assignedUserIds||(w.assigneeId?[w.assigneeId]:[])).some(v=>r.assignees.includes(v)))),r.labels.length>0&&(g=g.filter(w=>w.labels&&w.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(g=g.filter(w=>r.columns.includes(w.columnId))),s.by!=="none"&&g.sort((w,b)=>{let v=0;switch(s.by){case "created":let x=w.createdAt?new Date(w.createdAt).getTime():0,T=b.createdAt?new Date(b.createdAt).getTime():0;v=x-T;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},M=D[w.priority||"LOW"],k=D[b.priority||"LOW"];v=M-k;break;case "dueDate":let B=w.endDate||w.dueDate,N=b.endDate||b.dueDate;if(!B)return 1;if(!N)return -1;let C=typeof B=="string"?new Date(B).getTime():B.getTime(),H=typeof N=="string"?new Date(N).getTime():N.getTime();v=C-H;break;case "title":v=w.title.localeCompare(b.title);break;case "estimate":let I=w.estimatedTime||0,K=b.estimatedTime||0;v=I-K;break;default:v=0;}return s.order==="asc"?v:-v}),g},[r,s]);return {filters:r,sort:s,setFilters:p,setSort:m,resetFilters:n,filterMyTasks:d,filterOverdue:c,filterHighPriority:i,applyFilters:f,hasActiveFilters:u}}var np,sp;if(typeof window<"u")try{let e=Go("ai");np=e.generateObject,sp=e.generateText;}catch{}function ip(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(np&&sp&&e.apiKey),l=react.useCallback(async c=>{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:",c),{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: ${c}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(i){let u=i instanceof Error?i:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[s]),p=react.useCallback(async c=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",c.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(i){let u=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[s]),m=react.useCallback(async c=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(i){let u=i instanceof Error?i:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[s]),n=react.useCallback(async c=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",c.title),[{title:`Subtask 1 for: ${c.title}`,position:c.position+.1,columnId:c.columnId},{title:`Subtask 2 for: ${c.title}`,position:c.position+.2,columnId:c.columnId}]}catch(i){let u=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[s]),d=react.useCallback(async c=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",c.title),{hours:8,confidence:.75}}catch(i){let u=i instanceof Error?i:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[s]);return {onGeneratePlan:l,onSuggestAssignee:p,onPredictRisks:m,onGenerateSubtasks:n,onEstimateEffort:d,isAvailable:s,isLoading:t,error:r}}function zi(){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 lp(e){let{cards:t}=e,[a,r]=zi(),o=react.useCallback(c=>a.selectedCardIds.includes(c),[a.selectedCardIds]),s=react.useCallback((c,i)=>{if(!i){r({selectedCardIds:[c],lastSelectedCardId:c});return}let u=i.ctrlKey||i.metaKey,f=i.shiftKey;if(u)a.selectedCardIds.includes(c)?r({selectedCardIds:a.selectedCardIds.filter(h=>h!==c),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,c],lastSelectedCardId:c});else if(f&&a.lastSelectedCardId){let h=t.find(w=>w.id===c),g=t.find(w=>w.id===a.lastSelectedCardId);if(h&&g&&h.columnId===g.columnId){let w=t.filter(k=>k.columnId===h.columnId).sort((k,B)=>k.position-B.position),b=w.findIndex(k=>k.id===a.lastSelectedCardId),v=w.findIndex(k=>k.id===c),[x,T]=b<v?[b,v]:[v,b],D=w.slice(x,T+1).map(k=>k.id),M=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:M,lastSelectedCardId:c});}else r({selectedCardIds:[c],lastSelectedCardId:c});}else r({selectedCardIds:[c],lastSelectedCardId:c});},[t,a,r]),l=react.useCallback(c=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==c),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),p=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(c=>c.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),n=react.useCallback(c=>{a.selectedCardIds.includes(c)?l(c):r({selectedCardIds:[...a.selectedCardIds,c],lastSelectedCardId:c});},[a,l,r]),d=react.useCallback(()=>t.filter(c=>a.selectedCardIds.includes(c.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:l,clearSelection:p,selectAll:m,toggleCard:n,getSelectedCards:d}}var dp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function cp(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...dp,...a}),[a]),[s,l]=react.useState([]),p=react.useCallback((h,g,w,b,v)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:h,cardIds:g,columnId:w,strategy:b,color:v,isExpanded:true,position:s.filter(T=>T.columnId===w).length,createdAt:new Date};l(T=>[...T,x]);},[o.minCardsPerStack,s]),m=react.useCallback(h=>{l(g=>g.filter(w=>w.id!==h));},[]),n=react.useCallback(h=>{l(g=>g.map(w=>w.id===h?{...w,isExpanded:!w.isExpanded}:w));},[]),d=react.useCallback((h,g)=>{l(w=>w.map(b=>b.id===h&&!b.cardIds.includes(g)?{...b,cardIds:[...b.cardIds,g]}:b));},[]),c=react.useCallback((h,g)=>{l(w=>w.map(b=>{if(b.id===h){let v=b.cardIds.filter(x=>x!==g);return v.length<o.minCardsPerStack?null:{...b,cardIds:v}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),i=react.useCallback(h=>s.filter(g=>g.columnId===h).sort((g,w)=>g.position-w.position),[s]),u=react.useCallback(async h=>{let g=t.filter(T=>T.columnId===h);if(g.length<o.minCardsPerStack*2)return [];let w=[],b=new Map;g.forEach(T=>{T.labels&&T.labels.length>0&&T.labels.forEach(D=>{b.has(D)||b.set(D,[]),b.get(D).push(T);});}),b.forEach((T,D)=>{T.length>=o.minCardsPerStack&&w.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:T.map(M=>M.id),columnId:h,strategy:"labels",color:"#3b82f6"},reason:`${T.length} cards with label "${D}"`,confidence:.85});});let v=new Map;g.forEach(T=>{T.assignedUserIds&&T.assignedUserIds.length>0&&T.assignedUserIds.forEach(D=>{v.has(D)||v.set(D,[]),v.get(D).push(T);});}),v.forEach((T,D)=>{T.length>=o.minCardsPerStack&&w.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:T.map(M=>M.id),columnId:h,strategy:"assignee",color:"#8b5cf6"},reason:`${T.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(g.forEach(T=>{T.priority&&(x.has(T.priority)||x.set(T.priority,[]),x.get(T.priority).push(T));}),x.forEach((T,D)=>{if(T.length>=o.minCardsPerStack){let M={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";w.push({stack:{title:`${M} ${D} Priority`,cardIds:T.map(k=>k.id),columnId:h,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${T.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let T of g){let M=(await r.findSimilar(T,g)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(M.length>=o.minCardsPerStack-1){let k=[T.id,...M.map(N=>N.card.id)],B=M.reduce((N,C)=>N+C.similarity,0)/M.length;w.push({stack:{title:`\u2728 Similar to "${T.title.substring(0,30)}${T.title.length>30?"...":""}"`,cardIds:k,columnId:h,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${M.length+1} similar tasks`,confidence:B});}}return w.filter(T=>T.confidence>=o.autoStackConfidenceThreshold).sort((T,D)=>D.confidence-T.confidence).slice(0,5)},[t,o,r]),f=react.useCallback(h=>{p(h.stack.title,h.stack.cardIds,h.stack.columnId,h.stack.strategy,h.stack.color);},[p]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let w=await u(g),b=w[0];w.length>0&&b&&b.confidence>=.9&&f(b);});},[]),{stacks:s,createStack:p,deleteStack:m,toggleStack:n,addToStack:d,removeFromStack:c,getStacksForColumn:i,getSuggestions:u,applySuggestion:f,config:o}}var pp=react.createContext(null);function mp({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,l=new Map;t?.columns?.forEach(m=>{let{Column:n}=Go("@libxai/core");s.set(m.id,new n(m));}),t?.cards?.forEach(m=>{let{Card:n}=Go("@libxai/core");l.set(m.id,new n(m));});let p=null;if(t?.board){let{Board:m}=Go("@libxai/core");p=new m(t.board);}r.current=new core.BoardStore({board:p,columns:s,cards:l});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(pp.Provider,{value:{store:o},children:e})}function Hn(){let e=react.useContext(pp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function $o(){let e=Hn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,l]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),l(e.getAllCards());}),[e]);let p=react.useCallback(b=>{e.updateBoard(b);},[e]),m=react.useCallback(b=>{e.addColumn(b);},[e]),n=react.useCallback((b,v)=>{e.updateColumn(b,v);},[e]),d=react.useCallback(b=>{e.deleteColumn(b);},[e]),c=react.useCallback(b=>e.getColumn(b),[e]),i=react.useCallback(b=>{e.addCard(b);},[e]),u=react.useCallback((b,v)=>{e.updateCard(b,v);},[e]),f=react.useCallback(b=>{e.deleteCard(b);},[e]),h=react.useCallback((b,v,x)=>{e.moveCard(b,v,x);},[e]),g=react.useCallback(b=>e.getCard(b),[e]),w=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:p,addColumn:m,updateColumn:n,deleteColumn:d,getColumn:c,addCard:i,updateCard:u,deleteCard:f,moveCard:h,getCard:g,getCardsByColumn:w}}function gp(e){let{cards:t}=$o();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 fp(e="position",t="asc"){let{cards:a}=$o();return react.useMemo(()=>[...a].sort((o,s)=>{let l=0;switch(e){case "title":l=o.title.localeCompare(s.title);break;case "priority":{let p={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?p[o.priority]:0,n=s.priority?p[s.priority]:0;l=m-n;break}case "createdAt":l=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":l=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":l=o.position-s.position;break}return t==="asc"?l:-l}),[a,e,t])}var Gn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=hl.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 l=s[t];if(typeof l=="function")try{let p=await Promise.resolve(l.apply(s,a));p!==void 0&&(o=p,a[0]=p);}catch(p){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,p,{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(l=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,l,{plugin:o.id,hook:t});}));}await Promise.all(r);}},yh=new Gn;function bp({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:l=false,gap:p=0,getItemKey:m}){let n=react.useRef(null),d=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>a,overscan:s,horizontal:l,gap:p}),c=d.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=l?{width:`${d.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${d.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:n,style:i,className:o,children:jsxRuntime.jsx("div",{style:u,children:c.map(f=>{let h=e[f.index];if(!h)return null;let g=m?m(h,f.index):f.index,w={position:"absolute",top:l?0:f.start,left:l?f.start:0,width:l?f.size:"100%",height:l?"100%":f.size};return jsxRuntime.jsx("div",{style:w,"data-index":f.index,children:r(h,f.index)},g)})})})}function yp(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 xp({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:l=3,gap:p=16,getItemKey:m,horizontal:n=true}){let d=react.useRef(null),c=reactVirtual.useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>d.current,estimateSize:()=>r,overscan:l,gap:p}),i=c.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},f={width:`${c.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:d,style:u,className:s,children:jsxRuntime.jsx("div",{style:f,children:i.map(h=>{let g=e[h.index];if(!g)return null;let w=m?m(g,h.index):h.index,b={position:"absolute",top:0,left:h.start,width:h.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":h.index,children:o(g,h.index)},w)})})})}function kp(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 wp(e,t=10){return e>t}var Hi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Gi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},_i={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Vi={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},ji={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ki={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Yi={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},qi={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)"},Xi={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)"},Ji={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Zi={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}},Qi={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}},_n={spacing:Hi,borderRadius:Gi,fontSize:_i,fontWeight:Vi,lineHeight:ji,zIndex:Ki,duration:Yi,easing:qi,shadows:Xi,opacity:Ji,kanban:Zi,gantt:Qi};function Cp(e,t,a){return e[t]??a}function el(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)?el(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function kh(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function tl(e="asakaa"){let t=el(_n),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,l=kh(o);a.push(` ${s}: ${l};`);}return `:root {
389
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function fc(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Ja(e,t){let a=fc(e),r=t.toLowerCase().trim(),o=a.find(p=>p.name.toLowerCase()===r);if(o)return o;let s=a.find(p=>p.name.toLowerCase().includes(r));if(s)return s;let i=r.split(/\s+/);return a.find(p=>{let m=p.name.toLowerCase();return i.every(d=>m.includes(d))})}function gi(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 f={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(f!==void 0){let c=new Date(r),w=c.getDay(),h=f-w;return h<=0&&(h+=7),c.setDate(c.getDate()+h),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),f=s[2].toLowerCase(),c=new Date(r);return f==="day"||f==="d\xEDa"||f==="dias"?c.setDate(c.getDate()+g):f==="week"||f==="semana"||f==="semanas"?c.setDate(c.getDate()+g*7):(f==="month"||f==="mes"||f==="meses")&&c.setMonth(c.getMonth()+g),c}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let p=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(p&&p[1]&&p[2]&&p[3]){let g=parseInt(p[1],10),f=parseInt(p[2],10)-1,c=parseInt(p[3],10);return new Date(c,f,g)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},d=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(d&&d[1]&&d[2]){let g=parseInt(d[1],10),f=m[d[2].toLowerCase()],c=d[3]?parseInt(d[3],10):r.getFullYear();if(f!==void 0)return new Date(c,f,g)}let l={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},n=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(n&&n[1]&&n[2]){let g=l[n[1].toLowerCase()],f=parseInt(n[2],10),c=n[3]?parseInt(n[3],10):r.getFullYear();if(g!==void 0)return new Date(c,g,f)}return null}function fi(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 hi(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 hc(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 bc(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 d=r[1].trim(),l=r[2].trim(),n=Ja(t,d),g=gi(l);if(!n)return {type:"move_task",taskName:d,message:`Could not find a task named "${d}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!g)return {type:"move_task",taskId:n.id,taskName:n.name,message:`Could not parse the date "${l}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let f=n.startDate&&n.endDate?Math.round((n.endDate.getTime()-n.startDate.getTime())/(1e3*60*60*24)):1,c=new Date(g);return c.setDate(c.getDate()+f),{type:"move_task",taskId:n.id,taskName:n.name,updates:{startDate:g,endDate:c},message:`Moved "${n.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 d=o[1].trim(),l=o[2].trim(),n=Ja(t,d),g=fi(l);if(!n)return {type:"resize_task",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Task not found"};if(!g||!n.endDate)return {type:"resize_task",taskId:n.id,taskName:n.name,message:`Could not parse the duration "${l}".`,success:false,error:"Invalid duration"};let f=new Date(n.endDate);return f.setDate(f.getDate()+g),{type:"resize_task",taskId:n.id,taskName:n.name,updates:{endDate:f},message:`Extended "${n.name}" by ${g} days. New end date: ${f.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 d=s[1].trim(),l=s[2].trim(),n=Ja(t,d),g=hi(l);return n?g===null?{type:"set_progress",taskId:n.id,taskName:n.name,message:`Could not parse the progress value "${l}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:n.id,taskName:n.name,updates:{progress:g},message:`Set "${n.name}" progress to ${g}%.`,success:true}:{type:"set_progress",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Task not found"}}let i=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let d=i[1].trim(),l=i[2].trim(),n=Ja(t,d);return n?{type:"rename_task",taskId:n.id,taskName:n.name,updates:{name:l},message:`Renamed "${n.name}" to "${l}".`,success:true}:{type:"rename_task",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Task not found"}}let p=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]&&p[2]){let d=p[1].trim(),l=p[2].trim(),n=Ja(t,d),g=Ja(t,l);return n?g?{type:"link_tasks",taskId:g.id,taskName:g.name,dependencyFrom:n.id,dependencyTo:g.id,message:`Linked "${n.name}" \u2192 "${g.name}".`,success:true}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let d=m[1].trim(),l=Ja(t,d);return l?{type:"delete_task",taskId:l.id,taskName:l.name,message:`Deleted "${l.name}".`,success:true}:{type:"delete_task",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Task not found"}}return null}function yc(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 y0(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 v0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function En(e,t=[],a=[]){let r=e.assignedUserIds?.map(l=>{let n=a.find(g=>g.id===l);return n?{name:n.name,initials:n.initials,color:n.color}:null}).filter(l=>l!==null),o=t.filter(l=>l.metadata?.parentCardId===e.id).map(l=>En(l,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(l=>l.type==="finish-to-start").map(l=>l.taskId));let i=l=>{if(l)return typeof l=="string"?new Date(l):l},p=i(e.startDate),m=i(e.endDate),d=e.metadata?.isMilestone===true||p&&m&&Math.abs(m.getTime()-p.getTime())<=864e5;return {id:e.id,name:e.title,startDate:p,endDate:m,progress:e.progress||0,status:y0(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:d,isCriticalPath:e.metadata?.isCriticalPath===true}}function vc(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:v0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function xc(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>En(r,e,t))}var bi={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"}},yi={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"}},Pn={en:bi,es:yi};function vi(e){return Pn[e]||Pn.en}function Mn(e,t){let a=vi(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 Tc(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(...Tc(r.subtasks,t+1));return a}function M0({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 Dc({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:i}){let{theme:p="dark",locale:m="en",customTranslations:d,showSearch:l=true,showHierarchy:n=true}=t,g=Mn(m,d),f=p==="dark",[c,w]=react.useState(new Set),[h,k]=react.useState("startDate"),[u,y]=react.useState("asc"),[v,D]=react.useState("");react.useMemo(()=>{let N=new Set;function C(W){for(let I of W)I.subtasks?.length&&(N.add(I.id),C(I.subtasks));}C(e),w(N);},[e]);let T=react.useCallback(N=>{w(C=>{let W=new Set(C);return W.has(N)?W.delete(N):W.add(N),W}),a.onTaskToggleExpand?.(N);},[a]),M=react.useCallback(N=>{h===N?y(C=>C==="asc"?"desc":"asc"):(k(N),y("asc")),a.onSortChange?.({column:N,direction:u==="asc"?"desc":"asc"});},[h,u,a]),x=react.useMemo(()=>{let N=Tc(e);if(v.trim()){let W=v.toLowerCase();N=N.filter(I=>I.name.toLowerCase().includes(W));}let C=[];for(let W of N){let I=W.level===0;W.level>0&&(I=true),(I||v.trim())&&C.push(W);}return v.trim()&&C.sort((W,I)=>{let K,V;switch(h){case "name":K=W.name.toLowerCase(),V=I.name.toLowerCase();break;case "startDate":K=W.startDate?.getTime()||0,V=I.startDate?.getTime()||0;break;case "endDate":K=W.endDate?.getTime()||0,V=I.endDate?.getTime()||0;break;case "progress":K=W.progress||0,V=I.progress||0;break;case "status":K=W.status||"todo",V=I.status||"todo";break;default:return 0}return K<V?u==="asc"?-1:1:K>V?u==="asc"?1:-1:0}),C},[e,v,h,u]),L=N=>N?(N instanceof Date?N:new Date(N)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",f?"bg-[#0F1117]":"bg-white",s),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:b("text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:[g.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",f?"bg-[#0F1117]":"bg-white",s),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:b("text-lg font-semibold mb-2",f?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:b("text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",f?"bg-[#0F1117]":"bg-white",s),style:i,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:b("text-lg font-semibold mb-2",f?"text-white":"text-gray-900"),children:g.empty.noTasks}),jsxRuntime.jsx("p",{className:b("text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:b("flex-1 flex flex-col w-full h-full overflow-hidden",f?"bg-[#0F1117]":"bg-white",s),style:i,children:[jsxRuntime.jsx("div",{className:b("flex-shrink-0 px-6 py-4 border-b",f?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[l&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:b("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",f?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:v,onChange:N=>D(N.target.value),placeholder:g.toolbar.searchPlaceholder,className:b("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",f?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsxs("div",{className:b("text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:[x.length," ",g.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:b("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",f?"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:()=>M("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:()=>M("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:()=>M("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:()=>M("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:()=>M("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x.map((N,C)=>{let W=c.has(N.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:C*.02},className:b("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",f?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:n?`${24+N.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(N),onDoubleClick:()=>a.onTaskDoubleClick?.(N),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[n&&N.hasChildren&&jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),T(N.id);},className:b("p-0.5 rounded",f?"hover:bg-white/10":"hover:bg-gray-200"),children:W?jsxRuntime.jsx(lucideReact.ChevronDown,{className:b("w-4 h-4",f?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:b("w-4 h-4",f?"text-[#9CA3AF]":"text-gray-400")})}),n&&!N.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),a.onTaskUpdate?.({...N,progress:N.progress===100?0:100,status:N.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(M0,{status:N.status,progress:N.progress})}),jsxRuntime.jsx("span",{className:b("truncate",f?"text-white":"text-gray-900",N.progress===100&&(f?"line-through text-[#6B7280]":"line-through text-gray-400")),children:N.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:b("px-2 py-1 rounded-full text-xs font-medium",N.progress===100||N.status==="completed"?"bg-green-500/10 text-green-500":N.progress&&N.progress>0||N.status==="in-progress"?"bg-blue-500/10 text-blue-500":f?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:N.progress===100||N.status==="completed"?g.status.completed:N.progress&&N.progress>0||N.status==="in-progress"?g.status.inProgress:g.status.todo})}),jsxRuntime.jsxs("div",{className:b("col-span-2 flex items-center gap-1 text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),L(N.startDate)]}),jsxRuntime.jsxs("div",{className:b("col-span-2 flex items-center gap-1 text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),L(N.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:b("flex-1 h-1.5 rounded-full overflow-hidden",f?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:b("h-full rounded-full transition-all",N.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${N.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:b("text-xs w-8",f?"text-[#9CA3AF]":"text-gray-500"),children:[N.progress||0,"%"]})]})})]},N.id)})}),x.length===0&&v&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:b("w-12 h-12 mx-auto mb-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:b(f?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.noResults})]})})]})]})}var xi={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"},ki={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"},wi={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"},In={dark:xi,light:ki,neutral:wi};function Nc(e){return In[e]||In.dark}var Ci={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"}},Ti={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"}},Fn={en:Ci,es:Ti};function Fo(e){return Fn[e]||Fn.en}function Ln(e,t){let a=Fo(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 Sc(e){let t=Fo(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 Ec(e,t=0,a=true){let r=Fo(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 G0(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 Pi(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 Ac({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 Fc({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:i,style:p,availableTags:m=[],onCreateTag:d}){let{theme:l="dark",locale:n="en",customTranslations:g}=t,f=Ln(n,g),c=l==="dark",w={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)"},[h,k]=react.useState(r||new Date),[u,y]=react.useState(null),[v,D]=react.useState(null),[T,M]=react.useState(null),[x,L]=react.useState(new Date),[N,C]=react.useState({}),W=4,I=3,[K,V]=react.useState(false),[z,Q]=react.useState(false),[ue,ve]=react.useState(false),[B,A]=react.useState(null),[R,P]=react.useState(""),[J,q]=react.useState(void 0),[$,ke]=react.useState(null),[Ae,He]=react.useState(false),[we,Je]=react.useState(false),[Be,at]=react.useState(null),[Pt,bt]=react.useState(false),[rt,O]=react.useState(new Date),ie=react.useCallback(()=>{k(new Date(h.getFullYear(),h.getMonth()-1,1));},[h]),ge=react.useCallback(()=>{k(new Date(h.getFullYear(),h.getMonth()+1,1));},[h]),De=react.useCallback(()=>{k(new Date);},[]),Me=react.useMemo(()=>{let H=h.getFullYear(),Se=h.getMonth(),et=new Date(H,Se,1),Ce=new Date(H,Se+1,0),Ee=et.getDay(),ae=Ce.getDate(),X=G0(e),Te=new Date;Te.setHours(0,0,0,0);let ee=[],ze=Ee,Fe=new Date(H,Se,0).getDate();for(let Ie=ze-1;Ie>=0;Ie--){let pe=new Date(H,Se-1,Fe-Ie);ee.push({date:pe,isCurrentMonth:false,isToday:false,isWeekend:pe.getDay()===0||pe.getDay()===6,events:X.filter(Re=>Pi(pe,Re)).map(Re=>({id:Re.id,title:Re.name,start:Re.startDate,end:Re.endDate,task:Re}))});}for(let Ie=1;Ie<=ae;Ie++){let pe=new Date(H,Se,Ie),Re=pe.getTime()===Te.getTime();ee.push({date:pe,isCurrentMonth:true,isToday:Re,isWeekend:pe.getDay()===0||pe.getDay()===6,events:X.filter(ot=>Pi(pe,ot)).map(ot=>({id:ot.id,title:ot.name,start:ot.startDate,end:ot.endDate,task:ot}))});}let Ze=42-ee.length;for(let Ie=1;Ie<=Ze;Ie++){let pe=new Date(H,Se+1,Ie);ee.push({date:pe,isCurrentMonth:false,isToday:false,isWeekend:pe.getDay()===0||pe.getDay()===6,events:X.filter(Re=>Pi(pe,Re)).map(Re=>({id:Re.id,title:Re.name,start:Re.startDate,end:Re.endDate,task:Re}))});}return ee},[h,e]),st=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wt=h.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),$e=react.useCallback((H,Se)=>{if(!u)return;let et={...u,[H]:Se};y(et),a.onTaskUpdate?.(et);},[u,a]),be=react.useCallback(H=>{if(!u)return;let Se=u.progress||0;H==="completed"?Se=100:H==="todo"&&(Se=0);let et={...u,status:H,progress:Se};y(et),a.onTaskUpdate?.(et),V(false);},[u,a]),Ne=react.useCallback((H,Se)=>{if(!u)return;let et={...u,startDate:H,endDate:Se};y(et),a.onTaskUpdate?.(et);},[u,a]),Kt=react.useCallback(()=>{V(false),Q(false),M(null);},[]);return o?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",i),style:p,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:b("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:[f.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",i),style:p,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:b("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:b("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",i),style:p,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:b("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:f.labels.noEvents}),jsxRuntime.jsx("p",{className:b("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:f.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:b("flex-1 flex flex-col w-full h-full overflow-auto",c?"bg-[#0F1117]":"bg-white",i),style:p,children:[jsxRuntime.jsx("div",{className:b("flex-shrink-0 px-6 py-4 border-b",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:b("text-xl font-semibold capitalize",c?"text-white":"text-gray-900"),children:wt}),jsxRuntime.jsx("button",{onClick:De,className:b("px-3 py-1.5 text-sm rounded-lg transition-colors",c?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:f.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:ie,className:b("p-2 rounded-lg transition-colors",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:b("w-5 h-5",c?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:ge,className:b("p-2 rounded-lg transition-colors",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:b("w-5 h-5",c?"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:st.map(H=>jsxRuntime.jsx("div",{className:b("py-2 text-center text-xs font-medium uppercase",c?"text-[#9CA3AF]":"text-gray-500"),children:H},H))}),jsxRuntime.jsx("div",{className:b("grid grid-cols-7 auto-rows-min gap-px rounded-lg",c?"bg-[#2D2D2D]":"bg-gray-300"),children:Me.map((H,Se)=>{let et=H.date.getDay()===0||H.date.getDay()===6;return jsxRuntime.jsxs("div",{className:b("min-h-[120px] p-2 transition-colors flex flex-col relative group",c?et?"bg-[#1C1F26]":H.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":et?"bg-gray-100":H.isCurrentMonth?"bg-white":"bg-gray-50",H.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ce=N[Se]||W,Ee=H.events.slice(0,Ce),ae=H.events.length-Ce;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[Ee.map(X=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{y(X.task),a.onEventClick?.(X);},whileHover:{scale:1.02},className:b("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",X.task.progress===100?c?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":c?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Ac,{task:X.task}),jsxRuntime.jsx("span",{className:"truncate",children:X.title})]})},X.id)),ae>0&&jsxRuntime.jsxs("button",{onClick:X=>{X.stopPropagation(),C(Te=>({...Te,[Se]:Ce+I}));},className:b("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",c?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",ae," ",n==="es"?"M\xC1S":"MORE"]}),Ce>W&&H.events.length>W&&jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),C(Te=>({...Te,[Se]:W}));},className:b("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",c?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ce=Se>=28,Ee=Se%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:ae=>{ae.stopPropagation(),B===Se?A(null):(A(Se),P(""),q(void 0),ke(null),at(null),He(false),Je(false),bt(false),O(H.date));},className:b("w-5 h-5 rounded flex items-center justify-center transition-all",B===Se?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",c?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:b("w-3.5 h-3.5 transition-transform",B===Se&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B===Se&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{A(null),P(""),q(void 0),ke(null),at(null),He(false),Je(false),bt(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Ce?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ce?-5:5,scale:.95},transition:{duration:.12},className:b("absolute w-[320px] rounded-lg shadow-2xl z-50",Ce?"bottom-full mb-1":"top-full mt-1",Ee?"right-0":"left-0",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ae=>{ae.stopPropagation(),He(false),Je(false),bt(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:R,onChange:ae=>P(ae.target.value),placeholder:n==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:b("w-full bg-transparent text-sm outline-none placeholder:opacity-40",c?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:ae=>{if(ae.key==="Enter"&&R.trim()){let X=t.availableUsers?.find(ee=>ee.id===$),Te=Be||H.date;a.onTaskCreate?.({name:R.trim(),startDate:Te,endDate:Te,priority:J,assignees:X?[X]:void 0}),P(""),q(void 0),ke(null),at(null),A(null);}ae.key==="Escape"&&(A(null),P(""),q(void 0),ke(null),at(null));}})}),jsxRuntime.jsxs("div",{className:b("px-2.5 py-2 flex items-center justify-between border-t",c?"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:ae=>{ae.stopPropagation(),He(!Ae),Je(false);},className:b("p-1 rounded transition-colors",J?J==="urgent"||J==="high"?"text-red-400 bg-red-500/20":J==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":c?"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:Ae&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ae=>ae.stopPropagation(),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(ae=>jsxRuntime.jsxs("button",{onClick:()=>{q(ae.id),He(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",J===ae.id&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",ae.color)}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:ae.label})]},ae.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:ae=>{ae.stopPropagation(),bt(!Pt),He(false),Je(false),O(Be||H.date);},className:b("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Be?"bg-[#7C3AED]/20 text-[#7C3AED]":c?"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"}),(Be||H.date).toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Pt&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ae=>ae.stopPropagation(),children:[jsxRuntime.jsx("div",{className:b("w-40 py-2 border-r",c?"border-white/10":"border-gray-200"),children:(()=>{let ae=new Date,X=new Date(ae);X.setDate(ae.getDate()+1);let Te=new Date(ae);Te.setDate(ae.getDate()+((6-ae.getDay()+7)%7||7));let ee=new Date(ae);ee.setDate(ae.getDate()+((1-ae.getDay()+7)%7||7));let ze=new Date(ae);ze.setDate(ae.getDate()+14);let Fe=new Date(ae);return Fe.setDate(ae.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:ae,display:ae.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:X,display:X.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Te,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:ee,display:n==="es"?"lun.":"mon."},{label:n==="es"?"2 semanas":"2 weeks",date:ze,display:ze.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Fe,display:Fe.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ie,pe)=>jsxRuntime.jsxs("button",{className:b("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",c?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{at(Ie.date),bt(false);},children:[jsxRuntime.jsx("span",{children:Ie.label}),jsxRuntime.jsx("span",{className:b("text-[10px]",c?"text-[#6B7280]":"text-gray-400"),children:Ie.display})]},pe))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:b("text-xs font-medium",c?"text-white":"text-gray-900"),children:rt.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>O(new Date),className:b("px-1.5 py-0.5 rounded text-[10px] transition-colors",c?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>O(new Date(rt.getFullYear(),rt.getMonth()-1)),className:b("p-0.5 rounded",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>O(new Date(rt.getFullYear(),rt.getMonth()+1)),className:b("p-0.5 rounded",c?"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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(ae=>jsxRuntime.jsx("div",{className:b("w-6 h-6 flex items-center justify-center text-[10px]",c?"text-[#6B7280]":"text-gray-400"),children:ae},ae))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ae=rt.getFullYear(),X=rt.getMonth(),Te=new Date(ae,X,1).getDay(),ee=new Date(ae,X+1,0).getDate(),ze=new Date(ae,X,0).getDate(),Fe=new Date,Ze=[];for(let pe=Te-1;pe>=0;pe--)Ze.push({dayNum:ze-pe,isCurrentMonth:false,date:new Date(ae,X-1,ze-pe)});for(let pe=1;pe<=ee;pe++)Ze.push({dayNum:pe,isCurrentMonth:true,date:new Date(ae,X,pe)});let Ie=42-Ze.length;for(let pe=1;pe<=Ie;pe++)Ze.push({dayNum:pe,isCurrentMonth:false,date:new Date(ae,X+1,pe)});return Ze.map((pe,Re)=>{let ot=pe.date.toDateString()===Fe.toDateString(),Y=(Be||H.date).toDateString()===pe.date.toDateString();return jsxRuntime.jsx("button",{className:b("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!pe.isCurrentMonth&&(c?"text-[#4B5563]":"text-gray-300"),pe.isCurrentMonth&&(c?"text-white":"text-gray-900"),ot&&"ring-1 ring-[#3B82F6]",Y&&"bg-[#7C3AED] text-white",!Y&&(c?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{at(pe.date),bt(false);},children:pe.dayNum},Re)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:ae=>{ae.stopPropagation(),Je(!we),He(false);},className:b("p-1 rounded transition-colors",$?"text-[#7C3AED] bg-[#7C3AED]/20":c?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:$?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(ae=>ae.id===$)?.color||"#7C3AED"},children:t.availableUsers?.find(ae=>ae.id===$)?.initials||t.availableUsers?.find(ae=>ae.id===$)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:we&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ae=>ae.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{ke(null),Je(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",!$&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:b("w-5 h-5 rounded-full flex items-center justify-center",c?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:c?"text-[#9CA3AF]":"text-gray-500",children:n==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(ae=>jsxRuntime.jsxs("button",{onClick:()=>{ke(ae.id),Je(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",$===ae.id&&(c?"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:ae.color||"#7C3AED"},children:ae.initials||ae.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:ae.name})]},ae.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:b("px-3 py-2 text-xs",c?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(R.trim()){let ae=t.availableUsers?.find(Te=>Te.id===$),X=Be||H.date;a.onTaskCreate?.({name:R.trim(),startDate:X,endDate:X,priority:J,assignees:ae?[ae]:void 0}),P(""),q(void 0),ke(null),at(null),A(null);}},disabled:!R.trim(),className:b("px-2.5 py-1 rounded text-xs font-medium transition-colors",R.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":c?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:n==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:b("text-sm font-medium",H.isToday?"text-[#3B82F6]":H.isCurrentMonth?c?"text-white":"text-gray-900":c?"text-[#6B7280]":"text-gray-400"),children:H.date.getDate()})]})]},Se)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>y(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:b("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",c?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:b("px-6 py-3 border-b flex items-center gap-3",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:b("w-4 h-4",c?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:b("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:b("text-xs font-mono",c?"text-[#6B7280]":"text-gray-400"),children:u.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:b("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",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:b("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:b("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:()=>y(null),className:b("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 H=u.progress===100?0:100,et={...u,progress:H,status:H===100?"completed":"todo"};y(et),a.onTaskUpdate?.(et);},className:b("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",u.progress===100?"bg-green-500 border-green-500":c?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:u.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:b("text-xl font-semibold flex-1",u.progress===100?"line-through text-[#6B7280]":c?"text-white":"text-gray-900"),children:u.name})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:b("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Kt(),V(!K);},className:b("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",u.progress===100||u.status==="completed"?"bg-green-500/20 text-green-400":u.progress&&u.progress>0||u.status==="in-progress"?"bg-blue-500/20 text-blue-400":c?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:u.progress===100||u.status==="completed"?n==="es"?"COMPLETADO":"DONE":u.progress&&u.progress>0||u.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:K&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>V(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",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-white/10 text-white"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(H=>jsxRuntime.jsxs("button",{onClick:()=>be(H.id),className:b("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",(u.status===H.id||H.id==="completed"&&u.progress===100||H.id==="in-progress"&&u.progress&&u.progress>0&&u.progress<100||H.id==="todo"&&(!u.progress||u.progress===0)&&u.status!=="in-progress"&&u.status!=="completed")&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",H.id==="completed"?"bg-green-500":H.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:H.label})]},H.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:b("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),u.assignees&&u.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[u.assignees.slice(0,3).map((H,Se)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:H.color||"#8B5CF6"},title:H.name,children:H.initials||H.name.slice(0,2).toUpperCase()},Se)),u.assignees.length>3&&jsxRuntime.jsxs("span",{className:b("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:["+",u.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:b("text-sm",c?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:b("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{M(T?null:"start"),L(u.startDate||new Date);},className:b("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:[u.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:b("mx-1",c?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),u.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(u.startDate||u.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:H=>{H.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>M(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:b("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:H=>H.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:b("w-44 py-2 border-r",c?"border-white/10":"border-gray-200"),children:[(()=>{let H=new Date,Se=new Date(H);Se.setDate(H.getDate()+1);let et=new Date(H);et.setDate(H.getDate()+((6-H.getDay()+7)%7||7));let Ce=new Date(H);Ce.setDate(H.getDate()+((1-H.getDay()+7)%7||7));let Ee=new Date(H);Ee.setDate(H.getDate()+(6-H.getDay()+7)%7+7);let ae=new Date(H);ae.setDate(H.getDate()+14);let X=new Date(H);return X.setDate(H.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:H,display:H.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Se,display:Se.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:et,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ce,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Ee,display:Ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:ae,display:ae.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:X,display:X.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ee,ze)=>jsxRuntime.jsxs("button",{className:b("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(T==="start"){let Fe=u.endDate&&ee.date>u.endDate?ee.date:u.endDate;Ne(ee.date,Fe),M("end");}else {let Fe=u.startDate&&ee.date<u.startDate?ee.date:u.startDate;Ne(Fe,ee.date),M(null);}},children:[jsxRuntime.jsx("span",{children:ee.label}),jsxRuntime.jsx("span",{className:b("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:ee.display})]},ze))})(),jsxRuntime.jsx("div",{className:b("border-t mt-2 pt-2",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Ne(void 0,void 0),M(null);},className:b("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:b("text-xs mb-3 px-2 py-1 rounded",c?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:T==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:b("font-medium",c?"text-white":"text-gray-900"),children:x.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:()=>L(new Date),className:b("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:()=>L(new Date(x.getFullYear(),x.getMonth()-1)),className:b("p-1 rounded",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>L(new Date(x.getFullYear(),x.getMonth()+1)),className:b("p-1 rounded",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(H=>jsxRuntime.jsx("div",{className:b("w-8 h-8 flex items-center justify-center text-xs",c?"text-[#6B7280]":"text-gray-400"),children:H},H))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let H=x.getFullYear(),Se=x.getMonth(),et=new Date(H,Se,1).getDay(),Ce=new Date(H,Se+1,0).getDate(),Ee=new Date(H,Se,0).getDate(),ae=new Date,X=[];for(let ee=et-1;ee>=0;ee--)X.push({day:Ee-ee,isCurrentMonth:false,date:new Date(H,Se-1,Ee-ee)});for(let ee=1;ee<=Ce;ee++)X.push({day:ee,isCurrentMonth:true,date:new Date(H,Se,ee)});let Te=42-X.length;for(let ee=1;ee<=Te;ee++)X.push({day:ee,isCurrentMonth:false,date:new Date(H,Se+1,ee)});return X.map((ee,ze)=>{let Fe=ee.date.toDateString()===ae.toDateString(),Ze=u.startDate?.toDateString()===ee.date.toDateString(),Ie=u.endDate?.toDateString()===ee.date.toDateString(),pe=Ze||Ie,Re=u.startDate&&u.endDate&&ee.date>=u.startDate&&ee.date<=u.endDate;return jsxRuntime.jsx("button",{className:b("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!ee.isCurrentMonth&&(c?"text-[#4B5563]":"text-gray-300"),ee.isCurrentMonth&&(c?"text-white":"text-gray-900"),Fe&&"ring-2 ring-[#3B82F6]",Ze&&"bg-[#3B82F6] text-white",Ie&&!Ze&&"bg-[#7C3AED] text-white",Re&&!pe&&(c?"bg-[#7C3AED]/20":"bg-purple-100"),!pe&&(c?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let ot=new Date(ee.date);if(T==="start"){let Y=u.endDate&&ot>u.endDate?ot:u.endDate;Ne(ot,Y),M("end");}else {let Y=u.startDate&&ot<u.startDate?ot:u.startDate;Ne(Y,ot),M(null);}},children:ee.day},ze)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:b("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Kt(),Q(!z);},className:b("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",u.priority==="high"||u.priority==="urgent"?"bg-red-500/20 text-red-400":u.priority==="medium"?"bg-yellow-500/20 text-yellow-400":u.priority==="low"?"bg-green-500/20 text-green-400":c?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:u.priority?u.priority==="high"||u.priority==="urgent"?n==="es"?"Urgente":"Urgent":u.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Q(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden 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(H=>jsxRuntime.jsxs("button",{onClick:()=>{$e("priority",H.id),Q(false);},className:b("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",u.priority===H.id&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",H.color)}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:H.label})]},H.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:b("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:b("text-sm",c?"text-white":"text-gray-900"),children:u.startDate&&u.endDate?`${Math.ceil((u.endDate.getTime()-u.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded-full border-2",c?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:b("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:[ue?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:u.progress||0,onChange:H=>{let Se=parseInt(H.target.value),et=u.status;Se===100?et="completed":Se>0?et="in-progress":et="todo";let Ce={...u,progress:Se,status:et};y(Ce),a.onTaskUpdate?.(Ce);},onBlur:()=>ve(false),className:b("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:()=>ve(true),className:b("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",c?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:b("h-full rounded-full transition-all",u.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${u.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:b("text-sm font-medium min-w-[40px]",c?"text-white":"text-gray-900"),children:[u.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:b("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx($a,{selectedTags:u.tags||[],availableTags:m,onChange:H=>{$e("tags",H);},onCreateTag:d,theme:w})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:b("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:b("text-sm",c?"text-[#6B7280]":"text-gray-400"),children:u.dependencies&&u.dependencies.length>0?`${u.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:b("flex items-center gap-2 text-sm transition-colors",c?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),n==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:b("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:b("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold mb-3",c?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",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:b("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold mb-3",c?"text-white":"text-gray-900"),children:n==="es"?"Agregar subtarea":"Add subtask"}),u.subtasks&&u.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:u.subtasks.map(H=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",H.progress===100?"bg-green-500 border-green-500":c?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:H.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:b("text-sm",H.progress===100?"line-through text-[#6B7280]":c?"text-white":"text-gray-900"),children:H.name})]},H.id))}),jsxRuntime.jsxs("button",{className:b("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"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:b("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:b("text-sm font-semibold",c?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:b("p-1 rounded transition-colors",c?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",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:b("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold mb-3",c?"text-white":"text-gray-900"),children:n==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:b("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",c?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:b("w-6 h-6 mx-auto mb-2",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("p",{className:b("text-sm",c?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Suelta tus archivos aqu\xED para ":"Drop your files here to ",jsxRuntime.jsx("span",{className:b("underline",c?"text-white":"text-gray-700"),children:n==="es"?"subir":"upload"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:b("w-[280px] border-l flex flex-col",c?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:b("px-4 py-3 border-b flex items-center justify-between",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:b("font-medium",c?"text-white":"text-gray-900"),children:n==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:b("text-sm text-center py-8",c?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),n==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:b("p-3 border-t",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:b("flex items-center gap-2 px-3 py-2 rounded-lg",c?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",className:b("flex-1 bg-transparent text-sm outline-none",c?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>D(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:b("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",c?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:b("px-4 py-3 border-b flex items-center justify-between",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:b("font-medium",c?"text-white":"text-gray-900"),children:v.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>D(null),className:b("p-1 rounded",c?"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:v.events.map(H=>jsxRuntime.jsxs("button",{onClick:()=>{D(null),y(H.task);},className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",c?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Ac,{task:H.task}),jsxRuntime.jsx("span",{className:b("text-sm truncate flex-1",c?"text-white":"text-gray-900"),children:H.title}),H.task.priority==="high"||H.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},H.id))})]})]})})]})}var Mi={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"},Ai={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"},Ii={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"},zn={dark:Mi,light:Ai,neutral:Ii};function Lc(e){return zn[e]||zn.dark}function V0({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:i,className:p}){let[m,d]=react.useState(false),l=react.useMemo(()=>t.filter(f=>e.cardIds.includes(f.id)),[t,e.cardIds]),n=react.useMemo(()=>{let f=l.length,c=new Set(l.flatMap(k=>k.assignedUserIds||[])).size,w=l.map(k=>k.priority).filter(Boolean),h=new Set(l.flatMap(k=>k.labels||[])).size;return {totalCards:f,uniqueAssignees:c,priorities:w,labels:h}},[l]),g=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:b("card-stack",!e.isExpanded&&"card-stack-collapsed",p),onMouseEnter:()=>d(true),onMouseLeave:()=>d(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:b("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:n.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:f=>{f.stopPropagation(),i?.(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:[n.uniqueAssignees," assignees"]})]}),n.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:[n.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:l.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:l.map(f=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(f),children:a(f)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(f),children:[jsxRuntime.jsx("h4",{children:f.title}),f.description&&jsxRuntime.jsxs("p",{children:[f.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:c=>{c.stopPropagation(),s?.(e.id,f.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"})]})})]},f.id))})})]})}var Rc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Lo(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 Bo(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 Oc(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 zc({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:i,className:p}){let m=react.useMemo(()=>({...Rc,...i}),[i]),[d,l]=react.useState(new Set),n=react.useRef(null),g=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let u=new Map;return e.forEach(y=>{let v=y.timestamp.toISOString().split("T")[0],D=u.get(v);D?D.push(y):u.set(v,[y]);}),Array.from(u.entries()).sort((y,v)=>v[0].localeCompare(y[0])).map(([y,v])=>({date:new Date(y),events:v.sort((D,T)=>T.timestamp.getTime()-D.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:f,uniqueTypes:c}=react.useMemo(()=>{let u=new Set,y=new Set;return e.forEach(v=>{u.add(v.userId),y.add(v.type);}),{uniqueUsers:Array.from(u),uniqueTypes:Array.from(y)}},[e]),w=u=>{l(y=>{let v=new Set(y);return v.has(u)?v.delete(u):v.add(u),v});},h=u=>{let v=new Date().getTime()-u.getTime(),D=Math.floor(v/6e4),T=Math.floor(v/36e5),M=Math.floor(v/864e5);return D<1?"just now":D<60?`${D}m ago`:T<24?`${T}h ago`:M<7?`${M}d ago`:u.toLocaleDateString()},k=react.useMemo(()=>{let u=0;return t.types&&t.types.length>0&&u++,t.users&&t.users.length>0&&u++,t.dateRange&&u++,t.searchTerm&&u++,u},[t]);return react.useEffect(()=>{if(s&&n.current){let u=n.current.querySelector(`[data-event-id="${s}"]`);u&&u.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:b("history-timeline-empty",p),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:b("history-timeline",m.compact&&"compact",p),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:u=>{let y=u.target.value;a({...t,types:y?[y]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),c.map(u=>jsxRuntime.jsxs("option",{value:u,children:[Bo(u)," ",u.replace("_"," ")]},u))]}),f.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:u=>{let y=u.target.value;a({...t,users:y?[y]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),f.map(u=>jsxRuntime.jsx("option",{value:u,children:u},u))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:u=>a({...t,searchTerm:u.target.value})})]}),k>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",k,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:n,children:g.map(u=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&u.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:u.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[u.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:u.events.map((y,v)=>{let D=d.has(y.id),T=s===y.id,M=Oc(y.type);return jsxRuntime.jsxs("div",{"data-event-id":y.id,className:b("history-timeline-event",D&&"expanded",T&&"selected"),onClick:()=>o?.(y),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:M},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Bo(y.type)})}),v<u.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:M}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&y.userAvatar&&jsxRuntime.jsx("img",{src:y.userAvatar,alt:y.userName||y.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:y.userName||y.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Lo(y)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?h(y.timestamp):y.timestamp.toLocaleString()})]}),Object.keys(y.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:x=>{x.stopPropagation(),w(y.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(y.changes).map(([x,L])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[x,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(L.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(L.to)})]})]},x)),y.metadata&&Object.keys(y.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(y.metadata).map(([x,L])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[x,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(L)})]},x))]})]})]})]},y.id)})})]},u.date?.toISOString()||"all"))})]})}function Uc({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:i,onGoToEvent:p,onSpeedChange:m,className:d}){let l=[.5,1,1.5,2,3],n=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:b("history-replay-empty",d),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:b("history-replay",d),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:n&&Bo(n.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:n&&Lo(n)}),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:n&&n.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:f=>p(parseInt(f.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${g}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((f,c)=>jsxRuntime.jsx("div",{className:b("history-replay-progress-marker",c===e.currentIndex&&"active"),style:{left:`${c/(e.totalEvents-1)*100}%`},onClick:()=>p(c),title:Lo(f)},f.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:i,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:l.map(f=>jsxRuntime.jsxs("button",{className:b("history-replay-speed-btn",e.speed===f&&"active"),onClick:()=>m(f),children:[f,"x"]},f))})]}),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:n&&n.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(f=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:f},f))})]})]})]})]}):jsxRuntime.jsxs("div",{className:b("history-replay-start",d),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 Fi(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 Li(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 Wc(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 Hc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function J0(e,t,a,r,o,s=100){let i=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),p=new Map(i.map(m=>[m.id,m]));for(let m=0;m<s;m++){let d=1-m/s;i.forEach(l=>{let n=a/2,g=r/2;l.vx+=(n-l.x)*o.centerForce*d,l.vy+=(g-l.y)*o.centerForce*d,i.forEach(f=>{if(l.id===f.id)return;let c=l.x-f.x,w=l.y-f.y,h=Math.sqrt(c*c+w*w)||1,k=o.chargeStrength*d/(h*h);l.vx+=c/h*k,l.vy+=w/h*k;});}),t.forEach(l=>{let n=p.get(typeof l.source=="string"?l.source:l.source.id),g=p.get(typeof l.target=="string"?l.target:l.target.id);if(!n||!g)return;let f=g.x-n.x,c=g.y-n.y,w=Math.sqrt(f*f+c*c)||1,h=(w-o.linkDistance)/w*o.forceStrength*d;n.vx+=f*h,n.vy+=c*h,g.vx-=f*h,g.vy-=c*h;}),i.forEach(l=>{l.fx!==null&&l.fx!==void 0?(l.x=l.fx,l.vx=0):l.x+=l.vx,l.fy!==null&&l.fy!==void 0?(l.y=l.fy,l.vy=0):l.y+=l.vy,l.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,l.x)),l.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,l.y)),l.vx*=.9,l.vy*=.9;});}return i}function Gc({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:i,onInteraction:p,className:m}){let d=react.useRef(null),[l,n]=react.useState([]),[g,f]=react.useState(null),[c,w]=react.useState(null),[h,k]=react.useState(null),[u,y]=react.useState(1),[v,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let I=J0(e,t,a.width,a.height,a,150);n(I);},[e,t,a]);let T=react.useCallback((I,K)=>{a.enableDragging&&(K.stopPropagation(),f(I));},[a.enableDragging]),M=react.useCallback(I=>{if(!g||!d.current)return;let V=d.current.getBoundingClientRect(),z=(I.clientX-V.left-v.x)/u,Q=(I.clientY-V.top-v.y)/u;n(ue=>ue.map(ve=>ve.id===g?{...ve,x:z,y:Q,fx:z,fy:Q}:ve));},[g,u,v]),x=react.useCallback(()=>{f(null);},[]),L=react.useCallback((I,K)=>{K.stopPropagation(),p?.({type:"node-click",node:I,position:{x:K.clientX,y:K.clientY}});},[p]),N=react.useCallback((I,K)=>{K.stopPropagation(),p?.({type:"edge-click",edge:I,position:{x:K.clientX,y:K.clientY}});},[p]),C=react.useCallback(I=>{let K=l.find(V=>V.id===I);return K?{x:K.x,y:K.y}:{x:0,y:0}},[l]),W=react.useCallback(I=>{if(I.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return I.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let K=I.card.priority;return K==="URGENT"?"#ef4444":K==="HIGH"?"#f59e0b":K==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return I.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:b("relationships-graph-empty",m),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:b("relationships-graph",m),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:i.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:i.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:()=>y(I=>Math.min(I+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(u*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>y(I=>Math.max(I-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{y(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(I=>I.type))).map(I=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Fi(I)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Wc(I)," ",Li(I)]})]},I))}),jsxRuntime.jsxs("svg",{ref:d,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:M,onMouseUp:x,onMouseLeave:x,children:[jsxRuntime.jsxs("g",{transform:`translate(${v.x}, ${v.y}) scale(${u})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(I=>{let K=C(typeof I.source=="string"?I.source:I.source.id),V=C(typeof I.target=="string"?I.target:I.target.id),z=Hc(I.type),Q=h===I.id,ue=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:b("relationships-graph-edge",Q&&"hovered",ue&&"critical"),onMouseEnter:()=>k(I.id),onMouseLeave:()=>k(null),onClick:ve=>N(I,ve),children:[jsxRuntime.jsx("line",{x1:K.x,y1:K.y,x2:V.x,y2:V.y,stroke:Fi(I.type),strokeWidth:ue?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Q?1:.6,markerEnd:z?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Q&&jsxRuntime.jsx("text",{x:(K.x+V.x)/2,y:(K.y+V.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Li(I.type)})]},I.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:l.map(I=>{let K=c===I.id,V=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:b("relationships-graph-node",K&&"hovered",V&&"critical"),transform:`translate(${I.x}, ${I.y})`,onMouseDown:z=>T(I.id,z),onMouseEnter:()=>w(I.id),onMouseLeave:()=>w(null),onClick:z=>L(I,z),children:[jsxRuntime.jsx("circle",{r:V?a.nodeSize*1.2:a.nodeSize,fill:W(I),stroke:V?"#fbbf24":"#ffffff",strokeWidth:V?3:2,opacity:K?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:I.card.title.length>20?I.card.title.substring(0,20)+"...":I.card.title})]},I.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 jc({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,i]=react.useState(""),[p,m]=react.useState(false),[d,l]=react.useState(null),[n,g]=react.useState(null),f=react.useRef(null),c=p||o;react.useEffect(()=>{e&&f.current&&f.current.focus();},[e]),react.useEffect(()=>{let u=y=>{y.key==="Escape"&&!c&&w();};if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,c]);let w=()=>{c||(i(""),l(null),g(null),t());},h=async()=>{if(!(!s.trim()||c)){m(true),l(null),g(null);try{let u=await r(s.trim());g(u);}catch(u){l(u instanceof Error?u.message:"Failed to generate plan");}finally{m(false);}}},k=()=>{n&&(a(n),w());};return e?jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:w}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:u=>u.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:w,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:n?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!"})]}),n.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:n.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",n.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:n.columns.map((u,y)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:u.title},y))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",n.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[n.cards.slice(0,10).map((u,y)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:u.title}),u.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:u.description})]}),u.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${u.priority==="URGENT"?"bg-red-500/20 text-red-400":u.priority==="HIGH"?"bg-orange-500/20 text-orange-400":u.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:u.priority})]})},y)),n.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",n.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:f,value:s,onChange:u=>i(u.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled: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."})]}),d&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:d}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((u,y)=>jsxRuntime.jsx("button",{onClick:()=>i(u),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:u},y))})]})]})}),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:w,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"}),n?jsxRuntime.jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,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 Bi={"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 Q0={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},eh={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 th(e,t,a){let r=Bi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Ro(e){return `$${e.toFixed(4)}`}var Ri=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=th(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(n=>n.timestamp>=t.start&&n.timestamp<=t.end));let r=a.length,o=a.reduce((n,g)=>n+g.cost,0),s=a.reduce((n,g)=>n+g.inputTokens,0),i=a.reduce((n,g)=>n+g.outputTokens,0),p=a.filter(n=>n.success),m=a.reduce((n,g)=>n+g.duration,0),d={},l={};return a.forEach(n=>{d[n.feature]=(d[n.feature]||0)+1,l[n.feature]=(l[n.feature]||0)+n.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:i,operationsByFeature:d,costsByFeature:l,averageDuration:r>0?m/r:0,successRate:r>0?p.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,i=new Date;a==="month"?i.setMonth(s.getMonth()-1):i.setDate(s.getDate()-1);let p=this.operations.filter(l=>l.timestamp>=i).length,m=Math.max(0,o-p),d=p/o*100;return {used:p,limit:o,remaining:m,percentUsed:d,isExceeded:p>=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)}},Br=new Ri;function qc({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Br.getStats()),[s,i]=react.useState(Br.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(Br.getStats()),i(Br.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=d=>{d.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let p=Br.getRecentOperations(5);return jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:m=>m.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ro(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([m,d])=>{let l=r.costsByFeature[m]||0,n=r.totalOperations>0?d/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:m.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[d," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ro(l)})]})]}),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:`${n}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),p.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:p.map(m=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ro(m.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function Zc({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[i,p]=react.useState(""),[m,d]=react.useState(""),[l,n]=react.useState(""),[g,f]=react.useState(false),[c,w]=react.useState(null),[h,k]=react.useState(null),[u,y]=react.useState(null),v=react.useRef(null),D=g||o;react.useEffect(()=>{e&&v.current&&v.current.focus();},[e]),react.useEffect(()=>{let N=C=>{C.key==="Escape"&&!D&&T();};if(e)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[e,D]);let T=()=>{D||(p(""),d(""),n(""),w(null),k(null),y(null),t());},M=async()=>{if(!(!i.trim()||D)){f(true),w(null),k(null),y(null);try{let N=await r({prompt:i.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:l||void 0});k(N.tasks.tasks),y({from_cache:N.from_cache,tokens_used:N.tokens_used,mock_mode:N.mock_mode,similarity:N.similarity,tokens_saved:N.tokens_saved});}catch(N){w(N instanceof Error?N.message:"Failed to generate tasks");}finally{f(false);}}},x=()=>{h&&(a(h),T());};if(!e)return null;let L=u?.similarity?((u.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(lt,{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:N=>N.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:T,disabled:D,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[u?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),u?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",L,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[u?.tokens_used||0," tokens"]}),u?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[u.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((N,C)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",C+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:N.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"})]}),N.start," \u2192 ",N.end]}),jsxRuntime.jsxs("span",{children:[N.duration," days"]}),N.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",N.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${N.priority==="high"?"bg-red-500/20 text-red-400":N.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:N.priority})]})},N.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:v,value:i,onChange:N=>p(N.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:D}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:N=>d(N.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:l,onChange:N=>n(N.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]})]}),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((N,C)=>jsxRuntime.jsx("button",{onClick:()=>p(N),disabled:D,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:N},C))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:D&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:T,disabled:D,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.jsx("button",{onClick:x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:M,disabled:!i.trim()||D,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function Wn({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&jo(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(k,u,y)=>{console.warn(`Retry attempt ${u} after ${y}ms: ${k.message}`);}}).then(k=>{k.success||console.error(`Failed to persist board after ${k.attempts} attempts:`,k.error);});},[t]),s=react.useCallback(async(h,k,u)=>{r(y=>{let v=y.cards.find(N=>N.id===h);if(!v)return y;let D=v.columnId,T={...v,columnId:k,position:u},M=y.cards.map(N=>N.id===h?T:N),x=y.columns.map(N=>{if(N.id===D)return {...N,cardIds:N.cardIds.filter(C=>C!==h)};if(N.id===k){let C=M.filter(W=>W.columnId===k).sort((W,I)=>W.position-I.position);return {...N,cardIds:C.map(W=>W.id)}}return N}),L={...y,cards:M,columns:x};return o(L),L});},[o]),i=react.useCallback(async(h,k)=>{r(u=>{let y=u.cards.map(D=>D.id===h?{...D,...k}:D),v={...u,cards:y};return o(v),v});},[o]),p=react.useCallback(async h=>{let k=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(u=>{let y={...h,id:k},v=u.columns.map(T=>T.id===h.columnId?{...T,cardIds:[...T.cardIds,k]}:T),D={...u,cards:[...u.cards,y],columns:v};return o(D),D});},[o]),m=react.useCallback(async h=>{r(k=>{let u=k.cards.find(T=>T.id===h);if(!u)return k;let y=k.cards.filter(T=>T.id!==h),v=k.columns.map(T=>T.id===u.columnId?{...T,cardIds:T.cardIds.filter(M=>M!==h)}:T),D={...k,cards:y,columns:v};return o(D),D});},[o]),d=react.useCallback(async h=>{let k=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(u=>{let y={...h,id:k,cardIds:[]},v={...u,columns:[...u.columns,y]};return o(v),v});},[o]),l=react.useCallback(async(h,k)=>{r(u=>{let y=u.columns.map(D=>D.id===h?{...D,...k}:D),v={...u,columns:y};return o(v),v});},[o]),n=react.useCallback(async h=>{r(k=>{let u=k.cards.filter(D=>D.columnId!==h),y=k.columns.filter(D=>D.id!==h),v={...k,cards:u,columns:y};return o(v),v});},[o]),g=react.useCallback(h=>{let k=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return p(h),k},[p]),f=react.useCallback(h=>{let k=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(h),k},[d]),c=react.useCallback(()=>{r(h=>{let k={...h,cards:[],columns:[]};return o(k),k});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:i,onCardCreate:p,onCardDelete:m,onColumnCreate:d,onColumnUpdate:l,onColumnDelete:n},setBoard:r,helpers:{addCard:g,addColumn:f,deleteCard:m,deleteColumn:n,clearBoard:c}}}function ep({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Wn({initialBoard:e,onPersist:a}),i=react.useMemo(()=>({addCard:(m,d,l={})=>{s.addCard({title:d,columnId:m,position:r.cards.filter(n=>n.columnId===m).length,...l});},addColumn:(m,d)=>{let l=r.columns.length>0?Math.max(...r.columns.map(n=>n.position)):0;s.addColumn({title:m,position:d??l+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:i}}var Oo={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},ap={by:"none",order:"asc"};function rp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Oo,...e}),[s,i]=react.useState({...ap,...t}),p=react.useCallback(w=>{o(h=>({...h,...w}));},[]),m=react.useCallback(w=>{i(h=>({...h,...w}));},[]),d=react.useCallback(()=>{o(Oo),i(ap);},[]),l=react.useCallback(()=>{a&&o({...Oo,assignees:[a]});},[a]),n=react.useCallback(()=>{o({...Oo,dateFilter:"overdue"});},[]),g=react.useCallback(()=>{o({...Oo,priorities:["HIGH","URGENT"]});},[]),f=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(w=>{let h=[...w];if(r.search){let k=r.search.toLowerCase();h=h.filter(u=>u.title.toLowerCase().includes(k)||u.description?.toLowerCase().includes(k));}if(r.dateFilter!=="all"){let k=new Date,u=k.getFullYear(),y=String(k.getMonth()+1).padStart(2,"0"),v=String(k.getDate()).padStart(2,"0"),D=`${u}-${y}-${v}`;h=h.filter(T=>{if(!T.endDate&&!T.dueDate)return false;let M=T.endDate||T.dueDate;if(!M)return false;let x;if(typeof M=="string")x=M.split("T")[0]||M;else {let L=M.getUTCFullYear(),N=String(M.getUTCMonth()+1).padStart(2,"0"),C=String(M.getUTCDate()).padStart(2,"0");x=`${L}-${N}-${C}`;}switch(r.dateFilter){case "overdue":return x<D;case "today":return x===D;case "this-week":let L=new Date(D+"T00:00:00"),N=new Date(x+"T00:00:00"),C=new Date(L);return C.setDate(C.getDate()+7),N>=L&&N<=C;case "custom":if(r.dateRange){let W=typeof M=="string"?new Date(M):M;return W>=r.dateRange.start&&W<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(k=>k.priority&&r.priorities.includes(k.priority))),r.assignees.length>0&&(h=h.filter(k=>(k.assignedUserIds||(k.assigneeId?[k.assigneeId]:[])).some(y=>r.assignees.includes(y)))),r.labels.length>0&&(h=h.filter(k=>k.labels&&k.labels.some(u=>r.labels.includes(u)))),r.columns.length>0&&(h=h.filter(k=>r.columns.includes(k.columnId))),s.by!=="none"&&h.sort((k,u)=>{let y=0;switch(s.by){case "created":let v=k.createdAt?new Date(k.createdAt).getTime():0,D=u.createdAt?new Date(u.createdAt).getTime():0;y=v-D;break;case "priority":let T={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},M=T[k.priority||"LOW"],x=T[u.priority||"LOW"];y=M-x;break;case "dueDate":let L=k.endDate||k.dueDate,N=u.endDate||u.dueDate;if(!L)return 1;if(!N)return -1;let C=typeof L=="string"?new Date(L).getTime():L.getTime(),W=typeof N=="string"?new Date(N).getTime():N.getTime();y=C-W;break;case "title":y=k.title.localeCompare(u.title);break;case "estimate":let I=k.estimatedTime||0,K=u.estimatedTime||0;y=I-K;break;default:y=0;}return s.order==="asc"?y:-y}),h},[r,s]);return {filters:r,sort:s,setFilters:p,setSort:m,resetFilters:d,filterMyTasks:l,filterOverdue:n,filterHighPriority:g,applyFilters:c,hasActiveFilters:f}}var np,sp;if(typeof window<"u")try{let e=Go("ai");np=e.generateObject,sp=e.generateText;}catch{}function ip(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(np&&sp&&e.apiKey),i=react.useCallback(async n=>{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:",n),{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: ${n}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(g){let f=g instanceof Error?g:new Error("Failed to generate plan");throw o(f),f}finally{a(false);}},[s]),p=react.useCallback(async n=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",n.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(g){let f=g instanceof Error?g:new Error("Failed to suggest assignee");throw o(f),f}finally{a(false);}},[s]),m=react.useCallback(async n=>{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 f=g instanceof Error?g:new Error("Failed to predict risks");throw o(f),f}finally{a(false);}},[s]),d=react.useCallback(async n=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",n.title),[{title:`Subtask 1 for: ${n.title}`,position:n.position+.1,columnId:n.columnId},{title:`Subtask 2 for: ${n.title}`,position:n.position+.2,columnId:n.columnId}]}catch(g){let f=g instanceof Error?g:new Error("Failed to generate subtasks");throw o(f),f}finally{a(false);}},[s]),l=react.useCallback(async n=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",n.title),{hours:8,confidence:.75}}catch(g){let f=g instanceof Error?g:new Error("Failed to estimate effort");throw o(f),f}finally{a(false);}},[s]);return {onGeneratePlan:i,onSuggestAssignee:p,onPredictRisks:m,onGenerateSubtasks:d,onEstimateEffort:l,isAvailable:s,isLoading:t,error:r}}function zi(){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 lp(e){let{cards:t}=e,[a,r]=zi(),o=react.useCallback(n=>a.selectedCardIds.includes(n),[a.selectedCardIds]),s=react.useCallback((n,g)=>{if(!g){r({selectedCardIds:[n],lastSelectedCardId:n});return}let f=g.ctrlKey||g.metaKey,c=g.shiftKey;if(f)a.selectedCardIds.includes(n)?r({selectedCardIds:a.selectedCardIds.filter(w=>w!==n),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,n],lastSelectedCardId:n});else if(c&&a.lastSelectedCardId){let w=t.find(k=>k.id===n),h=t.find(k=>k.id===a.lastSelectedCardId);if(w&&h&&w.columnId===h.columnId){let k=t.filter(x=>x.columnId===w.columnId).sort((x,L)=>x.position-L.position),u=k.findIndex(x=>x.id===a.lastSelectedCardId),y=k.findIndex(x=>x.id===n),[v,D]=u<y?[u,y]:[y,u],T=k.slice(v,D+1).map(x=>x.id),M=Array.from(new Set([...a.selectedCardIds,...T]));r({selectedCardIds:M,lastSelectedCardId:n});}else r({selectedCardIds:[n],lastSelectedCardId:n});}else r({selectedCardIds:[n],lastSelectedCardId:n});},[t,a,r]),i=react.useCallback(n=>{r({selectedCardIds:a.selectedCardIds.filter(g=>g!==n),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),p=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(n=>n.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),d=react.useCallback(n=>{a.selectedCardIds.includes(n)?i(n):r({selectedCardIds:[...a.selectedCardIds,n],lastSelectedCardId:n});},[a,i,r]),l=react.useCallback(()=>t.filter(n=>a.selectedCardIds.includes(n.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:i,clearSelection:p,selectAll:m,toggleCard:d,getSelectedCards:l}}var dp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function cp(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...dp,...a}),[a]),[s,i]=react.useState([]),p=react.useCallback((w,h,k,u,y)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let v={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:w,cardIds:h,columnId:k,strategy:u,color:y,isExpanded:true,position:s.filter(D=>D.columnId===k).length,createdAt:new Date};i(D=>[...D,v]);},[o.minCardsPerStack,s]),m=react.useCallback(w=>{i(h=>h.filter(k=>k.id!==w));},[]),d=react.useCallback(w=>{i(h=>h.map(k=>k.id===w?{...k,isExpanded:!k.isExpanded}:k));},[]),l=react.useCallback((w,h)=>{i(k=>k.map(u=>u.id===w&&!u.cardIds.includes(h)?{...u,cardIds:[...u.cardIds,h]}:u));},[]),n=react.useCallback((w,h)=>{i(k=>k.map(u=>{if(u.id===w){let y=u.cardIds.filter(v=>v!==h);return y.length<o.minCardsPerStack?null:{...u,cardIds:y}}return u}).filter(u=>u!==null));},[o.minCardsPerStack]),g=react.useCallback(w=>s.filter(h=>h.columnId===w).sort((h,k)=>h.position-k.position),[s]),f=react.useCallback(async w=>{let h=t.filter(D=>D.columnId===w);if(h.length<o.minCardsPerStack*2)return [];let k=[],u=new Map;h.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(T=>{u.has(T)||u.set(T,[]),u.get(T).push(D);});}),u.forEach((D,T)=>{D.length>=o.minCardsPerStack&&k.push({stack:{title:`\u{1F4CC} ${T}`,cardIds:D.map(M=>M.id),columnId:w,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${T}"`,confidence:.85});});let y=new Map;h.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(T=>{y.has(T)||y.set(T,[]),y.get(T).push(D);});}),y.forEach((D,T)=>{D.length>=o.minCardsPerStack&&k.push({stack:{title:`\u{1F464} Assigned to user-${T.slice(-4)}`,cardIds:D.map(M=>M.id),columnId:w,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let v=new Map;if(h.forEach(D=>{D.priority&&(v.has(D.priority)||v.set(D.priority,[]),v.get(D.priority).push(D));}),v.forEach((D,T)=>{if(D.length>=o.minCardsPerStack){let M={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[T.toLowerCase()]||"\u26AA";k.push({stack:{title:`${M} ${T} Priority`,cardIds:D.map(x=>x.id),columnId:w,strategy:"priority",color:T==="high"||T==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${T} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of h){let M=(await r.findSimilar(D,h)).filter(x=>x.similarity>=o.autoStackConfidenceThreshold);if(M.length>=o.minCardsPerStack-1){let x=[D.id,...M.map(N=>N.card.id)],L=M.reduce((N,C)=>N+C.similarity,0)/M.length;k.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:x,columnId:w,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${M.length+1} similar tasks`,confidence:L});}}return k.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,T)=>T.confidence-D.confidence).slice(0,5)},[t,o,r]),c=react.useCallback(w=>{p(w.stack.title,w.stack.cardIds,w.stack.columnId,w.stack.strategy,w.stack.color);},[p]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let k=await f(h),u=k[0];k.length>0&&u&&u.confidence>=.9&&c(u);});},[]),{stacks:s,createStack:p,deleteStack:m,toggleStack:d,addToStack:l,removeFromStack:n,getStacksForColumn:g,getSuggestions:f,applySuggestion:c,config:o}}var pp=react.createContext(null);function mp({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,i=new Map;t?.columns?.forEach(m=>{let{Column:d}=Go("@libxai/core");s.set(m.id,new d(m));}),t?.cards?.forEach(m=>{let{Card:d}=Go("@libxai/core");i.set(m.id,new d(m));});let p=null;if(t?.board){let{Board:m}=Go("@libxai/core");p=new m(t.board);}r.current=new core.BoardStore({board:p,columns:s,cards:i});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(pp.Provider,{value:{store:o},children:e})}function Hn(){let e=react.useContext(pp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function $o(){let e=Hn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,i]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),i(e.getAllCards());}),[e]);let p=react.useCallback(u=>{e.updateBoard(u);},[e]),m=react.useCallback(u=>{e.addColumn(u);},[e]),d=react.useCallback((u,y)=>{e.updateColumn(u,y);},[e]),l=react.useCallback(u=>{e.deleteColumn(u);},[e]),n=react.useCallback(u=>e.getColumn(u),[e]),g=react.useCallback(u=>{e.addCard(u);},[e]),f=react.useCallback((u,y)=>{e.updateCard(u,y);},[e]),c=react.useCallback(u=>{e.deleteCard(u);},[e]),w=react.useCallback((u,y,v)=>{e.moveCard(u,y,v);},[e]),h=react.useCallback(u=>e.getCard(u),[e]),k=react.useCallback(u=>e.getCardsByColumn(u),[e]);return {board:t,columns:r,cards:s,updateBoard:p,addColumn:m,updateColumn:d,deleteColumn:l,getColumn:n,addCard:g,updateCard:f,deleteCard:c,moveCard:w,getCard:h,getCardsByColumn:k}}function gp(e){let{cards:t}=$o();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 fp(e="position",t="asc"){let{cards:a}=$o();return react.useMemo(()=>[...a].sort((o,s)=>{let i=0;switch(e){case "title":i=o.title.localeCompare(s.title);break;case "priority":{let p={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?p[o.priority]:0,d=s.priority?p[s.priority]:0;i=m-d;break}case "createdAt":i=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":i=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":i=o.position-s.position;break}return t==="asc"?i:-i}),[a,e,t])}var Gn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=hl.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 i=s[t];if(typeof i=="function")try{let p=await Promise.resolve(i.apply(s,a));p!==void 0&&(o=p,a[0]=p);}catch(p){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,p,{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(i=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,i,{plugin:o.id,hook:t});}));}await Promise.all(r);}},yh=new Gn;function bp({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:i=false,gap:p=0,getItemKey:m}){let d=react.useRef(null),l=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>d.current,estimateSize:()=>a,overscan:s,horizontal:i,gap:p}),n=l.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},f=i?{width:`${l.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${l.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:d,style:g,className:o,children:jsxRuntime.jsx("div",{style:f,children:n.map(c=>{let w=e[c.index];if(!w)return null;let h=m?m(w,c.index):c.index,k={position:"absolute",top:i?0:c.start,left:i?c.start:0,width:i?c.size:"100%",height:i?"100%":c.size};return jsxRuntime.jsx("div",{style:k,"data-index":c.index,children:r(w,c.index)},h)})})})}function yp(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 xp({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:i=3,gap:p=16,getItemKey:m,horizontal:d=true}){let l=react.useRef(null),n=reactVirtual.useVirtualizer({horizontal:d,count:e.length,getScrollElement:()=>l.current,estimateSize:()=>r,overscan:i,gap:p}),g=n.getVirtualItems(),f={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},c={width:`${n.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:l,style:f,className:s,children:jsxRuntime.jsx("div",{style:c,children:g.map(w=>{let h=e[w.index];if(!h)return null;let k=m?m(h,w.index):w.index,u={position:"absolute",top:0,left:w.start,width:w.size,height:"100%"};return jsxRuntime.jsx("div",{style:u,"data-index":w.index,children:o(h,w.index)},k)})})})}function kp(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 wp(e,t=10){return e>t}var Hi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Gi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},_i={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Vi={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},ji={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ki={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Yi={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},qi={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)"},Xi={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)"},Ji={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Zi={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}},Qi={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}},_n={spacing:Hi,borderRadius:Gi,fontSize:_i,fontWeight:Vi,lineHeight:ji,zIndex:Ki,duration:Yi,easing:qi,shadows:Xi,opacity:Ji,kanban:Zi,gantt:Qi};function Cp(e,t,a){return e[t]??a}function el(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)?el(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function kh(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function tl(e="asakaa"){let t=el(_n),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,i=kh(o);a.push(` ${s}: ${i};`);}return `:root {
390
390
  ${a.join(`
391
391
  `)}
392
- }`}function Uo(e,t="asakaa"){let a=[],r=el(e);for(let[o,s]of Object.entries(r)){let l=`--${t}-color-${o}`;a.push(` ${l}: ${s};`);}return `:root {
392
+ }`}function Uo(e,t="asakaa"){let a=[],r=el(e);for(let[o,s]of Object.entries(r)){let i=`--${t}-color-${o}`;a.push(` ${i}: ${s};`);}return `:root {
393
393
  ${a.join(`
394
394
  `)}
395
395
  }`}var Vn={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"}},al={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"}},rl={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 ol(e=Vn,t="asakaa"){let a=tl(t),r=Uo(e,t);return `${a}
@@ -415,6 +415,6 @@ ${Uo(rl,"asakaa").split(`
415
415
  `).slice(1,-1).join(`
416
416
  `)}
417
417
  }
418
- `}var wh=({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 Dp({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=eo();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([l,p])=>{let m=l,n=m===r;return jsxRuntime.jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${n?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${p.displayName} theme`,"aria-pressed":n,title:p.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(wh,{theme:m})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:p.displayName})]},m)})})}
419
- Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=qc;exports.AI_FEATURES=eh;exports.AI_MODELS=Bi;exports.AddCardButton=vs;exports.AddColumnButton=ys;exports.AttachmentUploader=Wa;exports.BoardProvider=mp;exports.BulkOperationsToolbar=nn;exports.BurnDownChart=As;exports.CalendarBoard=Lc;exports.Card=ja;exports.CardDetailModal=Ds;exports.CardDetailModalV2=Es;exports.CardHistoryReplay=Uc;exports.CardHistoryTimeline=zc;exports.CardRelationshipsGraph=Gc;exports.CardStack=V0;exports.CardTemplateSelector=zs;exports.CircuitBreaker=Qn;exports.Column=Vr;exports.ColumnManager=mn;exports.CommandPalette=ws;exports.ConfigMenu=Hs;exports.ContextMenu=ro;exports.DEFAULT_SHORTCUTS=To;exports.DEFAULT_TEMPLATES=Os;exports.DateRangePicker=go;exports.DependenciesSelector=ho;exports.DependencyLine=vn;exports.DistributionCharts=Is;exports.EditableColumnTitle=is;exports.ErrorBoundary=Xr;exports.ExportImportModal=Us;exports.FilterBar=Ws;exports.GANTT_AI_SYSTEM_PROMPT=uc;exports.GanttAIAssistant=Nn;exports.GanttBoard=mc;exports.GanttI18nContext=ao;exports.GanttMilestone=kn;exports.GanttToolbar=pn;exports.GenerateGanttTasksDialog=Zc;exports.GeneratePlanModal=jc;exports.GroupBySelector=Bs;exports.KanbanBoard=lr;exports.KanbanToolbar=hs;exports.KanbanViewAdapter=ko;exports.KeyboardShortcutsHelp=Rs;exports.ListView=Dc;exports.MenuIcons=St;exports.PluginManager=Gn;exports.PrioritySelector=wr;exports.RATE_LIMITS=Q0;exports.SwimlaneBoardView=Ls;exports.TagBadge=ds;exports.TagList=jl;exports.TagPicker=sr;exports.TaskBar=hn;exports.TaskFormModal=Dn;exports.TaskGrid=fn;exports.ThemeModal=js;exports.ThemeProvider=Nd;exports.ThemeSwitcher=Dp;exports.Timeline=Cn;exports.UserAssignmentSelector=Tr;exports.VelocityChart=Ms;exports.VirtualGrid=xp;exports.VirtualList=bp;exports.aiUsageTracker=Br;exports.borderRadius=Gi;exports.calculatePosition=Vo;exports.calendarDarkTheme=Mi;exports.calendarEnTranslations=Ci;exports.calendarEsTranslations=Ti;exports.calendarLightTheme=Ai;exports.calendarNeutralTheme=Ii;exports.calendarThemes=zn;exports.calendarTranslations=Ln;exports.cardToGanttTask=En;exports.cardsToGanttTasks=xc;exports.cn=y;exports.createKanbanView=nd;exports.createRetryWrapper=Gp;exports.darkTheme=Gs;exports.darkTokenTheme=Vn;exports.defaultTheme=ln;exports.designTokens=_n;exports.duration=Yi;exports.easing=qi;exports.exportTokensToCSS=Tp;exports.findTaskByName=Xa;exports.fontSize=_i;exports.fontWeight=Vi;exports.formatCost=Ro;exports.ganttEnTranslations=cn;exports.ganttEsTranslations=Ed;exports.ganttTaskToCardUpdate=vc;exports.ganttThemes=je;exports.ganttTokens=Qi;exports.ganttTranslations=Ks;exports.ganttUtils=me;exports.generateCSSVariables=tl;exports.generateCompleteCSS=ol;exports.generateInitialPositions=$p;exports.generateTasksContext=gc;exports.generateThemeVariables=Uo;exports.getCalendarTheme=Fc;exports.getCalendarTranslations=Lo;exports.getListViewTheme=Nc;exports.getListViewTranslations=vi;exports.getMonthNames=Sc;exports.getToken=Cp;exports.getTranslations=Pd;exports.getWeekdayNames=Ec;exports.kanbanTokens=Zi;exports.lightTheme=_s;exports.lightTokenTheme=al;exports.lineHeight=ji;exports.listViewDarkTheme=xi;exports.listViewEnTranslations=bi;exports.listViewEsTranslations=yi;exports.listViewLightTheme=ki;exports.listViewNeutralTheme=wi;exports.listViewThemes=In;exports.listViewTranslations=Pn;exports.mergeCalendarTranslations=Fn;exports.mergeListViewTranslations=Mn;exports.mergeTranslations=Ys;exports.neutralTheme=Vs;exports.neutralTokenTheme=rl;exports.opacity=Ji;exports.parseLocalCommand=bc;exports.parseNaturalDate=gi;exports.parseNaturalDuration=fi;exports.parseProgress=hi;exports.parseStatus=hc;exports.pluginManager=yh;exports.retrySyncOperation=Hp;exports.retryWithBackoff=jo;exports.shadows=Xi;exports.shouldVirtualizeGrid=wp;exports.spacing=Hi;exports.themes=Er;exports.useAI=ip;exports.useBoard=ep;exports.useBoardCore=$o;exports.useBoardStore=Hn;exports.useCardStacking=cp;exports.useDragState=gs;exports.useFilteredCards=gp;exports.useFilters=rp;exports.useGanttI18n=Do;exports.useKanbanState=Wn;exports.useKeyboardShortcuts=Cd;exports.useMultiSelect=lp;exports.useSelectionState=zi;exports.useSortedCards=fp;exports.useTheme=eo;exports.useVirtualGrid=kp;exports.useVirtualList=yp;exports.validateAIResponse=yc;exports.withErrorBoundary=xs;exports.wouldCreateCircularDependency=Yo;exports.zIndex=Ki;//# sourceMappingURL=index.cjs.map
418
+ `}var wh=({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 Dp({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=eo();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([i,p])=>{let m=i,d=m===r;return jsxRuntime.jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${d?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${p.displayName} theme`,"aria-pressed":d,title:p.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(wh,{theme:m})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:p.displayName})]},m)})})}
419
+ Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=qc;exports.AI_FEATURES=eh;exports.AI_MODELS=Bi;exports.AddCardButton=vs;exports.AddColumnButton=ys;exports.AttachmentUploader=Ha;exports.BoardProvider=mp;exports.BulkOperationsToolbar=nn;exports.BurnDownChart=As;exports.CalendarBoard=Fc;exports.Card=Ka;exports.CardDetailModal=Ds;exports.CardDetailModalV2=Es;exports.CardHistoryReplay=Uc;exports.CardHistoryTimeline=zc;exports.CardRelationshipsGraph=Gc;exports.CardStack=V0;exports.CardTemplateSelector=zs;exports.CircuitBreaker=Qn;exports.Column=Vr;exports.ColumnManager=mn;exports.CommandPalette=ws;exports.ConfigMenu=Hs;exports.ContextMenu=ro;exports.DEFAULT_SHORTCUTS=To;exports.DEFAULT_TEMPLATES=Os;exports.DateRangePicker=go;exports.DependenciesSelector=ho;exports.DependencyLine=vn;exports.DistributionCharts=Is;exports.EditableColumnTitle=is;exports.ErrorBoundary=Xr;exports.ExportImportModal=Us;exports.FilterBar=Ws;exports.GANTT_AI_SYSTEM_PROMPT=uc;exports.GanttAIAssistant=Nn;exports.GanttBoard=mc;exports.GanttI18nContext=ao;exports.GanttMilestone=kn;exports.GanttToolbar=pn;exports.GenerateGanttTasksDialog=Zc;exports.GeneratePlanModal=jc;exports.GroupBySelector=Bs;exports.KanbanBoard=lr;exports.KanbanToolbar=hs;exports.KanbanViewAdapter=ko;exports.KeyboardShortcutsHelp=Rs;exports.ListView=Dc;exports.MenuIcons=St;exports.PluginManager=Gn;exports.PrioritySelector=wr;exports.RATE_LIMITS=Q0;exports.SwimlaneBoardView=Fs;exports.TagBadge=ds;exports.TagList=jl;exports.TagPicker=$a;exports.TaskBar=hn;exports.TaskFormModal=Dn;exports.TaskGrid=fn;exports.ThemeModal=js;exports.ThemeProvider=Nd;exports.ThemeSwitcher=Dp;exports.Timeline=Cn;exports.UserAssignmentSelector=Tr;exports.VelocityChart=Ms;exports.VirtualGrid=xp;exports.VirtualList=bp;exports.aiUsageTracker=Br;exports.borderRadius=Gi;exports.calculatePosition=Vo;exports.calendarDarkTheme=Mi;exports.calendarEnTranslations=Ci;exports.calendarEsTranslations=Ti;exports.calendarLightTheme=Ai;exports.calendarNeutralTheme=Ii;exports.calendarThemes=zn;exports.calendarTranslations=Fn;exports.cardToGanttTask=En;exports.cardsToGanttTasks=xc;exports.cn=b;exports.createKanbanView=nd;exports.createRetryWrapper=Gp;exports.darkTheme=Gs;exports.darkTokenTheme=Vn;exports.defaultTheme=ln;exports.designTokens=_n;exports.duration=Yi;exports.easing=qi;exports.exportTokensToCSS=Tp;exports.findTaskByName=Ja;exports.fontSize=_i;exports.fontWeight=Vi;exports.formatCost=Ro;exports.ganttEnTranslations=cn;exports.ganttEsTranslations=Ed;exports.ganttTaskToCardUpdate=vc;exports.ganttThemes=je;exports.ganttTokens=Qi;exports.ganttTranslations=Ks;exports.ganttUtils=de;exports.generateCSSVariables=tl;exports.generateCompleteCSS=ol;exports.generateInitialPositions=$p;exports.generateTasksContext=gc;exports.generateThemeVariables=Uo;exports.getCalendarTheme=Lc;exports.getCalendarTranslations=Fo;exports.getListViewTheme=Nc;exports.getListViewTranslations=vi;exports.getMonthNames=Sc;exports.getToken=Cp;exports.getTranslations=Pd;exports.getWeekdayNames=Ec;exports.kanbanTokens=Zi;exports.lightTheme=_s;exports.lightTokenTheme=al;exports.lineHeight=ji;exports.listViewDarkTheme=xi;exports.listViewEnTranslations=bi;exports.listViewEsTranslations=yi;exports.listViewLightTheme=ki;exports.listViewNeutralTheme=wi;exports.listViewThemes=In;exports.listViewTranslations=Pn;exports.mergeCalendarTranslations=Ln;exports.mergeListViewTranslations=Mn;exports.mergeTranslations=Ys;exports.neutralTheme=Vs;exports.neutralTokenTheme=rl;exports.opacity=Ji;exports.parseLocalCommand=bc;exports.parseNaturalDate=gi;exports.parseNaturalDuration=fi;exports.parseProgress=hi;exports.parseStatus=hc;exports.pluginManager=yh;exports.retrySyncOperation=Hp;exports.retryWithBackoff=jo;exports.shadows=Xi;exports.shouldVirtualizeGrid=wp;exports.spacing=Hi;exports.themes=Er;exports.useAI=ip;exports.useBoard=ep;exports.useBoardCore=$o;exports.useBoardStore=Hn;exports.useCardStacking=cp;exports.useDragState=gs;exports.useFilteredCards=gp;exports.useFilters=rp;exports.useGanttI18n=Do;exports.useKanbanState=Wn;exports.useKeyboardShortcuts=Cd;exports.useMultiSelect=lp;exports.useSelectionState=zi;exports.useSortedCards=fp;exports.useTheme=eo;exports.useVirtualGrid=kp;exports.useVirtualList=yp;exports.validateAIResponse=yc;exports.withErrorBoundary=xs;exports.wouldCreateCircularDependency=Yo;exports.zIndex=Ki;//# sourceMappingURL=index.cjs.map
420
420
  //# sourceMappingURL=index.cjs.map