@libxai/board 0.17.421 → 0.17.423

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'),mm=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),Pf=require('react-markdown'),Mf=require('remark-gfm'),Af=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var mm__default=/*#__PURE__*/_interopDefault(mm);var Pf__default=/*#__PURE__*/_interopDefault(Pf);var Mf__default=/*#__PURE__*/_interopDefault(Mf);var Af__default=/*#__PURE__*/_interopDefault(Af);var xn=(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 kn=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 [kn.Translate.toString(e),kn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function d(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function wn(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 Ou(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Rs(e,t){return e.length===0?1e3:t===0?wn(null,e[0].position):t>=e.length?wn(e[e.length-1].position,null):wn(e[t-1].position,e[t].position)}function dd(e,t=100){return e>t}var $u=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 Uu(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 Cn(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=$u,onRetry:m}=t,u,i=0;for(let p=1;p<=a;p++){i=p;try{return {data:await e(),attempts:i,success:!0}}catch(l){if(u=l,p===a||!n(u,p))return {error:u,attempts:i,success:false};let y=Uu(p,r,o,s);if(m)try{m(u,p,y);}catch(x){console.error("Error in retry callback:",x);}await new Promise(x=>setTimeout(x,y));}}return {error:u||new Error("Unknown error"),attempts:i,success:false}}function zu(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 Hu(e,t={}){return async(...a)=>Cn(()=>e(...a),t)}var Os=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 cd=(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))(cd||{}),ao=class ao{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,m=`[${a}] [${r}] [${s}]`,u=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(m,o,u?n:"");break;case "INFO":console.info(m,o,u?n:"");break;case "WARN":console.warn(m,o,u?n:"");break;case "ERROR":console.error(m,o,u?n:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...ao.globalOptions};}static configure(t){ao.globalOptions={...ao.globalOptions,...t};}child(t){return new ao({...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 Tn((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Tn(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:cd[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};ao.globalOptions={};var $s=ao,Tn=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}},md=new $s;function Gu(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 _u(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(m=>m.id===s.columnId);return [s.id,Us(s.title),Us(s.description||""),Us(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
2
- `)}async function Vu(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await mm__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),m=n.toDataURL("image/png"),u=297,i=210,p=n.width/n.height,l=u-20,f=l/p;f>i-20&&(f=i-20,l=f*p);let y=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});y.setFontSize(16),y.setTextColor(255,255,255),y.setFillColor(10,10,10),y.rect(0,0,u,15,"F"),y.text(e.title||"Kanban Board",10,10);let x=(u-l)/2;return y.addImage(m,"PNG",x,20,l,f),y}catch(n){console.error("Error capturing board:",n);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let m=e.cards.filter(u=>u.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,m.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):m.forEach(u=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(u.title,25,s),s+=6,u.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(u.description,160);o.text(p,25,s),s+=p.length*5;}let i=[];if(u.priority&&i.push(`Priority: ${u.priority}`),u.labels&&u.labels.length>0&&i.push(`Labels: ${u.labels.join(", ")}`),u.assignedUserIds&&u.assignedUserIds.length>0&&i.push(`Assigned: ${u.assignedUserIds.length} user(s)`),u.startDate||u.endDate){let p=[];u.startDate&&p.push(`Start: ${u.startDate}`),u.endDate&&p.push(`End: ${u.endDate}`),i.push(p.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function Us(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function ud(e,t,a,r){switch(t){case "json":return Gu(e,r);case "csv":return _u(e);case "pdf":return await Vu(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function gd(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let p=`${r}.pdf`;e.save(p);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},m=new Blob([e],{type:n[t]}),u=URL.createObjectURL(m),i=document.createElement("a");i.href=u,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(u);}function ju(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 Ku(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=fd(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let m=fd(t[n]||"");if(m.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-m.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${m.length})`);continue}for(;m.length<a.length;)m.push("");let i={};a.forEach((y,x)=>{i[y]=m[x]||"";});let p=i.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let l=o.get(p),f={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(f),l.cardIds.push(f.id);}catch(m){s.push(`Line ${n+1}: ${m instanceof Error?m.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function fd(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function bd(e,t){switch(t){case "json":return ju(e);case "csv":return Ku(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function hd(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 zs=react.createContext(null);function yd(){return react.useContext(zs)}var vd=react.createContext(null);function xd({children:e,themeName:t}){return jsxRuntime.jsx(vd.Provider,{value:{themeName:t},children:e})}function wo(){return react.useContext(vd)}function ht({children:e,container:t}){let[a,r]=react.useState(false),o=yd(),s=wo();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:m,themeName:u}=o,i={"--asakaa-color-background-primary":m.bgPrimary,"--asakaa-color-background-secondary":m.bgSecondary,"--asakaa-color-background-card":m.bgGrid,"--asakaa-color-background-hover":m.hoverBg,"--asakaa-color-text-primary":m.textPrimary,"--asakaa-color-text-secondary":m.textSecondary,"--asakaa-color-text-tertiary":m.textTertiary,"--asakaa-color-text-inverse":m.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":m.border,"--asakaa-color-border-hover":m.borderLight,"--asakaa-color-border-subtle":m.borderLight,"--asakaa-color-interactive-primary":m.accent,"--asakaa-color-interactive-primaryHover":m.accentHover,"--asakaa-color-interactive-primaryBorder":`${m.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${m.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${m.accent}33`,"--asakaa-color-status-success":m.statusCompleted,"--asakaa-color-status-warning":m.milestone,"--asakaa-color-status-error":m.criticalPath,"--asakaa-color-danger":m.criticalPath,"--asakaa-color-danger-border":`${m.criticalPath}4D`,"--asakaa-color-danger-background":`${m.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${m.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":u,"data-gantt-portal":"true",style:i,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var Nd={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},tg="#BDC3C7",ag=({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 ro({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),m=react.useRef(null),u=react.useRef(null),i=()=>{if(!u.current)return;let y=u.current.getBoundingClientRect(),x=window.innerHeight,C=window.innerWidth,h=160,b=220,g=4,k=y.right-h;k<10&&(k=y.left),k+h>C-10&&(k=C-h-10);let c=x-y.bottom,T=y.top,w;c>=b+g?w=y.bottom+g:T>=b+g?w=y.top-b-g:w=c>=T?y.bottom+g:Math.max(10,y.top-b-g),n({top:w,left:k}),o(true);};react.useEffect(()=>{let y=x=>{m.current&&!m.current.contains(x.target)&&!u.current?.contains(x.target)&&o(false);};if(r)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[r]),react.useEffect(()=>{let y=x=>{x.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[r]);let p=y=>{t(y),o(false);},l=e?Nd[e]:null,f=l?.color||tg;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:u,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${f}10`:"transparent",boxShadow:e?`0 0 0 2px ${f}30 inset`:"none"},title:l?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:f,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:f,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(ht,{children:jsxRuntime.jsxs("div",{ref:m,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(Nd).map(([y,x])=>jsxRuntime.jsxs("button",{onClick:()=>p(y),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:x.color,background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:C=>{C.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(ag,{color:x.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:x.label}),e===y&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>p(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("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 rg=[{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),[n,m]=react.useState({top:0,left:0}),u=react.useRef(null),i=react.useRef(null),f=(wo()?.themeName||"dark")==="dark",y=()=>{if(!i.current)return;let k=i.current.getBoundingClientRect(),c=window.innerHeight,T=window.innerWidth,w=320,R=380,v=4,I=k.left;I+w>T-10&&(I=T-w-10),I<10&&(I=10);let F=c-k.bottom,N=k.top,U;F>=R+v?U=k.bottom+v:N>=R+v?U=k.top-R-v:U=F>=N?k.bottom+v:Math.max(10,k.top-R-v),m({top:U,left:I}),s(true);};react.useEffect(()=>{let k=c=>{u.current&&!u.current.contains(c.target)&&!i.current?.contains(c.target)&&s(false);};if(o)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[o]),react.useEffect(()=>{let k=c=>{c.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[o]);let x=k=>{let c=new Date,T=I=>{let F=I.getFullYear(),N=String(I.getMonth()+1).padStart(2,"0"),U=String(I.getDate()).padStart(2,"0");return `${F}-${N}-${U}`},w=T(c),R=new Date(c);R.setDate(R.getDate()+k);let v=T(R);a(w,v),s(false);},C=()=>{if(!e||!t)return "Set date";let k=R=>{if(R instanceof Date)return R;if(typeof R!="string"||!R.match(/^\d{4}-\d{2}-\d{2}$/))return null;let v=R.split("-").map(Number);if(v.length!==3||v.some(U=>isNaN(U)))return null;let I=v[0],F=v[1],N=v[2];return I===void 0||F===void 0||N===void 0?null:new Date(I,F-1,N)},c=k(e),T=k(t);if(!c||!T||isNaN(c.getTime())||isNaN(T.getTime()))return "Set date";let w=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${w[c.getMonth()]} ${c.getDate()} \u2013 ${w[T.getMonth()]} ${T.getDate()}`},h=e&&t,g=(()=>{if(!t)return false;let k=typeof t=="string"?new Date(t):t,c=new Date;return c.setHours(0,0,0,0),k<c})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):y(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${g?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${C()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:C()})]}),o&&jsxRuntime.jsx(ht,{children:jsxRuntime.jsxs("div",{ref:u,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:f?"#1A1D25":"#FFFFFF",border:`1px solid ${f?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:f?"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:f?"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:f?"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:rg.map(k=>jsxRuntime.jsx("button",{onClick:()=>x(k.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:f?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${f?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:f?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:c=>{c.currentTarget.style.backgroundColor=f?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",c.currentTarget.style.border=`1px solid ${f?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:c=>{c.currentTarget.style.backgroundColor=f?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",c.currentTarget.style.border=`1px solid ${f?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:k.label},k.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:f?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:k=>a(k.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:f?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:f?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:f?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:f?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:k=>a(e,k.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:f?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:f?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:f?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:f?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:k=>{k.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:k=>{k.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function no({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[m,u]=react.useState(""),[i,p]=react.useState({top:0,left:0}),l=react.useRef(null),f=react.useRef(null),y=()=>{if(!f.current)return;let g=f.current.getBoundingClientRect(),k=window.innerHeight,c=window.innerWidth,T=300,w=380,R=4,v=g.right-T;v<10&&(v=g.left),v+T>c-10&&(v=c-T-10);let I=k-g.bottom,F=g.top,N;I>=w+R?N=g.bottom+R:F>=w+R?N=g.top-w-R:N=I>=F?g.bottom+R:Math.max(10,g.top-w-R),p({top:N,left:v}),n(true);};react.useEffect(()=>{let g=k=>{l.current&&!l.current.contains(k.target)&&!f.current?.contains(k.target)&&(n(false),u(""));};if(s)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),react.useEffect(()=>{let g=k=>{k.key==="Escape"&&(n(false),u(""));};if(s)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[s]);let x=g=>{let k=e.some(c=>c.id===g.id);a(k?e.filter(c=>c.id!==g.id):[...e,g]);},C=t.filter(g=>g.name.toLowerCase().includes(m.toLowerCase())),h=e.slice(0,o),b=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:f,onClick:()=>s?n(false):y(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[h.map(g=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:g.name,children:g.avatar?jsxRuntime.jsx("img",{src:g.avatar,alt:g.name,className:"asakaa-avatar-img"}):g.initials},g.id)),b>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):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(ht,{children:jsxRuntime.jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:m,onChange:g=>u(g.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:C.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):C.map(g=>{let k=e.some(c=>c.id===g.id);return jsxRuntime.jsxs("button",{onClick:()=>x(g),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:c=>{c.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:c=>{c.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:g.color,color:"#fff"},children:g.avatar?jsxRuntime.jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:g.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:k?"#3b82f6":"transparent"},children:k?"\u2713":""})]},g.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Nn(e,t,a){let r=new Map;e.forEach(u=>{if(u.dependencies&&Array.isArray(u.dependencies)){let i=u.dependencies.map(p=>{if(typeof p=="string")return p;let l=p;return l.taskId||l.targetId||""}).filter(Boolean);r.set(u.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,m=u=>{if(!s.has(u)){s.add(u),n.add(u);let i=r.get(u)||[];for(let p of i){if(!s.has(p)&&m(p))return true;if(n.has(p))return true}}return n.delete(u),false};return m(a)}function Vo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[m,u]=react.useState(false),[i,p]=react.useState(""),[l,f]=react.useState(t.length>0),[y,x]=react.useState({top:0,left:0}),[C,h]=react.useState(null),b=react.useRef(null),g=react.useRef(null),k=()=>{if(!g.current)return;let v=g.current.getBoundingClientRect(),I=window.innerHeight,F=window.innerWidth,N=300,U=l?380:120,$=4,j=v.right-N;j<10&&(j=v.left),j+N>F-10&&(j=F-N-10);let ne=I-v.bottom,re=v.top,se;ne>=U+$?se=v.bottom+$:re>=U+$?se=v.top-U-$:se=ne>=re?v.bottom+$:Math.max(10,v.top-U-$),x({top:se,left:j}),u(true);};react.useEffect(()=>{if(!m||!g.current)return;let v=g.current.getBoundingClientRect(),I=window.innerHeight,F=window.innerWidth,N=300,U=l?380:120,$=4,j=v.right-N;j<10&&(j=v.left),j+N>F-10&&(j=F-N-10);let ne=I-v.bottom,re=v.top,se;ne>=U+$?se=v.bottom+$:re>=U+$?se=v.top-U-$:se=ne>=re?v.bottom+$:Math.max(10,v.top-U-$),x({top:se,left:j});},[l,m]),react.useEffect(()=>{let v=I=>{b.current&&!b.current.contains(I.target)&&!g.current?.contains(I.target)&&(u(false),p(""));};if(m)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[m]),react.useEffect(()=>{let v=I=>{I.key==="Escape"&&(u(false),p(""));};if(m)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[m]);let c=v=>{let I=t.includes(v),F=a.find(N=>N.id===v);if(h(null),I){let N=t.filter(U=>U!==v);r(N),N.length===0&&f(false);}else {if(s&&Nn(a,v,e)){let U=`Cannot add "${F?.title||v}" as dependency - would create circular reference`;h(U),n?.(v,F?.title||v),setTimeout(()=>h(null),3e3);return}r([...t,v]),f(true);}},T=()=>{let v=!l;f(v),v||r([]);},w=a.filter(v=>v.id!==e).filter(v=>v.title.toLowerCase().includes(i.toLowerCase())||v.id.toLowerCase().includes(i.toLowerCase())),R=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:g,onClick:()=>m?u(false):k(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:R,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:R},children:t.length})]}),m&&jsxRuntime.jsx(ht,{children:jsxRuntime.jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${y.top}px`,left:`${y.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[C&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:C})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:T,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:v=>p(v.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:w.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):w.map(v=>{let I=t.includes(v.id);return jsxRuntime.jsxs("button",{onClick:()=>c(v.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:F=>{F.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:F=>{F.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:I?"#3b82f6":"transparent",borderColor:I?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:I&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:v.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:v.id})]})]},v.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),f(false),u(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Sr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:m=[],allCards:u=[]})=>{let{attributes:i,listeners:p,setNodeRef:l,transform:f,transition:y,isDragging:x}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),C={transform:kn.Transform.toString(f),transition:y};if(t)return jsxRuntime.jsx("div",{ref:l,style:C,...i,...p,onClick:()=>a?.(e),children:t(e)});let h=m.filter(c=>e.assignedUserIds?.includes(c.id)),b=e.progress===100,g=(e.attachments||[]).filter(c=>c.type.startsWith("image/")),k={...C,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:l,style:k,className:d("asakaa-card",x&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...p,onClick:c=>{c.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:c=>{c.currentTarget.style.display="none";}})}),g.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:g.length===1&&g[0]?jsxRuntime.jsx("img",{src:g[0].url,alt:g[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:c=>{c.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:g.slice(0,4).map((c,T)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:c.url,alt:c.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:w=>{w.currentTarget.style.display="none";}}),T===3&&g.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:["+",g.length-4]})})]},c.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.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:c=>c.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(ro,{priority:e.priority,onChange:c=>n?.(e.id,{priority:c})})}),jsxRuntime.jsx("div",{onClick:c=>c.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:(c,T)=>n?.(e.id,{startDate:c,endDate:T})})}),m.length>0&&jsxRuntime.jsx("div",{onClick:c=>c.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(no,{assignedUsers:h,availableUsers:m,onChange:c=>n?.(e.id,{assignedUserIds:c.map(T=>T.id)})})}),jsxRuntime.jsx("div",{onClick:c=>c.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Vo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(c=>typeof c=="string"?c:c.taskId):[],availableTasks:u,onChange:c=>n?.(e.id,{dependencies:c})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(c=>jsxRuntime.jsx("span",{className:"asakaa-label",children:c},c))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));Sr.displayName="Card";var Dn={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"}},Bd=({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 Rd({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,m]=react.useState({top:0,left:0}),u=react.useRef(null),i=react.useRef(null),p=[...Object.entries(Dn).map(([h,b])=>({id:h,label:b.label,color:b.color,icon:b.icon})),...r.filter(h=>!Object.keys(Dn).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let h=Dn[e];if(h)return {...h,id:e};let b=r.find(g=>g.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...Dn.todo,id:"todo"}},f=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),b=window.innerHeight,g=window.innerWidth,k=180,c=280,T=4,w=h.right-k;w<10&&(w=h.left),w+k>g-10&&(w=g-k-10);let R=b-h.bottom,v=h.top,I;R>=c+T?I=h.bottom+T:v>=c+T?I=h.top-c-T:I=R>=v?h.bottom+T:Math.max(10,h.top-c-T),m({top:I,left:w}),s(true);};react.useEffect(()=>{let h=b=>{u.current&&!u.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let y=h=>{t(h),s(false);},x=l(),C=x.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):f(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${C}10`,boxShadow:`0 0 0 2px ${C}30 inset`},title:x.label,children:jsxRuntime.jsx(Bd,{icon:x.icon,color:C})}),o&&jsxRuntime.jsx(ht,{children:jsxRuntime.jsxs("div",{ref:u,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:p.map(h=>jsxRuntime.jsxs("button",{onClick:()=>y(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:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Bd,{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 Od({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[m,u]=react.useState(false),[i,p]=react.useState(e),[l,f]=react.useState({top:0,left:0}),y=react.useRef(null),x=react.useRef(null),C=react.useRef(null);react.useEffect(()=>{if(s&&x.current){let k=x.current.getBoundingClientRect();f({top:k.bottom+window.scrollY+8,left:k.left+window.scrollX});}},[s]),react.useEffect(()=>{let k=c=>{y.current&&!y.current.contains(c.target)&&!x.current?.contains(c.target)&&(n(false),u(false));};if(s)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[s]),react.useEffect(()=>{let k=c=>{c.key==="Escape"&&(n(false),u(false),p(e));};if(s)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[s,e]),react.useEffect(()=>{m&&C.current&&(C.current.focus(),C.current.select());},[m]);let h=()=>{u(true),p(e);},b=()=>{let k=i.trim();k&&k!==e&&t(k),u(false),n(false),p(e);},g=k=>{k.key==="Enter"?b():k.key==="Escape"&&(u(false),p(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:x,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsxRuntime.jsx(ht,{children:jsxRuntime.jsx("div",{ref:y,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${l.top}px`,left:`${l.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:m?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:C,type:"text",value:i,onChange:k=>p(k.target.value),onKeyDown:g,onBlur:b,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),n(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var No=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:m,availableUsers:u,allCards:i,enableVirtualization:p,cardHeight:l=120,isCollapsed:f,onToggleCollapse:y,onColumnRename:x,onColumnDelete:C,isDeletable:h=false,className:b})=>{let{setNodeRef:g,isOver:k}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),c=react.useRef(null),T=p??dd(t.length),w=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>c.current,estimateSize:()=>l,enabled:T});if(a)return jsxRuntime.jsx("div",{ref:g,className:b,children:a(e,t)});let v=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let N=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:N}:N>=80?{state:"warning",percentage:N}:N>=60?{state:"approaching",percentage:N}:{state:"ok",percentage:N}})(),I=v.state==="exceeded",F=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:g,className:d("asakaa-column",k&&"ring-2 ring-asakaa-accent-blue",I&&"ring-2 ring-asakaa-accent-red",b),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:d(F()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&v.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${v.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[v.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),v.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),v.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),v.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(x||C)&&jsxRuntime.jsx(Od,{columnTitle:e.title,onRename:N=>x?.(e.id,N),onDelete:C?()=>C(e.id):void 0,isDeletable:h}),y&&jsxRuntime.jsx("button",{onClick:y,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":f?"Expand column":"Collapse column",children:f?"\u25B6":"\u25BC"})]})]}),!f&&jsxRuntime.jsx("div",{ref:c,className:"asakaa-column-cards",style:{maxHeight:T?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(N=>N.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:`${w.getTotalSize()}px`,position:"relative"},children:w.getVirtualItems().map(N=>{let U=t[N.index];return U?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${N.start}px)`},children:jsxRuntime.jsx(Sr,{card:U,render:r,onClick:n,onUpdate:m,availableUsers:u,allCards:i})},U.id):null})}):t.map(N=>jsxRuntime.jsx(Sr,{card:N,render:r,onClick:n,onUpdate:m,availableUsers:u,allCards:i},N.id))})})]})});No.displayName="Column";function Vs({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),m=react.useRef(null);react.useEffect(()=>{r&&m.current&&(m.current.focus(),m.current.select());},[r]);let u=()=>{let p=s.trim();p&&p!==e?t(p):n(e),o(false);},i=p=>{p.key==="Enter"?u():p.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:m,type:"text",value:s,onChange:p=>n(p.target.value),onBlur:u,onKeyDown:i,className:d("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:d("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function vg(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Gd(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(m=>m.name.toLowerCase().replace(/\s+/g,"")===s||m.name.toLowerCase()===s);n&&!a.includes(n.id)&&a.push(n.id);}return a}function xg(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function _d({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:m="dark",locale:u="es",currentUser:i}){let p=m==="dark",[l,f]=react.useState(false),[y,x]=react.useState([]),[C,h]=react.useState(0),[b,g]=react.useState(null),k=react.useRef(null),c=react.useRef(null),T=react.useCallback((F,N)=>{let U=vg(F,N);if(g(U),U){let $=r.filter(j=>j.name.toLowerCase().includes(U.query)||j.email&&j.email.toLowerCase().includes(U.query)).slice(0,5);x($),f($.length>0),h(0);}else f(false),x([]);},[r]),w=F=>{let N=F.target.value;t(N),T(N,F.target.selectionStart||0);},R=()=>{k.current&&T(e,k.current.selectionStart||0);},v=react.useCallback(F=>{if(!b||!k.current)return;let N=e.slice(0,b.start),U=e.slice(b.end),$=`@${F.name.replace(/\s+/g,"")} `,j=N+$+U;t(j),f(false),g(null),setTimeout(()=>{if(k.current){let ne=b.start+$.length;k.current.selectionStart=ne,k.current.selectionEnd=ne,k.current.focus();}},0);},[b,e,t]),I=F=>{if(l&&y.length>0)switch(F.key){case "ArrowDown":F.preventDefault(),h(N=>N<y.length-1?N+1:0);break;case "ArrowUp":F.preventDefault(),h(N=>N>0?N-1:y.length-1);break;case "Enter":{F.preventDefault();let N=y[C];N&&v(N);break}case "Tab":{F.preventDefault();let N=y[C];N&&v(N);break}case "Escape":F.preventDefault(),f(false);break}else F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),a());};return react.useEffect(()=>{let F=N=>{c.current&&!c.current.contains(N.target)&&k.current&&!k.current.contains(N.target)&&f(false);};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]),react.useEffect(()=>{if(l&&c.current){let F=c.current.children[C];F&&F.scrollIntoView({block:"nearest"});}},[C,l]),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:d("flex-1 relative"),children:[jsxRuntime.jsxs("div",{className:d("flex items-center gap-2 px-3 py-2 rounded-lg",p?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{ref:k,type:"text",value:e,onChange:w,onSelect:R,onKeyDown:I,placeholder:o||(u==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,className:d("flex-1 bg-transparent text-sm outline-none",p?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(s||n)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()||s,className:d("p-1.5 rounded transition-colors",e.trim()&&!s?"bg-blue-500 text-white hover:bg-blue-600":p?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&y.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:d("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:y.map((F,N)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>v(F),className:d("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",N===C?p?"bg-white/10":"bg-gray-100":p?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:F.color||"#8B5CF6"},children:xg(F.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:d("text-sm font-medium truncate",p?"text-white":"text-gray-900"),children:F.name}),F.email&&jsxRuntime.jsx("p",{className:d("text-xs truncate",p?"text-[#6B7280]":"text-gray-500"),children:F.email})]})]},F.id))})})]})]})}function Vd({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((m,u)=>m.type==="mention"?jsxRuntime.jsx("span",{className:d("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:m.value},u):jsxRuntime.jsx("span",{children:m.value},u))})}var An=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function hr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[m,u]=react.useState(false),[i,p]=react.useState(""),[l,f]=react.useState(false),[y,x]=react.useState(An[10]||"#3B82F6"),[C,h]=react.useState({top:0,left:0}),b=react.useRef(null),g=react.useRef(null),k=react.useRef(null),c=react.useRef(null),T=t.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),w=t.some(N=>N.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(m&&g.current){let N=g.current.getBoundingClientRect();h({top:N.bottom+6,left:N.left});}},[m]),react.useEffect(()=>{let N=U=>{let $=U.target,j=b.current?.contains($),ne=k.current?.contains($);!j&&!ne&&(u(false),p(""),f(false));};if(m)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[m]),react.useEffect(()=>{m&&c.current&&c.current.focus();},[m]);let R=N=>{let U=e.some($=>$.id===N.id);a(U?e.filter($=>$.id!==N.id):[...e,N]);},v=async()=>{if(!(!r||!i.trim())){f(true);try{let N=await r(i.trim(),y);N&&(a([...e,N]),p(""),x(An[Math.floor(Math.random()*An.length)]||"#3B82F6"));}finally{f(false);}}},I=(N,U)=>{U.stopPropagation(),a(e.filter($=>$.id!==N));},F={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:b,className:"relative",children:[jsxRuntime.jsxs("button",{ref:g,type:"button",onClick:()=>!s&&u(!m),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:F,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(N=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${N.color}20`,color:N.color},children:N.name},N.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:k,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:C.top,left:C.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:c,type:"text",value:i,onChange:N=>p(N.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:N=>{N.key==="Enter"&&i.trim()&&!w&&r&&v();}})}),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(N=>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:`${N.color}20`,color:N.color},onClick:U=>I(N.id,U),children:[N.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},N.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:T.length>0?T.map(N=>{let U=e.some($=>$.id===N.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>R(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:U?`${N.color}15`:"transparent",color:o.textPrimary},onMouseEnter:$=>{U||($.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:$=>{U||($.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:N.name}),U&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:N.color}})]},N.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!w&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:An.map(N=>jsxRuntime.jsx("button",{type:"button",onClick:()=>x(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:y===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxRuntime.jsxs("button",{type:"button",onClick:v,disabled:l,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:y,color:"#FFFFFF",opacity:l?.7:1},children:[l?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function Ks({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 Kd({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(Ks,{tag:s,size:a},s.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var yr=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function Zd(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description}}return e}function Kg(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 lo({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:m=[],availableTags:u=[],onCreateTag:i,attachments:p=[],onUploadAttachments:l,onDeleteAttachment:f,availableTasks:y=[],comments:x=[],onAddComment:C,currentUser:h,mentionableUsers:b=[]}){let g=s==="dark",k={textTertiary:g?"#6B7280":"#9CA3AF",textSecondary:g?"#9CA3AF":"#6B7280",textPrimary:g?"#FFFFFF":"#111827",borderLight:g?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:g?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:g?"#1A1D25":"#FFFFFF",bgSecondary:g?"#0F1117":"#F9FAFB",hoverBg:g?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},c=e&&"title"in e&&!("name"in e),T=e,[w,R]=react.useState(e?Zd(e,m):null),[v,I]=react.useState(false),[F,N]=react.useState(false),[U,$]=react.useState(false),[j,ne]=react.useState(null),[re,se]=react.useState(new Date),[ye,be]=react.useState(false),[Be,A]=react.useState(false),[O,L]=react.useState(""),[_,J]=react.useState(false),[ce,fe]=react.useState(false),[me,Le]=react.useState(false),[te,Je]=react.useState(""),ke=react.useRef(null),[Qe,ct]=react.useState(""),ft=react.useRef(null),[et,wt]=react.useState(""),[Mt,Dt]=react.useState(false);react.useEffect(()=>{if(e){let S=Zd(e,m);R(S),Je(S.description||""),ct(S.name||"");}},[e?.id,m]),react.useEffect(()=>()=>{ke.current&&clearTimeout(ke.current),ft.current&&clearTimeout(ft.current);},[]);let Ye=react.useCallback(S=>{R(S),c&&o&&T?o(Kg(S,T)):r&&r(S);},[c,T,o,r]),B=react.useCallback(()=>{I(false),N(false),$(false),ne(null),A(false),L(""),J(false);},[]),ie=react.useCallback((S,we)=>{if(!w)return;let X={...w,[S]:we};Ye(X);},[w,Ye]),Se=react.useCallback(S=>{Je(S),ke.current&&clearTimeout(ke.current),ke.current=setTimeout(()=>{if(w){let we={...w,description:S};Ye(we);}},800);},[w,Ye]),He=react.useCallback(S=>{ct(S),ft.current&&clearTimeout(ft.current),ft.current=setTimeout(()=>{if(w&&S.trim()){let we={...w,name:S.trim()};Ye(we);}},800);},[w,Ye]),Ze=react.useCallback(async()=>{if(!(!w||!et.trim()||!C)){Dt(true);try{let S=Gd(et,b);await C(w.id,et.trim(),S.length>0?S:void 0),wt("");}finally{Dt(false);}}},[w,et,C,b]),bt=react.useCallback(S=>{let we=typeof S=="string"?new Date(S):S,Te=new Date().getTime()-we.getTime(),Ce=Math.floor(Te/6e4),We=Math.floor(Te/36e5),Oe=Math.floor(Te/864e5);return Ce<1?n==="es"?"Ahora":"Just now":Ce<60?n==="es"?`Hace ${Ce} min`:`${Ce}m ago`:We<24?n==="es"?`Hace ${We}h`:`${We}h ago`:Oe<7?n==="es"?`Hace ${Oe}d`:`${Oe}d ago`:we.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),q=react.useCallback(S=>{if(!w)return;let we=w.progress||0;S==="completed"?we=100:S==="in-progress"&&we===0?we=10:S==="todo"&&(we=0);let X={...w,status:S,progress:we};Ye(X),I(false);},[w,Ye]),Q=react.useCallback((S,we)=>{if(!w)return;let X={...w,startDate:S,endDate:we};Ye(X);},[w,Ye]),je=react.useCallback(()=>{let S=re.getFullYear(),we=re.getMonth(),X=new Date(S,we,1),Ce=new Date(S,we+1,0).getDate(),We=X.getDay(),Oe=[],at=new Date(S,we,0).getDate();for(let K=We-1;K>=0;K--)Oe.push({date:new Date(S,we-1,at-K),isCurrentMonth:false});for(let K=1;K<=Ce;K++)Oe.push({date:new Date(S,we,K),isCurrentMonth:true});let G=42-Oe.length;for(let K=1;K<=G;K++)Oe.push({date:new Date(S,we+1,K),isCurrentMonth:false});return Oe},[re]),Re=react.useCallback(async S=>{if(S.preventDefault(),S.stopPropagation(),fe(false),!w||!l)return;let we=Array.from(S.dataTransfer.files);if(we.length!==0){Le(true);try{await l(w.id,we);}finally{Le(false);}}},[w,l]),tt=react.useCallback(async S=>{if(!w||!l||!S.target.files)return;let we=Array.from(S.target.files);if(we.length!==0){Le(true);try{await l(w.id,we);}finally{Le(false);}S.target.value="";}},[w,l]),lt=react.useCallback(S=>{S.preventDefault(),S.stopPropagation(),fe(true);},[]),Ue=react.useCallback(S=>{S.preventDefault(),S.stopPropagation(),fe(false);},[]),qe=react.useCallback(S=>S<1024?`${S} B`:S<1024*1024?`${(S/1024).toFixed(1)} KB`:`${(S/(1024*1024)).toFixed(1)} MB`,[]),ae=react.useCallback(S=>S.startsWith("image/")?lucideReact.Image:S.includes("pdf")||S.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!w?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:d("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",g?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:d("px-6 py-3 border-b flex items-center gap-3",g?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:d("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:d("text-xs px-2 py-0.5 rounded",g?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:d("text-xs font-mono",g?"text-[#6B7280]":"text-gray-400"),children:w.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:d("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",g?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:d("p-1.5 rounded transition-colors",g?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:d("p-1.5 rounded transition-colors",g?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:a,className:d("p-1.5 rounded transition-colors",g?"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 S=w.progress===100?0:100,X={...w,progress:S,status:S===100?"completed":"todo"};Ye(X);},className:d("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",w.progress===100?"bg-green-500 border-green-500":g?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:w.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Qe,onChange:S=>He(S.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:d("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",w.progress===100?"line-through text-[#6B7280]":g?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:d("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{B(),I(!v);},className:d("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",w.progress===100||w.status==="completed"?"bg-green-500/20 text-green-400":w.progress&&w.progress>0||w.status==="in-progress"?"bg-blue-500/20 text-blue-400":g?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:w.progress===100||w.status==="completed"?n==="es"?"COMPLETADO":"DONE":w.progress&&w.progress>0||w.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>I(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(S=>jsxRuntime.jsxs("button",{onClick:()=>q(S.id),className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",g?"hover:bg-white/5":"hover:bg-gray-50",w.status===S.id&&(g?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",S.color)}),jsxRuntime.jsx("span",{className:g?"text-white":"text-gray-900",children:S.label})]},S.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:d("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{B(),$(!U);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",g?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[w.assignees&&w.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[w.assignees.slice(0,3).map((S,we)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:S.color||"#8B5CF6"},title:S.name,children:S.initials||S.name.slice(0,2).toUpperCase()},we)),w.assignees.length>3&&jsxRuntime.jsxs("span",{className:d("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:["+",w.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:d("text-sm",g?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",g?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>$(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:m.length>0?m.map(S=>{let we=w.assignees?.some(X=>X.name===S.name);return jsxRuntime.jsxs("button",{onClick:()=>{let X=w.assignees||[],Te;we?Te=X.filter(Ce=>Ce.name!==S.name):Te=[...X,S],ie("assignees",Te);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",g?"hover:bg-white/5":"hover:bg-gray-50",we&&(g?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:S.color||"#8B5CF6"},children:S.initials||S.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:d("flex-1",g?"text-white":"text-gray-900"),children:S.name}),we&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},S.name)}):jsxRuntime.jsx("div",{className:d("px-3 py-4 text-sm text-center",g?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:d("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{ne(j?null:"start"),se(w.startDate||new Date);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",g?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[w.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:d("mx-1",g?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),w.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:j&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ne(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:d("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:d("w-44 py-2 border-r",g?"border-white/10":"border-gray-200"),children:[(()=>{let S=new Date,we=new Date(S);we.setDate(S.getDate()+1);let X=new Date(S);X.setDate(S.getDate()+((6-S.getDay()+7)%7||7));let Te=new Date(S);Te.setDate(S.getDate()+((1-S.getDay()+7)%7||7));let Ce=new Date(S);Ce.setDate(S.getDate()+(6-S.getDay()+7)%7+7);let We=new Date(S);We.setDate(S.getDate()+14);let Oe=new Date(S);return Oe.setDate(S.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:S,display:S.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:we,display:we.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:X,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Te,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Ce,display:Ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:We,display:We.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Oe,display:Oe.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((G,K)=>jsxRuntime.jsxs("button",{className:d("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",g?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(j==="start"){let he=w.endDate&&G.date>w.endDate?G.date:w.endDate;Q(G.date,he),ne("end");}else {let he=w.startDate&&G.date<w.startDate?G.date:w.startDate;Q(he,G.date),ne(null);}},children:[jsxRuntime.jsx("span",{children:G.label}),jsxRuntime.jsx("span",{className:d("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:G.display})]},K))})(),jsxRuntime.jsx("div",{className:d("border-t mt-2 pt-2",g?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Q(void 0,void 0),ne(null);},className:d("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",g?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:d("text-xs mb-3 px-2 py-1 rounded",g?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:j==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:d("font-medium",g?"text-white":"text-gray-900"),children:re.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>se(new Date),className:d("p-1 rounded text-sm transition-colors",g?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>se(new Date(re.getFullYear(),re.getMonth()-1)),className:d("p-1 rounded",g?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>se(new Date(re.getFullYear(),re.getMonth()+1)),className:d("p-1 rounded",g?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(S=>jsxRuntime.jsx("div",{className:d("w-8 h-8 flex items-center justify-center text-xs",g?"text-[#6B7280]":"text-gray-400"),children:S},S))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:je().map((S,we)=>{let X=S.date.toDateString()===new Date().toDateString(),Te=w.startDate?.toDateString()===S.date.toDateString(),Ce=w.endDate?.toDateString()===S.date.toDateString(),We=Te||Ce,Oe=w.startDate&&w.endDate&&S.date>=w.startDate&&S.date<=w.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let at=new Date(S.date);if(j==="start"){let G=w.endDate&&at>w.endDate?at:w.endDate;Q(at,G),ne("end");}else {let G=w.startDate&&at<w.startDate?at:w.startDate;Q(G,at),ne(null);}},className:d("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!S.isCurrentMonth&&(g?"text-[#4B5563]":"text-gray-300"),S.isCurrentMonth&&(g?"text-white":"text-gray-900"),X&&"ring-2 ring-[#3B82F6]",Te&&"bg-[#3B82F6] text-white",Ce&&!Te&&"bg-[#7C3AED] text-white",Oe&&!We&&(g?"bg-[#7C3AED]/20":"bg-purple-100"),!We&&(g?"hover:bg-white/10":"hover:bg-gray-100")),children:S.date.getDate()},we)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:d("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{B(),N(!F);},className:d("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",w.priority==="high"||w.priority==="urgent"?"bg-red-500/20 text-red-400":w.priority==="medium"?"bg-yellow-500/20 text-yellow-400":w.priority==="low"?"bg-green-500/20 text-green-400":g?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:w.priority?w.priority==="high"||w.priority==="urgent"?n==="es"?"Alta":"High":w.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>N(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",g?"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(S=>jsxRuntime.jsxs("button",{onClick:()=>{ie("priority",S.id),N(false);},className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",g?"hover:bg-white/5":"hover:bg-gray-50",w.priority===S.id&&(g?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",S.color)}),jsxRuntime.jsx("span",{className:g?"text-white":"text-gray-900",children:S.label})]},S.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:d("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:d("text-sm",g?"text-white":"text-gray-900"),children:w.startDate&&w.endDate?`${Math.ceil((w.endDate.getTime()-w.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:d("w-4 h-4 rounded-full border-2",g?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ye?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:w.progress||0,onChange:S=>{let we=parseInt(S.target.value),X=w.status;we===100?X="completed":we>0?X="in-progress":X="todo";let Te={...w,progress:we,status:X};Ye(Te);},onBlur:()=>be(false),className:d("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",g?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>be(true),className:d("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",g?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:d("h-full rounded-full transition-all",w.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${w.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:d("text-sm font-medium min-w-[40px]",g?"text-white":"text-gray-900"),children:[w.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:d("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(hr,{selectedTags:w.tags||[],availableTags:u,onChange:S=>{ie("tags",S);},onCreateTag:i,theme:k})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:d("w-4 h-4 mt-1.5",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24 mt-1",g?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[w.dependencies&&w.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:w.dependencies.map(S=>{let we=y.find(X=>X.id===S);return jsxRuntime.jsxs("span",{className:d("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",g?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[we?.name||S.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let X=(w.dependencies||[]).filter(Te=>Te!==S);ie("dependencies",X);},className:d("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S)})}),jsxRuntime.jsxs("button",{onClick:()=>{B(),A(!Be);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",g?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:d("text-sm",g?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Be&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{A(false),L("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:d("p-2 border-b",g?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:O,onChange:S=>L(S.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:d("w-full px-3 py-2 rounded-md text-sm outline-none",g?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:y.length>0?y.filter(S=>S.id!==w.id).filter(S=>O===""||S.name.toLowerCase().includes(O.toLowerCase())).map(S=>{let we=w.dependencies?.includes(S.id);return jsxRuntime.jsxs("button",{onClick:()=>{let X=w.dependencies||[],Te;we?Te=X.filter(Ce=>Ce!==S.id):Te=[...X,S.id],ie("dependencies",Te);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",g?"hover:bg-white/5":"hover:bg-gray-50",we&&(g?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:d("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",we?"bg-blue-500 border-blue-500":g?"border-white/30":"border-gray-300"),children:we&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:d("block truncate",g?"text-white":"text-gray-900"),children:S.name}),jsxRuntime.jsx("span",{className:d("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:S.id.slice(0,8)})]})]},S.id)}):jsxRuntime.jsx("div",{className:d("px-3 py-4 text-sm text-center",g?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:d("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{B(),J(!_);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",g?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:w.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:d("text-sm",g?"text-white":"text-gray-900"),children:yr.find(S=>S.value===w.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",g?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>J(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:yr.map(S=>{let we=w.color===S.value;return jsxRuntime.jsx("button",{onClick:()=>{ie("color",S.value),J(false);},className:d("w-7 h-7 rounded-full flex items-center justify-center transition-all",we&&"ring-2 ring-offset-2",g?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:S.value,outlineColor:we?S.value:void 0},title:S.name,children:we&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},S.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:d("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:w.isMilestone||false,onChange:S=>ie("isMilestone",S.target.checked),className:d("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",w.isMilestone?"bg-purple-500 border-purple-500":g?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:d("text-sm",g?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",g?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:d("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:d("text-sm font-semibold",g?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:te,onChange:S=>Se(S.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:d("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",g?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:d("flex items-center gap-2 text-sm mt-2 transition-colors",g?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",g?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:d("text-sm font-semibold mb-3",g?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",g?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",g?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:d("text-sm font-semibold mb-3",g?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),w.subtasks&&w.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:w.subtasks.map(S=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:d("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",S.progress===100?"bg-green-500 border-green-500":g?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:S.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:d("text-sm",S.progress===100?"line-through text-[#6B7280]":g?"text-white":"text-gray-900"),children:S.name})]},S.id))}),jsxRuntime.jsxs("button",{className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",g?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",g?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:d("text-sm font-semibold",g?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:d("p-1 rounded transition-colors",g?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",g?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",g?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:d("text-sm font-semibold mb-3",g?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",p.length>0&&jsxRuntime.jsxs("span",{className:d("ml-2 text-xs font-normal",g?"text-[#6B7280]":"text-gray-400"),children:["(",p.length,")"]})]}),p.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:p.map(S=>{let we=ae(S.type),X=S.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:d("flex items-center gap-3 p-2 rounded-lg group transition-colors",g?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[X&&S.thumbnailUrl?jsxRuntime.jsx("img",{src:S.thumbnailUrl,alt:S.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:d("w-10 h-10 rounded flex items-center justify-center",g?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(we,{className:d("w-5 h-5",g?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:S.url,target:"_blank",rel:"noopener noreferrer",className:d("text-sm font-medium truncate block hover:underline",g?"text-white":"text-gray-900"),children:S.name}),jsxRuntime.jsx("p",{className:d("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:qe(S.size)})]}),f&&jsxRuntime.jsx("button",{onClick:()=>f(S.id),className:d("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",g?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},S.id)})}),jsxRuntime.jsxs("div",{onDragOver:lt,onDragLeave:Ue,onDrop:Re,className:d("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",ce?g?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":g?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",me&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:tt,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!l||me}),me?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:d("text-sm",g?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:d("w-6 h-6 mx-auto mb-2",ce?"text-blue-500":g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:d("text-sm",g?"text-[#9CA3AF]":"text-gray-500"),children:ce?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!l&&jsxRuntime.jsx("p",{className:d("text-xs mt-1",g?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:d("w-80 border-l flex flex-col",g?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:d("px-4 py-3 border-b",g?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:d("text-sm font-semibold",g?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",x.length>0&&jsxRuntime.jsxs("span",{className:d("ml-2 text-xs font-normal",g?"text-[#6B7280]":"text-gray-400"),children:["(",x.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:x.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:x.map(S=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:S.user?.color||"#8B5CF6"},children:S.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:d("text-sm font-medium",g?"text-white":"text-gray-900"),children:S.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:d("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:bt(S.createdAt)})]}),jsxRuntime.jsx("div",{className:d("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Vd,{content:S.content,theme:s})})]})]},S.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:d("w-10 h-10 mb-3",g?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:d("text-sm",g?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:d("p-4 border-t",g?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(_d,{value:et,onChange:wt,onSubmit:Ze,users:b,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!C,isSubmitting:Mt,theme:s,locale:n,currentUser:h})})]})]})]})})}function Zs(){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 Hr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:m,isLoading:u,error:i,children:p,availableTags:l=[],onCreateTag:f,attachmentsByCard:y,onUploadAttachments:x,onDeleteAttachment:C,comments:h,onAddComment:b,currentUser:g,mentionableUsers:k,onTaskOpen:c}){let[T,w]=Zs(),[R,v]=react.useState(null),I=o?.theme||"dark",F=I==="dark"||I==="neutral",N=F?"dark":"",U=react.useCallback((_,J)=>{t.onCardUpdate?.(_,J);},[t]),$=react.useCallback((_,J)=>{t.onColumnUpdate?.(_,{title:J});},[t]),j=react.useCallback(_=>{t.onColumnDelete?.(_);},[t]),ne=["todo","in-progress","completed"],re=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),se=react.useMemo(()=>{let _=new Map;return e.columns.forEach(J=>{let ce=J.cardIds.map(fe=>e.cards.find(me=>me.id===fe)).filter(fe=>fe!==void 0).sort((fe,me)=>fe.position-me.position);_.set(J.id,ce);}),_},[e.cards,e.columns]),ye=react.useMemo(()=>e.cards.map(_=>({id:_.id,name:_.title,startDate:_.startDate?new Date(_.startDate):void 0,endDate:_.endDate?new Date(_.endDate):void 0,progress:_.progress||0,status:_.columnId,priority:_.priority?.toLowerCase(),dependencies:Array.isArray(_.dependencies)?_.dependencies.map(J=>typeof J=="string"?J:J.taskId):[]})),[e.cards]),be=react.useCallback(_=>{let{active:J}=_,ce=e.cards.find(fe=>fe.id===J.id);ce&&w({isDragging:true,draggedCardId:ce.id,sourceColumnId:ce.columnId,targetColumnId:ce.columnId});},[e.cards,w]),Be=react.useCallback(_=>{let{active:J,over:ce}=_;if(!ce||!e.cards.find(Le=>Le.id===J.id))return;let me=null;ce.data.current?.type==="column"?me=ce.id:ce.data.current?.type==="card"&&(me=e.cards.find(te=>te.id===ce.id)?.columnId||null),me&&me!==T.targetColumnId&&w({...T,targetColumnId:me});},[e.cards,T,w]),A=react.useCallback(async _=>{let{active:J,over:ce}=_;if(w({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ce)return;let fe=e.cards.find(Je=>Je.id===J.id);if(!fe)return;let me,Le;if(ce.data.current?.type==="column"){me=ce.id;let Je=se.get(me)||[];Le=Rs(Je,0);}else {let Je=e.cards.find(ct=>ct.id===ce.id);if(!Je)return;me=Je.columnId;let ke=se.get(me)||[],Qe=ke.findIndex(ct=>ct.id===ce.id);Le=Rs(ke,Qe);}let te=e.columns.find(Je=>Je.id===me);if(te&&te.wipLimit&&te.wipLimitType==="hard"){let Je=se.get(me)||[];if(fe.columnId!==me&&Je.length>=te.wipLimit){t.onWipLimitExceeded?.(te,fe);return}}(fe.columnId!==me||fe.position!==Le)&&await t.onCardMove?.(fe.id,me,Le);},[e.cards,e.columns,se,t,w]),O=react.useCallback(_=>{v(_),a?.(_),c?.(_.id);},[a,c]),L=react.useCallback(_=>{t.onCardUpdate?.(_.id,_),v(_);},[t]);return u?jsxRuntime.jsx("div",{className:d("asakaa-board",N,n),style:m,children:jsxRuntime.jsx(nf,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:d("asakaa-board",N,n),style:m,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(xd,{themeName:I,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:re,collisionDetection:core$1.closestCorners,onDragStart:be,onDragOver:Be,onDragEnd:A,children:[jsxRuntime.jsxs("div",{className:d("asakaa-board",N,n),style:m,"data-theme":I,children:[e.columns.sort((_,J)=>_.position-J.position).map(_=>{let J=se.get(_.id)||[],ce=!ne.includes(_.id);return jsxRuntime.jsx(No,{column:_,cards:J,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:O,onCardUpdate:U,onColumnRename:$,onColumnDelete:j,isDeletable:ce,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},_.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:T.draggedCardId?jsxRuntime.jsx(Sr,{card:e.cards.find(_=>_.id===T.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(lo,{task:R,isOpen:!!R,onClose:()=>v(null),onCardUpdate:L,theme:F?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:l,onCreateTag:f,attachments:R?y?.get(R.id)||[]:[],onUploadAttachments:x,onDeleteAttachment:C,availableTasks:ye,comments:h,onAddComment:b,currentUser:g,mentionableUsers:k})]})}function nf({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 mf={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)"},pf={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)"},uf={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},gf={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function ff({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let i=p=>{m.current&&!m.current.contains(p.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let u=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,p)=>i.position-p.position).map((i,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function bf({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[m,u]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let y=x=>{i.current&&!i.current.contains(x.target)&&n(false);};return s&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),!(a||r||o))return null;let l=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(y=>y.handler),f=async(y,x)=>{if(x){u(y);try{await x();}catch(C){console.error(`Export ${y} failed:`,C);}finally{u(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:l.map((y,x)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(y.id,y.handler),disabled:m!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:m===y.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):y.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:y.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})})]})}function hf({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 ei({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:m,onExportExcel:u,translations:i}){let p=r==="dark"?mf:pf,l={...o==="es"?uf:gf,...i},f=n||m||u;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(bf,{theme:p,t:l,onExportCSV:n,onExportJSON:m,onExportExcel:u}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),t&&(s?jsxRuntime.jsx(ff,{columns:e,onSelect:t,theme:p,t:l,createTaskLabel:a}):jsxRuntime.jsx(hf,{onClick:()=>t(),label:a||l.newTask}))]})})}function ai({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[m,u]=react.useState(""),i=react.useCallback(()=>{let f=m.trim();f&&(e(f),u(""),n(false));},[m,e]),p=react.useCallback(f=>{f.key==="Enter"?(f.preventDefault(),i()):f.key==="Escape"&&(u(""),n(false));},[i]),l=react.useCallback(()=>{setTimeout(()=>{m.trim()||n(false);},150);},[m]);return s?jsxRuntime.jsx("div",{className:d("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:m,onChange:f=>u(f.target.value),onKeyDown:p,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!m.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{u(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:d("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function ri({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:m="dark",locale:u="es"}){let[i,p]=react.useState(false),[l,f]=react.useState(false),[y,x]=react.useState(""),[C,h]=react.useState([]),[b,g]=react.useState(""),[k,c]=react.useState(""),[T,w]=react.useState(""),[R,v]=react.useState(false),[I,F]=react.useState(false),[N,U]=react.useState(false),$=react.useRef(null),j=react.useRef(null),ne={placeholder:o||(u==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(u==="es"?"Agregar Tarea":"Add Task"),save:u==="es"?"Guardar":"Save",addAssignee:u==="es"?"Agregar asignado":"Add assignee",addDates:u==="es"?"Agregar fechas":"Add dates",addPriority:u==="es"?"Agregar prioridad":"Add priority",startDate:u==="es"?"Inicio":"Start",endDate:u==="es"?"Fin":"End",low:u==="es"?"Baja":"Low",medium:u==="es"?"Media":"Medium",high:u==="es"?"Alta":"High",urgent:u==="es"?"Urgente":"Urgent"},re=react.useCallback(()=>{x(""),h([]),g(""),c(""),w(""),v(false),F(false),U(false),p(false);},[]);react.useEffect(()=>{i&&$.current&&$.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let A=O=>{j.current&&!j.current.contains(O.target)&&(y.trim()||re());};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[i,y,re]);let se=react.useCallback(async()=>{let A=y.trim();if(!(!A||l)){f(true);try{await t({name:A,columnId:e,assigneeIds:C.length>0?C:void 0,startDate:b?new Date(b):void 0,endDate:k?new Date(k):void 0,priority:T||void 0}),x(""),h([]),g(""),c(""),w(""),v(!1),F(!1),U(!1),$.current?.focus();}catch(O){console.error("Error creating card:",O);}finally{f(false);}}},[y,e,C,b,k,T,t,l]),ye=react.useCallback(A=>{A.key==="Enter"&&!A.shiftKey?(A.preventDefault(),se()):A.key==="Escape"&&re();},[se,re]),be=react.useCallback(A=>{h(O=>O.includes(A)?O.filter(L=>L!==A):[...O,A]);},[]),Be=m==="dark";return i?jsxRuntime.jsxs("div",{ref:j,className:d("rounded-lg overflow-hidden shadow-lg",Be?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:$,type:"text",value:y,onChange:A=>x(A.target.value),onKeyDown:ye,placeholder:ne.placeholder,disabled:l,className:d("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Be?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>v(!R),className:d("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",R||C.length>0?"bg-emerald-500/20 text-emerald-400":Be?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ne.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),C.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:C.length})]}),jsxRuntime.jsx("button",{onClick:()=>F(!I),className:d("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",I||b||k?"bg-blue-500/20 text-blue-400":Be?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ne.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:()=>U(!N),className:d("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",N||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":Be?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ne.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:se,disabled:!y.trim()||l,className:d("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:l?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):ne.save})]})]}),R&&a.length>0&&jsxRuntime.jsx("div",{className:d("px-3 pb-3 pt-0","border-t",Be?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(A=>jsxRuntime.jsxs("button",{onClick:()=>be(A.id),className:d("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",C.includes(A.id)?"bg-emerald-500 text-white":Be?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[A.avatar?jsxRuntime.jsx("img",{src:A.avatar,alt:A.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:d("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",C.includes(A.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:A.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:A.name.split(" ")[0]})]},A.id))})}),I&&jsxRuntime.jsx("div",{className:d("px-3 pb-3 pt-0","border-t",Be?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:d("block text-[10px] uppercase tracking-wide mb-1",Be?"text-gray-500":"text-gray-400"),children:ne.startDate}),jsxRuntime.jsx("input",{type:"date",value:b,onChange:A=>g(A.target.value),className:d("w-full px-2 py-1.5 rounded text-xs border",Be?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:d("block text-[10px] uppercase tracking-wide mb-1",Be?"text-gray-500":"text-gray-400"),children:ne.endDate}),jsxRuntime.jsx("input",{type:"date",value:k,onChange:A=>c(A.target.value),className:d("w-full px-2 py-1.5 rounded text-xs border",Be?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),N&&jsxRuntime.jsx("div",{className:d("px-3 pb-3 pt-0","border-t",Be?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(A=>jsxRuntime.jsx("button",{onClick:()=>w(T===A?"":A),className:d("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`:Be?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:ne[A]},A))})})]}):jsxRuntime.jsxs("button",{onClick:()=>p(true),disabled:n,className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Be?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:ne.buttonLabel})]})}var Xo=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(Hr,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
5
- `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function cc(e={}){return new Xo(e)}var So=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function oi(e,t){let a=r=>jsxRuntime.jsx(So,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function si({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:m,onOpenAIUsage:u,shortcut:i="k",className:p=""}){let[l,f]=react.useState(false),[y,x]=react.useState(""),[C,h]=react.useState("home"),[b,g]=react.useState(""),[k,c]=react.useState("");react.useEffect(()=>{let v=I=>{(I.metaKey||I.ctrlKey)&&I.key===i&&(I.preventDefault(),f(F=>!F)),I.key==="Escape"&&(f(false),h("home"),x(""));};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[i]),react.useEffect(()=>{l||(h("home"),x(""),g(""),c(""));},[l]);let T=react.useCallback(()=>{f(false);},[]),w=react.useCallback(v=>{let[I,F]=v.split(":");switch(I){case "create-card":h("create-card");break;case "create-card-in":g(F||"");break;case "navigate":F?(a?.(F),T()):h("navigate");break;case "search":r?.(y),T();break;case "priority":h("priority");break;case "set-priority":k&&F&&(o?.(k,F),T());break;case "assign":h("assign");break;case "assign-user":k&&F&&(s?.(k,F),T());break;case "ai":h("ai");break;case "ai-generate-plan":n?.(),T();break;case "ai-predict-risks":m?.(),T();break;case "ai-usage":u?.(),T();break;case "back":h("home");break;}},[y,k,t,a,r,o,s,n,m,u,T]),R=react.useCallback(()=>{b&&y.trim()&&(t?.(b,y.trim()),T());},[b,y,t,T]);return l?jsxRuntime.jsx(ht,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:T,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:v=>v.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:y,onValueChange:x,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:C==="create-card"&&b?"Type card title and press Enter...":C==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:v=>{v.key==="Enter"&&C==="create-card"&&b&&R();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),C==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:w,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:w,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:w,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:w,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(v=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${v.id}`,onSelect:w,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:v.title}),v.labels&&v.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(I=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:I},I))})]},v.id))})]}),C==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:w,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(v=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${v.id}`,onSelect:w,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:v.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[v.cardIds.length," cards"]})]},v.id))})]}),C==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:w,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(v=>{let I=e.columns.find(F=>F.id===v.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${v.id}`,onSelect:w,className:"command-palette-item",keywords:[v.title,v.description||"",...v.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:v.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:I?.title})]}),v.labels&&v.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(F=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:F},F))})]},v.id)})})]}),C==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:w,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:w,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:w,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:w,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function uc(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
1
+ 'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),fm=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),$f=require('react-markdown'),Uf=require('remark-gfm'),zf=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var fm__default=/*#__PURE__*/_interopDefault(fm);var $f__default=/*#__PURE__*/_interopDefault($f);var Uf__default=/*#__PURE__*/_interopDefault(Uf);var zf__default=/*#__PURE__*/_interopDefault(zf);var kn=(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 Cn=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 [Cn.Translate.toString(e),Cn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function l(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Tn(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 Hu(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function $s(e,t){return e.length===0?1e3:t===0?Tn(null,e[0].position):t>=e.length?Tn(e[e.length-1].position,null):Tn(e[t-1].position,e[t].position)}function md(e,t=100){return e>t}var Wu=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 Gu(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 Nn(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Wu,onRetry:m}=t,u,i=0;for(let p=1;p<=a;p++){i=p;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(u=d,p===a||!n(u,p))return {error:u,attempts:i,success:false};let y=Gu(p,r,o,s);if(m)try{m(u,p,y);}catch(w){console.error("Error in retry callback:",w);}await new Promise(w=>setTimeout(w,y));}}return {error:u||new Error("Unknown error"),attempts:i,success:false}}function _u(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 Vu(e,t={}){return async(...a)=>Nn(()=>e(...a),t)}var Us=class{constructor(t=5,a=6e4){this.threshold=t;this.resetTimeout=a;this.failures=0;this.lastFailureTime=0;this.isOpen=false;}async execute(t){if(this.isOpen)if(Date.now()-this.lastFailureTime>=this.resetTimeout)this.reset();else throw new Error("Circuit breaker is open - too many failures");try{let a=await t();return this.onSuccess(),a}catch(a){throw this.onFailure(),a}}onSuccess(){this.failures=0,this.isOpen=false;}onFailure(){this.failures++,this.lastFailureTime=Date.now(),this.failures>=this.threshold&&(this.isOpen=true);}reset(){this.failures=0,this.isOpen=false;}getStatus(){return {failures:this.failures,isOpen:this.isOpen}}};var pd=(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))(pd||{}),ro=class ro{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,m=`[${a}] [${r}] [${s}]`,u=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(m,o,u?n:"");break;case "INFO":console.info(m,o,u?n:"");break;case "WARN":console.warn(m,o,u?n:"");break;case "ERROR":console.error(m,o,u?n:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...ro.globalOptions};}static configure(t){ro.globalOptions={...ro.globalOptions,...t};}child(t){return new ro({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,a){this.log(0,t,a);}info(t,a){this.log(1,t,a);}warn(t,a){this.log(2,t,a);}error(t,a,r){this.log(3,t,{...r,error:a?{message:a.message,stack:a.stack,name:a.name}:void 0});}startTimer(t){return this.options.enableTiming?new Dn((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Dn(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:pd[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};ro.globalOptions={};var zs=ro,Dn=class{constructor(t,a){this.onEnd=t;this.enabled=a;this.startTime=a?performance.now():0;}end(t){if(!this.enabled)return 0;let a=Math.round(performance.now()-this.startTime);return this.onEnd(a,t),a}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},ud=new zs;function Ku(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 Yu(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(m=>m.id===s.columnId);return [s.id,Hs(s.title),Hs(s.description||""),Hs(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
2
+ `)}async function qu(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await fm__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),m=n.toDataURL("image/png"),u=297,i=210,p=n.width/n.height,d=u-20,g=d/p;g>i-20&&(g=i-20,d=g*p);let y=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});y.setFontSize(16),y.setTextColor(255,255,255),y.setFillColor(10,10,10),y.rect(0,0,u,15,"F"),y.text(e.title||"Kanban Board",10,10);let w=(u-d)/2;return y.addImage(m,"PNG",w,20,d,g),y}catch(n){console.error("Error capturing board:",n);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let m=e.cards.filter(u=>u.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,m.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):m.forEach(u=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(u.title,25,s),s+=6,u.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(u.description,160);o.text(p,25,s),s+=p.length*5;}let i=[];if(u.priority&&i.push(`Priority: ${u.priority}`),u.labels&&u.labels.length>0&&i.push(`Labels: ${u.labels.join(", ")}`),u.assignedUserIds&&u.assignedUserIds.length>0&&i.push(`Assigned: ${u.assignedUserIds.length} user(s)`),u.startDate||u.endDate){let p=[];u.startDate&&p.push(`Start: ${u.startDate}`),u.endDate&&p.push(`End: ${u.endDate}`),i.push(p.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function Hs(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function fd(e,t,a,r){switch(t){case "json":return Ku(e,r);case "csv":return Yu(e);case "pdf":return await qu(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function bd(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let p=`${r}.pdf`;e.save(p);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},m=new Blob([e],{type:n[t]}),u=URL.createObjectURL(m),i=document.createElement("a");i.href=u,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(u);}function Xu(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 Ju(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=hd(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let m=hd(t[n]||"");if(m.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-m.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${m.length})`);continue}for(;m.length<a.length;)m.push("");let i={};a.forEach((y,w)=>{i[y]=m[w]||"";});let p=i.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let d=o.get(p),g={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(g),d.cardIds.push(g.id);}catch(m){s.push(`Line ${n+1}: ${m instanceof Error?m.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function hd(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function yd(e,t){switch(t){case "json":return Xu(e);case "csv":return Ju(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function vd(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 Ws=react.createContext(null);function xd(){return react.useContext(Ws)}var wd=react.createContext(null);function kd({children:e,themeName:t}){return jsxRuntime.jsx(wd.Provider,{value:{themeName:t},children:e})}function Co(){return react.useContext(wd)}function bt({children:e,container:t}){let[a,r]=react.useState(false),o=xd(),s=Co();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:m,themeName:u}=o,i={"--asakaa-color-background-primary":m.bgPrimary,"--asakaa-color-background-secondary":m.bgSecondary,"--asakaa-color-background-card":m.bgGrid,"--asakaa-color-background-hover":m.hoverBg,"--asakaa-color-text-primary":m.textPrimary,"--asakaa-color-text-secondary":m.textSecondary,"--asakaa-color-text-tertiary":m.textTertiary,"--asakaa-color-text-inverse":m.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":m.border,"--asakaa-color-border-hover":m.borderLight,"--asakaa-color-border-subtle":m.borderLight,"--asakaa-color-interactive-primary":m.accent,"--asakaa-color-interactive-primaryHover":m.accentHover,"--asakaa-color-interactive-primaryBorder":`${m.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${m.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${m.accent}33`,"--asakaa-color-status-success":m.statusCompleted,"--asakaa-color-status-warning":m.milestone,"--asakaa-color-status-error":m.criticalPath,"--asakaa-color-danger":m.criticalPath,"--asakaa-color-danger-border":`${m.criticalPath}4D`,"--asakaa-color-danger-background":`${m.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${m.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":u,"data-gantt-portal":"true",style:i,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var Sd={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},ng="#BDC3C7",sg=({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 oo({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),m=react.useRef(null),u=react.useRef(null),i=()=>{if(!u.current)return;let y=u.current.getBoundingClientRect(),w=window.innerHeight,k=window.innerWidth,h=160,b=220,x=4,f=y.right-h;f<10&&(f=y.left),f+h>k-10&&(f=k-h-10);let c=w-y.bottom,C=y.top,D;c>=b+x?D=y.bottom+x:C>=b+x?D=y.top-b-x:D=c>=C?y.bottom+x:Math.max(10,y.top-b-x),n({top:D,left:f}),o(true);};react.useEffect(()=>{let y=w=>{m.current&&!m.current.contains(w.target)&&!u.current?.contains(w.target)&&o(false);};if(r)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[r]),react.useEffect(()=>{let y=w=>{w.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[r]);let p=y=>{t(y),o(false);},d=e?Sd[e]:null,g=d?.color||ng;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:u,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${g}10`:"transparent",boxShadow:e?`0 0 0 2px ${g}30 inset`:"none"},title:d?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:g,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:g,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(bt,{children:jsxRuntime.jsxs("div",{ref:m,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(Sd).map(([y,w])=>jsxRuntime.jsxs("button",{onClick:()=>p(y),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:w.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(sg,{color:w.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:w.label}),e===y&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>p(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("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 ig=[{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 _o({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,m]=react.useState({top:0,left:0}),u=react.useRef(null),i=react.useRef(null),g=(Co()?.themeName||"dark")==="dark",y=()=>{if(!i.current)return;let f=i.current.getBoundingClientRect(),c=window.innerHeight,C=window.innerWidth,D=320,T=380,v=4,I=f.left;I+D>C-10&&(I=C-D-10),I<10&&(I=10);let B=c-f.bottom,N=f.top,G;B>=T+v?G=f.bottom+v:N>=T+v?G=f.top-T-v:G=B>=N?f.bottom+v:Math.max(10,f.top-T-v),m({top:G,left:I}),s(true);};react.useEffect(()=>{let f=c=>{u.current&&!u.current.contains(c.target)&&!i.current?.contains(c.target)&&s(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),react.useEffect(()=>{let f=c=>{c.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let w=f=>{let c=new Date,C=I=>{let B=I.getFullYear(),N=String(I.getMonth()+1).padStart(2,"0"),G=String(I.getDate()).padStart(2,"0");return `${B}-${N}-${G}`},D=C(c),T=new Date(c);T.setDate(T.getDate()+f);let v=C(T);a(D,v),s(false);},k=()=>{if(!e||!t)return "Set date";let f=T=>{if(T instanceof Date)return T;if(typeof T!="string"||!T.match(/^\d{4}-\d{2}-\d{2}$/))return null;let v=T.split("-").map(Number);if(v.length!==3||v.some(G=>isNaN(G)))return null;let I=v[0],B=v[1],N=v[2];return I===void 0||B===void 0||N===void 0?null:new Date(I,B-1,N)},c=f(e),C=f(t);if(!c||!C||isNaN(c.getTime())||isNaN(C.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[c.getMonth()]} ${c.getDate()} \u2013 ${D[C.getMonth()]} ${C.getDate()}`},h=e&&t,x=(()=>{if(!t)return false;let f=typeof t=="string"?new Date(t):t,c=new Date;return c.setHours(0,0,0,0),f<c})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):y(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${x?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${k()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:k()})]}),o&&jsxRuntime.jsx(bt,{children:jsxRuntime.jsxs("div",{ref:u,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:g?"#1A1D25":"#FFFFFF",border:`1px solid ${g?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:g?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:g?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:g?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:ig.map(f=>jsxRuntime.jsx("button",{onClick:()=>w(f.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:c=>{c.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",c.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:c=>{c.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",c.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:f.label},f.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color: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:f=>a(f.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background: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:f=>a(e,f.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background: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:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function so({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[m,u]=react.useState(""),[i,p]=react.useState({top:0,left:0}),d=react.useRef(null),g=react.useRef(null),y=()=>{if(!g.current)return;let x=g.current.getBoundingClientRect(),f=window.innerHeight,c=window.innerWidth,C=300,D=380,T=4,v=x.right-C;v<10&&(v=x.left),v+C>c-10&&(v=c-C-10);let I=f-x.bottom,B=x.top,N;I>=D+T?N=x.bottom+T:B>=D+T?N=x.top-D-T:N=I>=B?x.bottom+T:Math.max(10,x.top-D-T),p({top:N,left:v}),n(true);};react.useEffect(()=>{let x=f=>{d.current&&!d.current.contains(f.target)&&!g.current?.contains(f.target)&&(n(false),u(""));};if(s)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[s]),react.useEffect(()=>{let x=f=>{f.key==="Escape"&&(n(false),u(""));};if(s)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[s]);let w=x=>{let f=e.some(c=>c.id===x.id);a(f?e.filter(c=>c.id!==x.id):[...e,x]);},k=t.filter(x=>x.name.toLowerCase().includes(m.toLowerCase())),h=e.slice(0,o),b=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:g,onClick:()=>s?n(false):y(),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(x=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:x.name,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"asakaa-avatar-img"}):x.initials},x.id)),b>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):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(bt,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:m,onChange:x=>u(x.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:k.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):k.map(x=>{let f=e.some(c=>c.id===x.id);return jsxRuntime.jsxs("button",{onClick:()=>w(x),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:c=>{c.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:c=>{c.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:x.color,color:"#fff"},children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.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:x.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:f?"#3b82f6":"transparent"},children:f?"\u2713":""})]},x.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Sn(e,t,a){let r=new Map;e.forEach(u=>{if(u.dependencies&&Array.isArray(u.dependencies)){let i=u.dependencies.map(p=>{if(typeof p=="string")return p;let d=p;return d.taskId||d.targetId||""}).filter(Boolean);r.set(u.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,m=u=>{if(!s.has(u)){s.add(u),n.add(u);let i=r.get(u)||[];for(let p of i){if(!s.has(p)&&m(p))return true;if(n.has(p))return true}}return n.delete(u),false};return m(a)}function jo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[m,u]=react.useState(false),[i,p]=react.useState(""),[d,g]=react.useState(t.length>0),[y,w]=react.useState({top:0,left:0}),[k,h]=react.useState(null),b=react.useRef(null),x=react.useRef(null),f=()=>{if(!x.current)return;let v=x.current.getBoundingClientRect(),I=window.innerHeight,B=window.innerWidth,N=300,G=d?380:120,H=4,Y=v.right-N;Y<10&&(Y=v.left),Y+N>B-10&&(Y=B-N-10);let le=I-v.bottom,re=v.top,oe;le>=G+H?oe=v.bottom+H:re>=G+H?oe=v.top-G-H:oe=le>=re?v.bottom+H:Math.max(10,v.top-G-H),w({top:oe,left:Y}),u(true);};react.useEffect(()=>{if(!m||!x.current)return;let v=x.current.getBoundingClientRect(),I=window.innerHeight,B=window.innerWidth,N=300,G=d?380:120,H=4,Y=v.right-N;Y<10&&(Y=v.left),Y+N>B-10&&(Y=B-N-10);let le=I-v.bottom,re=v.top,oe;le>=G+H?oe=v.bottom+H:re>=G+H?oe=v.top-G-H:oe=le>=re?v.bottom+H:Math.max(10,v.top-G-H),w({top:oe,left:Y});},[d,m]),react.useEffect(()=>{let v=I=>{b.current&&!b.current.contains(I.target)&&!x.current?.contains(I.target)&&(u(false),p(""));};if(m)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[m]),react.useEffect(()=>{let v=I=>{I.key==="Escape"&&(u(false),p(""));};if(m)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[m]);let c=v=>{let I=t.includes(v),B=a.find(N=>N.id===v);if(h(null),I){let N=t.filter(G=>G!==v);r(N),N.length===0&&g(false);}else {if(s&&Sn(a,v,e)){let G=`Cannot add "${B?.title||v}" as dependency - would create circular reference`;h(G),n?.(v,B?.title||v),setTimeout(()=>h(null),3e3);return}r([...t,v]),g(true);}},C=()=>{let v=!d;g(v),v||r([]);},D=a.filter(v=>v.id!==e).filter(v=>v.title.toLowerCase().includes(i.toLowerCase())||v.id.toLowerCase().includes(i.toLowerCase())),T=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:x,onClick:()=>m?u(false):f(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:T,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:T},children:t.length})]}),m&&jsxRuntime.jsx(bt,{children:jsxRuntime.jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${y.top}px`,left:`${y.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[k&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:k})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:C,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:v=>p(v.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children: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(v=>{let I=t.includes(v.id);return jsxRuntime.jsxs("button",{onClick:()=>c(v.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:B=>{B.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:B=>{B.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:I?"#3b82f6":"transparent",borderColor:I?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:I&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:v.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:v.id})]})]},v.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),g(false),u(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 Er=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:m=[],allCards:u=[]})=>{let{attributes:i,listeners:p,setNodeRef:d,transform:g,transition:y,isDragging:w}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),k={transform:Cn.Transform.toString(g),transition:y};if(t)return jsxRuntime.jsx("div",{ref:d,style:k,...i,...p,onClick:()=>a?.(e),children:t(e)});let h=m.filter(c=>e.assignedUserIds?.includes(c.id)),b=e.progress===100,x=(e.attachments||[]).filter(c=>c.type.startsWith("image/")),f={...k,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:f,className:l("asakaa-card",w&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...p,onClick:c=>{c.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:c=>{c.currentTarget.style.display="none";}})}),x.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:x.length===1&&x[0]?jsxRuntime.jsx("img",{src:x[0].url,alt:x[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:c=>{c.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:x.slice(0,4).map((c,C)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:c.url,alt:c.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";}}),C===3&&x.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:["+",x.length-4]})})]},c.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.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:c=>c.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(oo,{priority:e.priority,onChange:c=>n?.(e.id,{priority:c})})}),jsxRuntime.jsx("div",{onClick:c=>c.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(_o,{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:(c,C)=>n?.(e.id,{startDate:c,endDate:C})})}),m.length>0&&jsxRuntime.jsx("div",{onClick:c=>c.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(so,{assignedUsers:h,availableUsers:m,onChange:c=>n?.(e.id,{assignedUserIds:c.map(C=>C.id)})})}),jsxRuntime.jsx("div",{onClick:c=>c.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(jo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(c=>typeof c=="string"?c:c.taskId):[],availableTasks:u,onChange:c=>n?.(e.id,{dependencies:c})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(c=>jsxRuntime.jsx("span",{className:"asakaa-label",children:c},c))}),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)));Er.displayName="Card";var En={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Od=({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 $d({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,m]=react.useState({top:0,left:0}),u=react.useRef(null),i=react.useRef(null),p=[...Object.entries(En).map(([h,b])=>({id:h,label:b.label,color:b.color,icon:b.icon})),...r.filter(h=>!Object.keys(En).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let h=En[e];if(h)return {...h,id:e};let b=r.find(x=>x.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...En.todo,id:"todo"}},g=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),b=window.innerHeight,x=window.innerWidth,f=180,c=280,C=4,D=h.right-f;D<10&&(D=h.left),D+f>x-10&&(D=x-f-10);let T=b-h.bottom,v=h.top,I;T>=c+C?I=h.bottom+C:v>=c+C?I=h.top-c-C:I=T>=v?h.bottom+C:Math.max(10,h.top-c-C),m({top:I,left:D}),s(true);};react.useEffect(()=>{let h=b=>{u.current&&!u.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let y=h=>{t(h),s(false);},w=d(),k=w.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):g(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${k}10`,boxShadow:`0 0 0 2px ${k}30 inset`},title:w.label,children:jsxRuntime.jsx(Od,{icon:w.icon,color:k})}),o&&jsxRuntime.jsx(bt,{children:jsxRuntime.jsxs("div",{ref:u,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:p.map(h=>jsxRuntime.jsxs("button",{onClick:()=>y(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:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Od,{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 Ud({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[m,u]=react.useState(false),[i,p]=react.useState(e),[d,g]=react.useState({top:0,left:0}),y=react.useRef(null),w=react.useRef(null),k=react.useRef(null);react.useEffect(()=>{if(s&&w.current){let f=w.current.getBoundingClientRect();g({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[s]),react.useEffect(()=>{let f=c=>{y.current&&!y.current.contains(c.target)&&!w.current?.contains(c.target)&&(n(false),u(false));};if(s)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),react.useEffect(()=>{let f=c=>{c.key==="Escape"&&(n(false),u(false),p(e));};if(s)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[s,e]),react.useEffect(()=>{m&&k.current&&(k.current.focus(),k.current.select());},[m]);let h=()=>{u(true),p(e);},b=()=>{let f=i.trim();f&&f!==e&&t(f),u(false),n(false),p(e);},x=f=>{f.key==="Enter"?b():f.key==="Escape"&&(u(false),p(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:w,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsxRuntime.jsx(bt,{children:jsxRuntime.jsx("div",{ref:y,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:m?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:k,type:"text",value:i,onChange:f=>p(f.target.value),onKeyDown:x,onBlur:b,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),n(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var Do=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:m,availableUsers:u,allCards:i,enableVirtualization:p,cardHeight:d=120,isCollapsed:g,onToggleCollapse:y,onColumnRename:w,onColumnDelete:k,isDeletable:h=false,className:b})=>{let{setNodeRef:x,isOver:f}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),c=react.useRef(null),C=p??md(t.length),D=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>c.current,estimateSize:()=>d,enabled:C});if(a)return jsxRuntime.jsx("div",{ref:x,className:b,children:a(e,t)});let v=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let N=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:N}:N>=80?{state:"warning",percentage:N}:N>=60?{state:"approaching",percentage:N}:{state:"ok",percentage:N}})(),I=v.state==="exceeded",B=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:x,className:l("asakaa-column",f&&"ring-2 ring-asakaa-accent-blue",I&&"ring-2 ring-asakaa-accent-red",b),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:l(B()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&v.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${v.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[v.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),v.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),v.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),v.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(w||k)&&jsxRuntime.jsx(Ud,{columnTitle:e.title,onRename:N=>w?.(e.id,N),onDelete:k?()=>k(e.id):void 0,isDeletable:h}),y&&jsxRuntime.jsx("button",{onClick:y,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:c,className:"asakaa-column-cards",style:{maxHeight:C?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(N=>N.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"})}):C?jsxRuntime.jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(N=>{let G=t[N.index];return G?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${N.start}px)`},children:jsxRuntime.jsx(Er,{card:G,render:r,onClick:n,onUpdate:m,availableUsers:u,allCards:i})},G.id):null})}):t.map(N=>jsxRuntime.jsx(Er,{card:N,render:r,onClick:n,onUpdate:m,availableUsers:u,allCards:i},N.id))})})]})});Do.displayName="Column";function Ks({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),m=react.useRef(null);react.useEffect(()=>{r&&m.current&&(m.current.focus(),m.current.select());},[r]);let u=()=>{let p=s.trim();p&&p!==e?t(p):n(e),o(false);},i=p=>{p.key==="Enter"?u():p.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:m,type:"text",value:s,onChange:p=>n(p.target.value),onBlur:u,onKeyDown:i,className:l("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:l("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Sg(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Vd(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(m=>m.name.toLowerCase().replace(/\s+/g,"")===s||m.name.toLowerCase()===s);n&&!a.includes(n.id)&&a.push(n.id);}return a}function Eg(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Pg(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Mg=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function jd({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:m="dark",locale:u="es",currentUser:i,enableEmoji:p=true,enableAttachments:d=true,pendingFiles:g=[],onFilesSelect:y,onRemoveFile:w,maxFileSizeMB:k=10}){let h=m==="dark",[b,x]=react.useState(false),[f,c]=react.useState([]),[C,D]=react.useState(0),[T,v]=react.useState(null),[I,B]=react.useState(false),N=react.useRef(null),G=react.useRef(null),H=react.useRef(null),Y=react.useRef(null),le=react.useCallback((S,R)=>{let K=Sg(S,R);if(v(K),K){let se=r.filter(pe=>pe.name.toLowerCase().includes(K.query)||pe.email&&pe.email.toLowerCase().includes(K.query)).slice(0,5);c(se),x(se.length>0),D(0);}else x(false),c([]);},[r]),re=S=>{let R=S.target.value;t(R),le(R,S.target.selectionStart||0);},oe=()=>{N.current&&le(e,N.current.selectionStart||0);},be=react.useCallback(S=>{if(!T||!N.current)return;let R=e.slice(0,T.start),K=e.slice(T.end),se=`@${S.name.replace(/\s+/g,"")} `,pe=R+se+K;t(pe),x(false),v(null),setTimeout(()=>{if(N.current){let me=T.start+se.length;N.current.selectionStart=me,N.current.selectionEnd=me,N.current.focus();}},0);},[T,e,t]),ve=S=>{if(b&&f.length>0)switch(S.key){case "ArrowDown":S.preventDefault(),D(R=>R<f.length-1?R+1:0);break;case "ArrowUp":S.preventDefault(),D(R=>R>0?R-1:f.length-1);break;case "Enter":{S.preventDefault();let R=f[C];R&&be(R);break}case "Tab":{S.preventDefault();let R=f[C];R&&be(R);break}case "Escape":S.preventDefault(),x(false);break}else S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),a());};react.useEffect(()=>{let S=R=>{G.current&&!G.current.contains(R.target)&&N.current&&!N.current.contains(R.target)&&x(false),Y.current&&!Y.current.contains(R.target)&&B(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let Be=react.useCallback(S=>{if(!N.current)return;let R=N.current.selectionStart||e.length,K=e.slice(0,R)+S+e.slice(R);t(K),B(false),setTimeout(()=>{if(N.current){let se=R+S.length;N.current.selectionStart=se,N.current.selectionEnd=se,N.current.focus();}},0);},[e,t]),L=react.useCallback(S=>{if(!y||!S.target.files)return;let R=Array.from(S.target.files),K=k*1024*1024,se=R.filter(pe=>pe.size>K?(console.warn(`File ${pe.name} exceeds max size of ${k}MB`),false):true);se.length>0&&y(se),S.target.value="";},[y,k]),$=react.useCallback(S=>S.type.startsWith("image/")?lucideReact.Image:S.type.includes("pdf")||S.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(b&&G.current){let S=G.current.children[C];S&&S.scrollIntoView({block:"nearest"});}},[C,b]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[g.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:g.map(S=>{let R=$(S.file),K=S.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:l("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[K&&S.preview?jsxRuntime.jsx("img",{src:S.preview,alt:S.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(R,{className:l("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:l("text-xs truncate",h?"text-white":"text-gray-900"),children:S.file.name}),jsxRuntime.jsx("p",{className:l("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:Pg(S.file.size)})]}),w&&jsxRuntime.jsx("button",{onClick:()=>w(S.id),className:l("p-0.5 rounded-full transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:l("flex-1 relative"),children:[jsxRuntime.jsxs("div",{className:l("flex items-center gap-1 px-3 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[p&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>B(!I),disabled:s||n,className:l("p-1.5 rounded transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Y,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:l("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:Mg.map(S=>jsxRuntime.jsx("button",{type:"button",onClick:()=>Be(S),className:l("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",h?"hover:bg-white/10":"hover:bg-gray-100"),children:S},S))})})})]}),d&&y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>H.current?.click(),disabled:s||n,className:l("p-1.5 rounded transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:u==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:H,type:"file",multiple:true,onChange:L,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("input",{ref:N,type:"text",value:e,onChange:re,onSelect:oe,onKeyDown:ve,placeholder:o||(u==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,className:l("flex-1 bg-transparent text-sm outline-none min-w-0",h?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(s||n)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()&&g.length===0||s,className:l("p-1.5 rounded transition-colors",(e.trim()||g.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":h?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&f.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:G,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:l("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:f.map((S,R)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>be(S),className:l("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",R===C?h?"bg-white/10":"bg-gray-100":h?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:S.color||"#8B5CF6"},children:Eg(S.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:l("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:S.name}),S.email&&jsxRuntime.jsx("p",{className:l("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:S.email})]})]},S.id))})})]})]})]})}function Kd({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((m,u)=>m.type==="mention"?jsxRuntime.jsx("span",{className:l("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:m.value},u):jsxRuntime.jsx("span",{children:m.value},u))})}var Ln=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function yr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[m,u]=react.useState(false),[i,p]=react.useState(""),[d,g]=react.useState(false),[y,w]=react.useState(Ln[10]||"#3B82F6"),[k,h]=react.useState({top:0,left:0}),b=react.useRef(null),x=react.useRef(null),f=react.useRef(null),c=react.useRef(null),C=t.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),D=t.some(N=>N.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(m&&x.current){let N=x.current.getBoundingClientRect();h({top:N.bottom+6,left:N.left});}},[m]),react.useEffect(()=>{let N=G=>{let H=G.target,Y=b.current?.contains(H),le=f.current?.contains(H);!Y&&!le&&(u(false),p(""),g(false));};if(m)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[m]),react.useEffect(()=>{m&&c.current&&c.current.focus();},[m]);let T=N=>{let G=e.some(H=>H.id===N.id);a(G?e.filter(H=>H.id!==N.id):[...e,N]);},v=async()=>{if(!(!r||!i.trim())){g(true);try{let N=await r(i.trim(),y);N&&(a([...e,N]),p(""),w(Ln[Math.floor(Math.random()*Ln.length)]||"#3B82F6"));}finally{g(false);}}},I=(N,G)=>{G.stopPropagation(),a(e.filter(H=>H.id!==N));},B={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:b,className:"relative",children:[jsxRuntime.jsxs("button",{ref:x,type:"button",onClick:()=>!s&&u(!m),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:B,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(N=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${N.color}20`,color:N.color},children:N.name},N.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:f,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:k.top,left:k.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:c,type:"text",value:i,onChange:N=>p(N.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:N=>{N.key==="Enter"&&i.trim()&&!D&&r&&v();}})}),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(N=>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:`${N.color}20`,color:N.color},onClick:G=>I(N.id,G),children:[N.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},N.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:C.length>0?C.map(N=>{let G=e.some(H=>H.id===N.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>T(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:G?`${N.color}15`:"transparent",color:o.textPrimary},onMouseEnter:H=>{G||(H.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:H=>{G||(H.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:N.name}),G&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:N.color}})]},N.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!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:Ln.map(N=>jsxRuntime.jsx("button",{type:"button",onClick:()=>w(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:y===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxRuntime.jsxs("button",{type:"button",onClick:v,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:y,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function qs({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 qd({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(qs,{tag:s,size:a},s.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var vr=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function ac(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description}}return e}function af(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 co({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:m=[],availableTags:u=[],onCreateTag:i,attachments:p=[],onUploadAttachments:d,onDeleteAttachment:g,availableTasks:y=[],comments:w=[],onAddComment:k,currentUser:h,mentionableUsers:b=[],onUploadCommentAttachments:x}){let f=s==="dark",c={textTertiary:f?"#6B7280":"#9CA3AF",textSecondary:f?"#9CA3AF":"#6B7280",textPrimary:f?"#FFFFFF":"#111827",borderLight:f?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:f?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:f?"#1A1D25":"#FFFFFF",bgSecondary:f?"#0F1117":"#F9FAFB",hoverBg:f?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},C=e&&"title"in e&&!("name"in e),D=e,[T,v]=react.useState(e?ac(e,m):null),[I,B]=react.useState(false),[N,G]=react.useState(false),[H,Y]=react.useState(false),[le,re]=react.useState(null),[oe,be]=react.useState(new Date),[ve,Be]=react.useState(false),[L,$]=react.useState(false),[S,R]=react.useState(""),[K,se]=react.useState(false),[pe,me]=react.useState(false),[Le,Z]=react.useState(false),[Ze,Ne]=react.useState(""),Xe=react.useRef(null),[pt,wt]=react.useState(""),Qe=react.useRef(null),[gt,Nt]=react.useState(""),[Pt,it]=react.useState(false),[O,ce]=react.useState([]);react.useEffect(()=>{if(e){let P=ac(e,m);v(P),Ne(P.description||""),wt(P.name||"");}},[e?.id,m]),react.useEffect(()=>()=>{Xe.current&&clearTimeout(Xe.current),Qe.current&&clearTimeout(Qe.current);},[]);let we=react.useCallback(P=>{v(P),C&&o&&D?o(af(P,D)):r&&r(P);},[C,D,o,r]),$e=react.useCallback(()=>{B(false),G(false),Y(false),re(null),$(false),R(""),se(false);},[]),Ke=react.useCallback((P,ee)=>{if(!T)return;let xe={...T,[P]:ee};we(xe);},[T,we]),ft=react.useCallback(P=>{Ne(P),Xe.current&&clearTimeout(Xe.current),Xe.current=setTimeout(()=>{if(T){let ee={...T,description:P};we(ee);}},800);},[T,we]),X=react.useCallback(P=>{wt(P),Qe.current&&clearTimeout(Qe.current),Qe.current=setTimeout(()=>{if(T&&P.trim()){let ee={...T,name:P.trim()};we(ee);}},800);},[T,we]),te=react.useCallback(P=>{let ee=P.map(xe=>{let z={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:xe};return xe.type.startsWith("image/")&&(z.preview=URL.createObjectURL(xe)),z});ce(xe=>[...xe,...ee]);},[]),Ye=react.useCallback(P=>{ce(ee=>{let xe=ee.find(z=>z.id===P);return xe?.preview&&URL.revokeObjectURL(xe.preview),ee.filter(z=>z.id!==P)});},[]),ze=react.useCallback(async()=>{if(!(!T||!gt.trim()&&O.length===0||!k)){it(true);try{let P=Vd(gt,b),ee=[];if(O.length>0&&x){let xe=O.map(z=>z.file);ee=await x(xe);}await k(T.id,gt.trim(),P.length>0?P:void 0,ee.length>0?ee:void 0),Nt(""),O.forEach(xe=>{xe.preview&&URL.revokeObjectURL(xe.preview);}),ce([]);}finally{it(false);}}},[T,gt,O,k,b,x]),et=react.useCallback(P=>{let ee=typeof P=="string"?new Date(P):P,z=new Date().getTime()-ee.getTime(),j=Math.floor(z/6e4),ge=Math.floor(z/36e5),Ie=Math.floor(z/864e5);return j<1?n==="es"?"Ahora":"Just now":j<60?n==="es"?`Hace ${j} min`:`${j}m ago`:ge<24?n==="es"?`Hace ${ge}h`:`${ge}h ago`:Ie<7?n==="es"?`Hace ${Ie}d`:`${Ie}d ago`:ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),st=react.useCallback(P=>{if(!T)return;let ee=T.progress||0;P==="completed"?ee=100:P==="in-progress"&&ee===0?ee=10:P==="todo"&&(ee=0);let xe={...T,status:P,progress:ee};we(xe),B(false);},[T,we]),Re=react.useCallback((P,ee)=>{if(!T)return;let xe={...T,startDate:P,endDate:ee};we(xe);},[T,we]),qe=react.useCallback(()=>{let P=oe.getFullYear(),ee=oe.getMonth(),xe=new Date(P,ee,1),j=new Date(P,ee+1,0).getDate(),ge=xe.getDay(),Ie=[],Te=new Date(P,ee,0).getDate();for(let ae=ge-1;ae>=0;ae--)Ie.push({date:new Date(P,ee-1,Te-ae),isCurrentMonth:false});for(let ae=1;ae<=j;ae++)Ie.push({date:new Date(P,ee,ae),isCurrentMonth:true});let U=42-Ie.length;for(let ae=1;ae<=U;ae++)Ie.push({date:new Date(P,ee+1,ae),isCurrentMonth:false});return Ie},[oe]),ne=react.useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),me(false),!T||!d)return;let ee=Array.from(P.dataTransfer.files);if(ee.length!==0){Z(true);try{await d(T.id,ee);}finally{Z(false);}}},[T,d]),Ge=react.useCallback(async P=>{if(!T||!d||!P.target.files)return;let ee=Array.from(P.target.files);if(ee.length!==0){Z(true);try{await d(T.id,ee);}finally{Z(false);}P.target.value="";}},[T,d]),ca=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),me(true);},[]),ue=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),me(false);},[]),Ve=react.useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),Oe=react.useCallback(P=>P.startsWith("image/")?lucideReact.Image:P.includes("pdf")||P.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!T?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&T&&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:l("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",f?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:l("px-6 py-3 border-b flex items-center gap-3",f?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:l("w-4 h-4",f?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:l("text-xs px-2 py-0.5 rounded",f?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:l("text-xs font-mono",f?"text-[#6B7280]":"text-gray-400"),children:T.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:l("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",f?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:l("p-1.5 rounded transition-colors",f?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:l("p-1.5 rounded transition-colors",f?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:a,className:l("p-1.5 rounded transition-colors",f?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let P=T.progress===100?0:100,xe={...T,progress:P,status:P===100?"completed":"todo"};we(xe);},className:l("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",T.progress===100?"bg-green-500 border-green-500":f?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:T.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:pt,onChange:P=>X(P.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:l("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",T.progress===100?"line-through text-[#6B7280]":f?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:l("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{$e(),B(!I);},className:l("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",T.progress===100||T.status==="completed"?"bg-green-500/20 text-green-400":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/20 text-blue-400":f?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:T.progress===100||T.status==="completed"?n==="es"?"COMPLETADO":"DONE":T.progress&&T.progress>0||T.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>B(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",f?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(P=>jsxRuntime.jsxs("button",{onClick:()=>st(P.id),className:l("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",f?"hover:bg-white/5":"hover:bg-gray-50",T.status===P.id&&(f?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:l("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:f?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:l("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{$e(),Y(!H);},className:l("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",f?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[T.assignees&&T.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[T.assignees.slice(0,3).map((P,ee)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:P.color||"#8B5CF6"},title:P.name,children:P.initials||P.name.slice(0,2).toUpperCase()},ee)),T.assignees.length>3&&jsxRuntime.jsxs("span",{className:l("text-xs",f?"text-[#6B7280]":"text-gray-400"),children:["+",T.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:l("text-sm",f?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:l("w-3 h-3",f?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:H&&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:l("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",f?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:m.length>0?m.map(P=>{let ee=T.assignees?.some(xe=>xe.name===P.name);return jsxRuntime.jsxs("button",{onClick:()=>{let xe=T.assignees||[],z;ee?z=xe.filter(j=>j.name!==P.name):z=[...xe,P],Ke("assignees",z);},className:l("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",f?"hover:bg-white/5":"hover:bg-gray-50",ee&&(f?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:P.color||"#8B5CF6"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:l("flex-1",f?"text-white":"text-gray-900"),children:P.name}),ee&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsxRuntime.jsx("div",{className:l("px-3 py-4 text-sm text-center",f?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:l("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{re(le?null:"start"),be(T.startDate||new Date);},className:l("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",f?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[T.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:l("mx-1",f?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),T.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>re(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:l("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",f?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:l("w-44 py-2 border-r",f?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,ee=new Date(P);ee.setDate(P.getDate()+1);let xe=new Date(P);xe.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let z=new Date(P);z.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let j=new Date(P);j.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let ge=new Date(P);ge.setDate(P.getDate()+14);let Ie=new Date(P);return Ie.setDate(P.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:P,display:P.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ee,display:ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:xe,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:z,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:j,display:j.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:ge,display:ge.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((U,ae)=>jsxRuntime.jsxs("button",{className:l("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",f?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(le==="start"){let Ue=T.endDate&&U.date>T.endDate?U.date:T.endDate;Re(U.date,Ue),re("end");}else {let Ue=T.startDate&&U.date<T.startDate?U.date:T.startDate;Re(Ue,U.date),re(null);}},children:[jsxRuntime.jsx("span",{children:U.label}),jsxRuntime.jsx("span",{className:l("text-xs",f?"text-[#6B7280]":"text-gray-400"),children:U.display})]},ae))})(),jsxRuntime.jsx("div",{className:l("border-t mt-2 pt-2",f?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Re(void 0,void 0),re(null);},className:l("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",f?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:l("text-xs mb-3 px-2 py-1 rounded",f?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:le==="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:l("font-medium",f?"text-white":"text-gray-900"),children:oe.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:()=>be(new Date),className:l("p-1 rounded text-sm transition-colors",f?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>be(new Date(oe.getFullYear(),oe.getMonth()-1)),className:l("p-1 rounded",f?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>be(new Date(oe.getFullYear(),oe.getMonth()+1)),className:l("p-1 rounded",f?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(P=>jsxRuntime.jsx("div",{className:l("w-8 h-8 flex items-center justify-center text-xs",f?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:qe().map((P,ee)=>{let xe=P.date.toDateString()===new Date().toDateString(),z=T.startDate?.toDateString()===P.date.toDateString(),j=T.endDate?.toDateString()===P.date.toDateString(),ge=z||j,Ie=T.startDate&&T.endDate&&P.date>=T.startDate&&P.date<=T.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Te=new Date(P.date);if(le==="start"){let U=T.endDate&&Te>T.endDate?Te:T.endDate;Re(Te,U),re("end");}else {let U=T.startDate&&Te<T.startDate?Te:T.startDate;Re(U,Te),re(null);}},className:l("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(f?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(f?"text-white":"text-gray-900"),xe&&"ring-2 ring-[#3B82F6]",z&&"bg-[#3B82F6] text-white",j&&!z&&"bg-[#7C3AED] text-white",Ie&&!ge&&(f?"bg-[#7C3AED]/20":"bg-purple-100"),!ge&&(f?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},ee)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:l("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{$e(),G(!N);},className:l("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",T.priority==="high"||T.priority==="urgent"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":T.priority==="low"?"bg-green-500/20 text-green-400":f?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:T.priority?T.priority==="high"||T.priority==="urgent"?n==="es"?"Alta":"High":T.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>G(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",f?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(P=>jsxRuntime.jsxs("button",{onClick:()=>{Ke("priority",P.id),G(false);},className:l("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",f?"hover:bg-white/5":"hover:bg-gray-50",T.priority===P.id&&(f?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:l("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:f?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:l("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:l("text-sm",f?"text-white":"text-gray-900"),children:T.startDate&&T.endDate?`${Math.ceil((T.endDate.getTime()-T.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:l("w-4 h-4 rounded-full border-2",f?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ve?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:T.progress||0,onChange:P=>{let ee=parseInt(P.target.value),xe=T.status;ee===100?xe="completed":ee>0?xe="in-progress":xe="todo";let z={...T,progress:ee,status:xe};we(z);},onBlur:()=>Be(false),className:l("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",f?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>Be(true),className:l("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",f?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:l("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:l("text-sm font-medium min-w-[40px]",f?"text-white":"text-gray-900"),children:[T.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:l("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(yr,{selectedTags:T.tags||[],availableTags:u,onChange:P=>{Ke("tags",P);},onCreateTag:i,theme:c})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:l("w-4 h-4 mt-1.5",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24 mt-1",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[T.dependencies&&T.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:T.dependencies.map(P=>{let ee=y.find(xe=>xe.id===P);return jsxRuntime.jsxs("span",{className:l("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",f?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ee?.name||P.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let xe=(T.dependencies||[]).filter(z=>z!==P);Ke("dependencies",xe);},className:l("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},P)})}),jsxRuntime.jsxs("button",{onClick:()=>{$e(),$(!L);},className:l("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",f?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:l("text-sm",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{$(false),R("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",f?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:l("p-2 border-b",f?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:S,onChange:P=>R(P.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:l("w-full px-3 py-2 rounded-md text-sm outline-none",f?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:y.length>0?y.filter(P=>P.id!==T.id).filter(P=>S===""||P.name.toLowerCase().includes(S.toLowerCase())).map(P=>{let ee=T.dependencies?.includes(P.id);return jsxRuntime.jsxs("button",{onClick:()=>{let xe=T.dependencies||[],z;ee?z=xe.filter(j=>j!==P.id):z=[...xe,P.id],Ke("dependencies",z);},className:l("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",f?"hover:bg-white/5":"hover:bg-gray-50",ee&&(f?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:l("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ee?"bg-blue-500 border-blue-500":f?"border-white/30":"border-gray-300"),children:ee&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:l("block truncate",f?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("span",{className:l("text-xs",f?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsxRuntime.jsx("div",{className:l("px-3 py-4 text-sm text-center",f?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:l("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{$e(),se(!K);},className:l("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",f?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:T.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:l("text-sm",f?"text-white":"text-gray-900"),children:vr.find(P=>P.value===T.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:l("w-3 h-3",f?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:K&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>se(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",f?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:vr.map(P=>{let ee=T.color===P.value;return jsxRuntime.jsx("button",{onClick:()=>{Ke("color",P.value),se(false);},className:l("w-7 h-7 rounded-full flex items-center justify-center transition-all",ee&&"ring-2 ring-offset-2",f?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:ee?P.value:void 0},title:P.name,children:ee&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:l("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:T.isMilestone||false,onChange:P=>Ke("isMilestone",P.target.checked),className:l("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",T.isMilestone?"bg-purple-500 border-purple-500":f?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:l("text-sm",f?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:l("mt-6 pt-4 border-t",f?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:l("w-4 h-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:l("text-sm font-semibold",f?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:Ze,onChange:P=>ft(P.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:l("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",f?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:l("flex items-center gap-2 text-sm mt-2 transition-colors",f?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:l("mt-6 pt-4 border-t",f?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:l("text-sm font-semibold mb-3",f?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:l("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",f?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:l("mt-6 pt-4 border-t",f?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:l("text-sm font-semibold mb-3",f?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),T.subtasks&&T.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:T.subtasks.map(P=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:l("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",P.progress===100?"bg-green-500 border-green-500":f?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:P.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:l("text-sm",P.progress===100?"line-through text-[#6B7280]":f?"text-white":"text-gray-900"),children:P.name})]},P.id))}),jsxRuntime.jsxs("button",{className:l("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",f?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:l("mt-6 pt-4 border-t",f?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:l("text-sm font-semibold",f?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:l("p-1 rounded transition-colors",f?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:l("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",f?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:l("mt-6 pt-4 border-t",f?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:l("text-sm font-semibold mb-3",f?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",p.length>0&&jsxRuntime.jsxs("span",{className:l("ml-2 text-xs font-normal",f?"text-[#6B7280]":"text-gray-400"),children:["(",p.length,")"]})]}),p.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:p.map(P=>{let ee=Oe(P.type),xe=P.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:l("flex items-center gap-3 p-2 rounded-lg group transition-colors",f?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[xe&&P.thumbnailUrl?jsxRuntime.jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:l("w-10 h-10 rounded flex items-center justify-center",f?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(ee,{className:l("w-5 h-5",f?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:l("text-sm font-medium truncate block hover:underline",f?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("p",{className:l("text-xs",f?"text-[#6B7280]":"text-gray-400"),children:Ve(P.size)})]}),g&&jsxRuntime.jsx("button",{onClick:()=>g(P.id),className:l("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",f?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},P.id)})}),jsxRuntime.jsxs("div",{onDragOver:ca,onDragLeave:ue,onDrop:ne,className:l("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",pe?f?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":f?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",Le&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Ge,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||Le}),Le?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:l("text-sm",f?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:l("w-6 h-6 mx-auto mb-2",pe?"text-blue-500":f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:l("text-sm",f?"text-[#9CA3AF]":"text-gray-500"),children:pe?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsxRuntime.jsx("p",{className:l("text-xs mt-1",f?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:l("w-80 border-l flex flex-col",f?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:l("px-4 py-3 border-b",f?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:l("text-sm font-semibold",f?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",w.length>0&&jsxRuntime.jsxs("span",{className:l("ml-2 text-xs font-normal",f?"text-[#6B7280]":"text-gray-400"),children:["(",w.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:w.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:w.map(P=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:P.user?.color||"#8B5CF6"},children:P.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:l("text-sm font-medium",f?"text-white":"text-gray-900"),children:P.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:l("text-xs",f?"text-[#6B7280]":"text-gray-400"),children:et(P.createdAt)})]}),jsxRuntime.jsx("div",{className:l("text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Kd,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(ee=>{let xe=ee.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:ee.url,target:"_blank",rel:"noopener noreferrer",className:l("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",f?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[xe?jsxRuntime.jsx(lucideReact.Image,{className:l("w-4 h-4",f?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:l("w-4 h-4",f?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:l("text-xs truncate max-w-[100px]",f?"text-white":"text-gray-900"),children:ee.name})]},ee.id)})})]})]},P.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:l("w-10 h-10 mb-3",f?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:l("text-sm",f?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:l("p-4 border-t",f?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(jd,{value:gt,onChange:Nt,onSubmit:ze,users:b,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!k,isSubmitting:Pt,theme:s,locale:n,currentUser:h,enableEmoji:true,enableAttachments:!!x,pendingFiles:O,onFilesSelect:te,onRemoveFile:Ye})})]})]})]})})}function ei(){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 Wr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:m,isLoading:u,error:i,children:p,availableTags:d=[],onCreateTag:g,attachmentsByCard:y,onUploadAttachments:w,onDeleteAttachment:k,comments:h,onAddComment:b,currentUser:x,mentionableUsers:f,onTaskOpen:c}){let[C,D]=ei(),[T,v]=react.useState(null),I=o?.theme||"dark",B=I==="dark"||I==="neutral",N=B?"dark":"",G=react.useCallback((R,K)=>{t.onCardUpdate?.(R,K);},[t]),H=react.useCallback((R,K)=>{t.onColumnUpdate?.(R,{title:K});},[t]),Y=react.useCallback(R=>{t.onColumnDelete?.(R);},[t]),le=["todo","in-progress","completed"],re=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),oe=react.useMemo(()=>{let R=new Map;return e.columns.forEach(K=>{let se=K.cardIds.map(pe=>e.cards.find(me=>me.id===pe)).filter(pe=>pe!==void 0).sort((pe,me)=>pe.position-me.position);R.set(K.id,se);}),R},[e.cards,e.columns]),be=react.useMemo(()=>e.cards.map(R=>({id:R.id,name:R.title,startDate:R.startDate?new Date(R.startDate):void 0,endDate:R.endDate?new Date(R.endDate):void 0,progress:R.progress||0,status:R.columnId,priority:R.priority?.toLowerCase(),dependencies:Array.isArray(R.dependencies)?R.dependencies.map(K=>typeof K=="string"?K:K.taskId):[]})),[e.cards]),ve=react.useCallback(R=>{let{active:K}=R,se=e.cards.find(pe=>pe.id===K.id);se&&D({isDragging:true,draggedCardId:se.id,sourceColumnId:se.columnId,targetColumnId:se.columnId});},[e.cards,D]),Be=react.useCallback(R=>{let{active:K,over:se}=R;if(!se||!e.cards.find(Le=>Le.id===K.id))return;let me=null;se.data.current?.type==="column"?me=se.id:se.data.current?.type==="card"&&(me=e.cards.find(Z=>Z.id===se.id)?.columnId||null),me&&me!==C.targetColumnId&&D({...C,targetColumnId:me});},[e.cards,C,D]),L=react.useCallback(async R=>{let{active:K,over:se}=R;if(D({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!se)return;let pe=e.cards.find(Ze=>Ze.id===K.id);if(!pe)return;let me,Le;if(se.data.current?.type==="column"){me=se.id;let Ze=oe.get(me)||[];Le=$s(Ze,0);}else {let Ze=e.cards.find(pt=>pt.id===se.id);if(!Ze)return;me=Ze.columnId;let Ne=oe.get(me)||[],Xe=Ne.findIndex(pt=>pt.id===se.id);Le=$s(Ne,Xe);}let Z=e.columns.find(Ze=>Ze.id===me);if(Z&&Z.wipLimit&&Z.wipLimitType==="hard"){let Ze=oe.get(me)||[];if(pe.columnId!==me&&Ze.length>=Z.wipLimit){t.onWipLimitExceeded?.(Z,pe);return}}(pe.columnId!==me||pe.position!==Le)&&await t.onCardMove?.(pe.id,me,Le);},[e.cards,e.columns,oe,t,D]),$=react.useCallback(R=>{v(R),a?.(R),c?.(R.id);},[a,c]),S=react.useCallback(R=>{t.onCardUpdate?.(R.id,R),v(R);},[t]);return u?jsxRuntime.jsx("div",{className:l("asakaa-board",N,n),style:m,children:jsxRuntime.jsx(ff,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:l("asakaa-board",N,n),style:m,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(kd,{themeName:I,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:re,collisionDetection:core$1.closestCorners,onDragStart:ve,onDragOver:Be,onDragEnd:L,children:[jsxRuntime.jsxs("div",{className:l("asakaa-board",N,n),style:m,"data-theme":I,children:[e.columns.sort((R,K)=>R.position-K.position).map(R=>{let K=oe.get(R.id)||[],se=!le.includes(R.id);return jsxRuntime.jsx(Do,{column:R,cards:K,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:$,onCardUpdate:G,onColumnRename:H,onColumnDelete:Y,isDeletable:se,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},R.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:C.draggedCardId?jsxRuntime.jsx(Er,{card:e.cards.find(R=>R.id===C.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(co,{task:T,isOpen:!!T,onClose:()=>v(null),onCardUpdate:S,theme:B?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:g,attachments:T?y?.get(T.id)||[]:[],onUploadAttachments:w,onDeleteAttachment:k,availableTasks:be,comments:h,onAddComment:b,currentUser:x,mentionableUsers:f})]})}function ff({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 xf={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)"},wf={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)"},kf={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Cf={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Tf({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let i=p=>{m.current&&!m.current.contains(p.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let u=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,p)=>i.position-p.position).map((i,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Nf({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[m,u]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let y=w=>{i.current&&!i.current.contains(w.target)&&n(false);};return s&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(y=>y.handler),g=async(y,w)=>{if(w){u(y);try{await w();}catch(k){console.error(`Export ${y} failed:`,k);}finally{u(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((y,w)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>g(y.id,y.handler),disabled:m!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:w<d.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:m===y.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):y.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:y.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})})]})}function Df({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 ai({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:m,onExportExcel:u,translations:i}){let p=r==="dark"?xf:wf,d={...o==="es"?kf:Cf,...i},g=n||m||u;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Nf,{theme:p,t:d,onExportCSV:n,onExportJSON:m,onExportExcel:u}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),t&&(s?jsxRuntime.jsx(Tf,{columns:e,onSelect:t,theme:p,t:d,createTaskLabel:a}):jsxRuntime.jsx(Df,{onClick:()=>t(),label:a||d.newTask}))]})})}function oi({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[m,u]=react.useState(""),i=react.useCallback(()=>{let g=m.trim();g&&(e(g),u(""),n(false));},[m,e]),p=react.useCallback(g=>{g.key==="Enter"?(g.preventDefault(),i()):g.key==="Escape"&&(u(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{m.trim()||n(false);},150);},[m]);return s?jsxRuntime.jsx("div",{className:l("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:m,onChange:g=>u(g.target.value),onKeyDown:p,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!m.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{u(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:l("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function ni({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:m="dark",locale:u="es"}){let[i,p]=react.useState(false),[d,g]=react.useState(false),[y,w]=react.useState(""),[k,h]=react.useState([]),[b,x]=react.useState(""),[f,c]=react.useState(""),[C,D]=react.useState(""),[T,v]=react.useState(false),[I,B]=react.useState(false),[N,G]=react.useState(false),H=react.useRef(null),Y=react.useRef(null),le={placeholder:o||(u==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(u==="es"?"Agregar Tarea":"Add Task"),save:u==="es"?"Guardar":"Save",addAssignee:u==="es"?"Agregar asignado":"Add assignee",addDates:u==="es"?"Agregar fechas":"Add dates",addPriority:u==="es"?"Agregar prioridad":"Add priority",startDate:u==="es"?"Inicio":"Start",endDate:u==="es"?"Fin":"End",low:u==="es"?"Baja":"Low",medium:u==="es"?"Media":"Medium",high:u==="es"?"Alta":"High",urgent:u==="es"?"Urgente":"Urgent"},re=react.useCallback(()=>{w(""),h([]),x(""),c(""),D(""),v(false),B(false),G(false),p(false);},[]);react.useEffect(()=>{i&&H.current&&H.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let L=$=>{Y.current&&!Y.current.contains($.target)&&(y.trim()||re());};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[i,y,re]);let oe=react.useCallback(async()=>{let L=y.trim();if(!(!L||d)){g(true);try{await t({name:L,columnId:e,assigneeIds:k.length>0?k:void 0,startDate:b?new Date(b):void 0,endDate:f?new Date(f):void 0,priority:C||void 0}),w(""),h([]),x(""),c(""),D(""),v(!1),B(!1),G(!1),H.current?.focus();}catch($){console.error("Error creating card:",$);}finally{g(false);}}},[y,e,k,b,f,C,t,d]),be=react.useCallback(L=>{L.key==="Enter"&&!L.shiftKey?(L.preventDefault(),oe()):L.key==="Escape"&&re();},[oe,re]),ve=react.useCallback(L=>{h($=>$.includes(L)?$.filter(S=>S!==L):[...$,L]);},[]),Be=m==="dark";return i?jsxRuntime.jsxs("div",{ref:Y,className:l("rounded-lg overflow-hidden shadow-lg",Be?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:H,type:"text",value:y,onChange:L=>w(L.target.value),onKeyDown:be,placeholder:le.placeholder,disabled:d,className:l("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Be?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>v(!T),className:l("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||k.length>0?"bg-emerald-500/20 text-emerald-400":Be?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:le.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),k.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:k.length})]}),jsxRuntime.jsx("button",{onClick:()=>B(!I),className:l("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",I||b||f?"bg-blue-500/20 text-blue-400":Be?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:le.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>G(!N),className:l("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",N||C?C==="urgent"?"bg-red-500/20 text-red-400":C==="high"?"bg-orange-500/20 text-orange-400":C==="medium"?"bg-yellow-500/20 text-yellow-400":C==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Be?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:le.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:oe,disabled:!y.trim()||d,className:l("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):le.save})]})]}),T&&a.length>0&&jsxRuntime.jsx("div",{className:l("px-3 pb-3 pt-0","border-t",Be?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(L=>jsxRuntime.jsxs("button",{onClick:()=>ve(L.id),className:l("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",k.includes(L.id)?"bg-emerald-500 text-white":Be?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[L.avatar?jsxRuntime.jsx("img",{src:L.avatar,alt:L.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:l("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",k.includes(L.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:L.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:L.name.split(" ")[0]})]},L.id))})}),I&&jsxRuntime.jsx("div",{className:l("px-3 pb-3 pt-0","border-t",Be?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:l("block text-[10px] uppercase tracking-wide mb-1",Be?"text-gray-500":"text-gray-400"),children:le.startDate}),jsxRuntime.jsx("input",{type:"date",value:b,onChange:L=>x(L.target.value),className:l("w-full px-2 py-1.5 rounded text-xs border",Be?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:l("block text-[10px] uppercase tracking-wide mb-1",Be?"text-gray-500":"text-gray-400"),children:le.endDate}),jsxRuntime.jsx("input",{type:"date",value:f,onChange:L=>c(L.target.value),className:l("w-full px-2 py-1.5 rounded text-xs border",Be?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),N&&jsxRuntime.jsx("div",{className:l("px-3 pb-3 pt-0","border-t",Be?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(L=>jsxRuntime.jsx("button",{onClick:()=>D(C===L?"":L),className:l("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",C===L?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[L]} text-white`:Be?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:le[L]},L))})})]}):jsxRuntime.jsxs("button",{onClick:()=>p(true),disabled:n,className:l("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Be?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:le.buttonLabel})]})}var Zo=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(Wr,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
5
+ `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function gc(e={}){return new Zo(e)}var Eo=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function si(e,t){let a=r=>jsxRuntime.jsx(Eo,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function li({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:m,onOpenAIUsage:u,shortcut:i="k",className:p=""}){let[d,g]=react.useState(false),[y,w]=react.useState(""),[k,h]=react.useState("home"),[b,x]=react.useState(""),[f,c]=react.useState("");react.useEffect(()=>{let v=I=>{(I.metaKey||I.ctrlKey)&&I.key===i&&(I.preventDefault(),g(B=>!B)),I.key==="Escape"&&(g(false),h("home"),w(""));};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[i]),react.useEffect(()=>{d||(h("home"),w(""),x(""),c(""));},[d]);let C=react.useCallback(()=>{g(false);},[]),D=react.useCallback(v=>{let[I,B]=v.split(":");switch(I){case "create-card":h("create-card");break;case "create-card-in":x(B||"");break;case "navigate":B?(a?.(B),C()):h("navigate");break;case "search":r?.(y),C();break;case "priority":h("priority");break;case "set-priority":f&&B&&(o?.(f,B),C());break;case "assign":h("assign");break;case "assign-user":f&&B&&(s?.(f,B),C());break;case "ai":h("ai");break;case "ai-generate-plan":n?.(),C();break;case "ai-predict-risks":m?.(),C();break;case "ai-usage":u?.(),C();break;case "back":h("home");break;}},[y,f,t,a,r,o,s,n,m,u,C]),T=react.useCallback(()=>{b&&y.trim()&&(t?.(b,y.trim()),C());},[b,y,t,C]);return d?jsxRuntime.jsx(bt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:C,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:v=>v.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:y,onValueChange:w,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:k==="create-card"&&b?"Type card title and press Enter...":k==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:v=>{v.key==="Enter"&&k==="create-card"&&b&&T();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),k==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect: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(v=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${v.id}`,onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:v.title}),v.labels&&v.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(I=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:I},I))})]},v.id))})]}),k==="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(v=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${v.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:v.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[v.cardIds.length," cards"]})]},v.id))})]}),k==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect: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(v=>{let I=e.columns.find(B=>B.id===v.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${v.id}`,onSelect:D,className:"command-palette-item",keywords:[v.title,v.description||"",...v.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:v.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:I?.title})]}),v.labels&&v.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(B=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:B},B))})]},v.id)})})]}),k==="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 hc(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
6
6
  position: fixed !important;
7
7
  inset: 0 !important;
8
8
  z-index: 2147483647 !important;
@@ -16,7 +16,7 @@
16
16
  max-height: 92vh !important;
17
17
  object-fit: contain !important;
18
18
  cursor: default !important;
19
- `,m.onclick=l=>l.stopPropagation();let u=document.createElement("div");u.className="attachment-lightbox-hint",u.textContent="Click anywhere or press ESC to close",u.style.cssText=`
19
+ `,m.onclick=d=>d.stopPropagation();let u=document.createElement("div");u.className="attachment-lightbox-hint",u.textContent="Click anywhere or press ESC to close",u.style.cssText=`
20
20
  position: absolute !important;
21
21
  bottom: 24px !important;
22
22
  left: 50% !important;
@@ -24,7 +24,7 @@
24
24
  font-size: 12px !important;
25
25
  color: rgba(255, 255, 255, 0.4) !important;
26
26
  pointer-events: none !important;
27
- `;let i=()=>{n.remove(),document.removeEventListener("keydown",p);},p=l=>{if(l.key==="Escape")i();else if(l.key==="ArrowLeft"&&a.length>1){let f=r>0?r-1:a.length-1;i(),o(f);}else if(l.key==="ArrowRight"&&a.length>1){let f=r<a.length-1?r+1:0;i(),o(f);}};if(n.onclick=i,document.addEventListener("keydown",p),a.length>1){let l=document.createElement("div");l.className="attachment-lightbox-dots",l.style.cssText=`
27
+ `;let i=()=>{n.remove(),document.removeEventListener("keydown",p);},p=d=>{if(d.key==="Escape")i();else if(d.key==="ArrowLeft"&&a.length>1){let g=r>0?r-1:a.length-1;i(),o(g);}else if(d.key==="ArrowRight"&&a.length>1){let g=r<a.length-1?r+1:0;i(),o(g);}};if(n.onclick=i,document.addEventListener("keydown",p),a.length>1){let d=document.createElement("div");d.className="attachment-lightbox-dots",d.style.cssText=`
28
28
  position: absolute !important;
29
29
  bottom: 48px !important;
30
30
  left: 50% !important;
@@ -34,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
- `,l.onclick=x=>x.stopPropagation(),a.forEach((x,C)=>{let h=document.createElement("button");h.className=`attachment-lightbox-dot ${C===r?"active":""}`,h.style.cssText=`
37
+ `,d.onclick=w=>w.stopPropagation(),a.forEach((w,k)=>{let h=document.createElement("button");h.className=`attachment-lightbox-dot ${k===r?"active":""}`,h.style.cssText=`
38
38
  width: 8px !important;
39
39
  height: 8px !important;
40
40
  border-radius: 50% !important;
41
- background: ${C===r?"white":"rgba(255, 255, 255, 0.3)"} !important;
41
+ background: ${k===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
- `,h.onclick=b=>{b.stopPropagation(),i(),o(C);},l.appendChild(h);});let f=document.createElement("button");f.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",f.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>',f.style.cssText=`
45
+ `,h.onclick=b=>{b.stopPropagation(),i(),o(k);},d.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
- `,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=x=>{x.stopPropagation();let C=r>0?r-1:a.length-1;i(),o(C);};let y=document.createElement("button");y.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",y.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>',y.style.cssText=`
58
+ `,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=w=>{w.stopPropagation();let k=r>0?r-1:a.length-1;i(),o(k);};let y=document.createElement("button");y.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",y.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>',y.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
- `,y.onmouseenter=()=>{y.style.opacity="1";},y.onmouseleave=()=>{y.style.opacity="0.5";},y.onclick=x=>{x.stopPropagation();let C=r<a.length-1?r+1:0;i(),o(C);},n.appendChild(l),n.appendChild(f),n.appendChild(y);}n.appendChild(m),n.appendChild(u),document.body.appendChild(n),setTimeout(()=>{u.style.transition="opacity 0.5s ease",u.style.opacity="0";},2e3);}function Cf(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 Tf(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 li(e){return e.startsWith("image/")}function kr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,m]=react.useState(false),[u,i]=react.useState(false),[p,l]=react.useState(null),f=react.useRef(null),y=react.useRef(e);y.current=e;let x=react.useCallback((v,I)=>{I.preventDefault(),I.stopPropagation();let F=y.current.filter($=>li($.type)),N=F.findIndex($=>$.id===v.id),U=$=>{let j=y.current.filter(re=>li(re.type)),ne=j[$];ne&&uc(ne.url,ne.name,j,$,U);};uc(v.url,v.name,F,N,U);},[]),C=react.useCallback(v=>{let I=[],F=[];return e.length+v.length>s?(F.push(`Maximum ${s} files allowed`),{valid:I,errors:F}):(v.forEach(N=>{if(N.size/1048576>r){F.push(`${N.name} is too large (max ${r}MB)`);return}if(o&&!o.some($=>N.type.match($))){F.push(`${N.name} has invalid file type`);return}I.push(N);}),{valid:I,errors:F})},[e.length,s,r,o]),h=react.useCallback(async v=>{let{valid:I,errors:F}=C(v);if(F.length>0){l(F.join(", ")),setTimeout(()=>l(null),5e3);return}if(I.length!==0){i(true),l(null);try{await t?.(I);}catch(N){l(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[C,t]),b=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),m(true);},[]),g=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),m(false);},[]),k=react.useCallback(v=>{v.preventDefault(),v.stopPropagation();},[]),c=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),m(false);let I=Array.from(v.dataTransfer.files);h(I);},[h]),T=react.useCallback(v=>{let I=v.target.files?Array.from(v.target.files):[];h(I),f.current&&(f.current.value="");},[h]),w=react.useCallback(()=>{f.current?.click();},[]),R=react.useCallback(v=>{confirm("Are you sure you want to delete this attachment?")&&a?.(v);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${u?"uploading":""}`,onDragEnter:b,onDragLeave:g,onDragOver:k,onDrop:c,onClick:w,children:[jsxRuntime.jsx("input",{ref:f,type:"file",multiple:true,onChange:T,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:u?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),p&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(v=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:li(v.type)&&v.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:I=>x(v,I),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:v.thumbnailUrl||v.url,alt:v.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:Tf(v.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:v.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:v.name,children:v.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Cf(v.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(v.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>R(v.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"})})})]},v.id))})]})}function di({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:m=[],aiInsights:u=[],attachments:i=[],onAddComment:p,onDeleteComment:l,onUploadAttachments:f,onDeleteAttachment:y,onSuggestAssignee:x,onGenerateSubtasks:C,onEstimateEffort:h,currentUserId:b="user-1"}){let[g,k]=react.useState("details"),[c,T]=react.useState(false),[w,R]=react.useState({}),[v,I]=react.useState(""),[F,N]=react.useState(false),[U,$]=react.useState({});if(!t||!e)return null;let j=react.useCallback(()=>{T(false),R({}),k("details"),I(""),$({}),a();},[a]),ne=react.useCallback(()=>{r&&Object.keys(w).length>0&&(r(e.id,w),R({}),T(false));},[e.id,w,r]),re=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),j());},[e.id,o,j]),se=react.useCallback(()=>{p&&v.trim()&&(p(e.id,v.trim()),I(""));},[e.id,v,p]),ye=react.useCallback(async()=>{if(x){N(true);try{let L=await x(e);$(_=>({..._,assignees:L}));}catch(L){console.error("Failed to suggest assignee:",L);}finally{N(false);}}},[e,x]),be=react.useCallback(async()=>{if(C){N(true);try{let L=await C(e);$(_=>({..._,subtasks:L}));}catch(L){console.error("Failed to generate subtasks:",L);}finally{N(false);}}},[e,C]),Be=react.useCallback(async()=>{if(h){N(true);try{let L=await h(e);$(_=>({..._,effort:L}));}catch(L){console.error("Failed to estimate effort:",L);}finally{N(false);}}},[e,h]),A={...e,...w},O=s.filter(L=>A.assignedUserIds?.includes(L.id));return jsxRuntime.jsx(ht,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:j,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:L=>L.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:A.priority==="URGENT"?"#EF4444":A.priority==="HIGH"?"#F59E0B":A.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),c?jsxRuntime.jsx("input",{type:"text",value:w.title??A.title,onChange:L=>R({...w,title:L.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:A.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:ne,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{T(false),R({});},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:re,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:j,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>k("details"),className:`card-detail-tab ${g==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>k("comments"),className:`card-detail-tab ${g==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>k("activity"),className:`card-detail-tab ${g==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",m.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:m.length})]}),jsxRuntime.jsxs("button",{onClick:()=>k("attachments"),className:`card-detail-tab ${g==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>k("ai"),className:`card-detail-tab ${g==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[g==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),c?jsxRuntime.jsx("textarea",{value:w.description??A.description??"",onChange:L=>R({...w,description:L.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:A.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),c?jsxRuntime.jsx("select",{multiple:true,value:w.assignedUserIds??A.assignedUserIds??[],onChange:L=>{let _=Array.from(L.target.selectedOptions,J=>J.value);R({...w,assignedUserIds:_});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(L=>jsxRuntime.jsx("option",{value:L.id,children:L.name},L.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:O.length>0?O.map(L=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:L.color},children:L.initials}),jsxRuntime.jsx("span",{children:L.name})]},L.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),c?jsxRuntime.jsxs("select",{value:w.priority??A.priority??"",onChange:L=>R({...w,priority:L.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:A.priority==="URGENT"?"#EF4444":A.priority==="HIGH"?"#F59E0B":A.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:A.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:A.labels&&A.labels.length>0?A.labels.map(L=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:L},L)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),c?jsxRuntime.jsx("input",{type:"date",value:w.startDate?new Date(w.startDate).toISOString().split("T")[0]:A.startDate?new Date(A.startDate).toISOString().split("T")[0]:"",onChange:L=>R({...w,startDate:L.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:A.startDate?new Date(A.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),c?jsxRuntime.jsx("input",{type:"date",value:w.endDate?new Date(w.endDate).toISOString().split("T")[0]:A.endDate?new Date(A.endDate).toISOString().split("T")[0]:"",onChange:L=>R({...w,endDate:L.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:A.endDate?new Date(A.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),c?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:w.estimatedTime??A.estimatedTime??"",onChange:L=>R({...w,estimatedTime:L.target.value?parseFloat(L.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:A.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:A.dependencies&&A.dependencies.length>0?A.dependencies.map(L=>{let _=typeof L=="string"?L:L.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",_.slice(-4)]},_)}):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"})]})]}),g==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:v,onChange:L=>I(L.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:se,disabled:!v.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(L=>{let _=s.find(J=>J.id===L.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[_&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:_.color},children:_.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:_?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(L.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(L.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:L.content})]},L.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),g==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:m.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:m.map(L=>{let _=s.find(J=>J.id===L.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[L.type.includes("CREATED")&&"\u2795",L.type.includes("UPDATED")&&"\u270F\uFE0F",L.type.includes("MOVED")&&"\u27A1\uFE0F",L.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",L.type.includes("COMMENT")&&"\u{1F4AC}",L.type.includes("ASSIGNED")&&"\u{1F464}",L.type.includes("PRIORITY")&&"\u{1F3AF}",L.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",L.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:_?.name||"Unknown"})," ",L.type.replace(/_/g," ").toLowerCase(),L.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:L.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(L.timestamp).toLocaleString()})]})]},L.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),g==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(kr,{cardId:e.id,attachments:i,onUpload:f?L=>f(e.id,L):void 0,onDelete:y,currentUserId:b,maxSizeMB:10,maxFiles:20})}),g==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:ye,disabled:F||!x,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:be,disabled:F||!C,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:Be,disabled:F||!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"]})]}),U.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),U.assignees.map((L,_)=>{let J=s.find(ce=>ce.id===L.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[J&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:J.color},children:J.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:J?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:L.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(L.confidence*100).toFixed(0),"%"]})]})]},_)})]}),U.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),U.subtasks.map((L,_)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:L.title}),L.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:L.description}),L.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",L.estimatedTime,"h"]})]},_))]}),U.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[U.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(U.effort.confidence*100).toFixed(0),"%"]})]})]}),u.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),u.map(L=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${L.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:L.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:L.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:L.description}),L.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",L.suggestedAction]})]},L.id))]}),!U.assignees&&!U.subtasks&&!U.effort&&u.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 Zo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[m,u]=react.useState({top:0,left:0}),i=react.useRef(null),p=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),f=window.innerHeight,y=window.innerWidth,x=4,C=l.left;C+o>y-10&&(C=y-o-10),C<10&&(C=10);let h=f-l.bottom,b=l.top,g;return h>=s+x?g=l.bottom+x:b>=s+x?g=l.top-s-x:h>=b?g=l.bottom+x:g=Math.max(10,l.top-s-x),{top:g,left:C}},[e,o,s]);return react.useEffect(()=>{t&&u(p());},[t,p]),react.useEffect(()=>{if(!t)return;let l=y=>{let x=y.target;i.current&&!i.current.contains(x)&&e.current&&!e.current.contains(x)&&a();},f=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(f),document.removeEventListener("mousedown",l);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let l=f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsxRuntime.jsx(ht,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${m.top}px`,left:`${m.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var rt={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#9CA3AF",dependencyHover:"#6B7280",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#4B5563",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#57534E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var Ff=["LOW","MEDIUM","HIGH","URGENT"],Lf=["todo","in-progress","review","done"];function pi({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:m=[],onAddComment:u,onDeleteComment:i,currentUser:p,onAIGenerateDescription:l,onAICreateSubtasks:f,onAIFindSimilar:y,availableColumns:x=[],availableLabels:C=[],availableTags:h=[],onCreateTag:b,onUploadCoverImage:g,unsplashAccessKey:k,theme:c,onSubtasksChange:T,attachments:w=[],onUploadAttachments:R,onDeleteAttachment:v}){let I=wo(),F=c||I?.themeName||"dark",[N,U]=react.useState(e),[$,j]=react.useState(false),[ne,re]=react.useState(e?.subtasks||[]),[se,ye]=react.useState(false),[be,Be]=react.useState(""),[A,O]=react.useState(""),[L,_]=react.useState("all"),[J,ce]=react.useState(false),[fe,me]=react.useState(false),[Le,te]=react.useState(false),[Je,ke]=react.useState(false),[Qe,ct]=react.useState(false),[ft,et]=react.useState(false),wt=react.useRef(null),Mt=react.useRef(null),Dt=react.useRef(null),Ye=react.useRef(null),B=react.useRef(null),ie=react.useRef(null),Se=react.useRef(null),He=react.useRef(null),Ze=react.useRef(null),bt=react.useRef(null),q=react.useRef(null),Q=react.useRef(null);react.useEffect(()=>{e&&!N?(U({...e}),re(e.subtasks||[])):e&&N&&e.id!==N.id&&(U({...e}),re(e.subtasks||[]));},[e,N]),react.useEffect(()=>{let z=de=>{let Ge=de.target;Ye.current&&!Ye.current.contains(Ge)&&ce(false),B.current&&!B.current.contains(Ge)&&me(false),ie.current&&!ie.current.contains(Ge)&&te(false),Se.current&&!Se.current.contains(Ge)&&ke(false);};if(J||fe||Le||Je)return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[J,fe,Le,Je]),react.useEffect(()=>{if(!t)return;let z=de=>{let Ge=de.target,St=Ge.tagName==="INPUT"||Ge.tagName==="TEXTAREA"||Ge.isContentEditable;if(de.key==="Escape"){de.preventDefault(),J||fe||Le||Je||Qe||ft?(ce(false),me(false),te(false),ke(false),ct(false),et(false)):St||a();return}if(St&&de.key!=="Escape")return;let mt=de.metaKey||de.ctrlKey;switch(de.key.toLowerCase()){case "s":de.preventDefault(),ce(true);break;case "a":de.preventDefault(),te(true);break;case "p":de.preventDefault(),me(true);break;case "l":de.preventDefault(),ke(true);break;case "d":mt||(de.preventDefault(),ct(true),setTimeout(()=>He.current?.focus(),0));break;case "e":mt||(de.preventDefault(),et(true));break;case "i":de.preventDefault(),j(true),setTimeout(()=>Mt.current?.focus(),0);break;case "t":de.preventDefault(),ye(true);break;case "c":de.preventDefault(),Dt.current?.focus();break}};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[t,a,J,fe,Le,Je,Qe,ft]);let je=react.useCallback(z=>{let de=z.currentTarget.textContent?.trim()||"";if(N&&de!==N.title){let Ge={...N,title:de};U(Ge),r?.(N.id,{title:de});}},[N,r]),Re=react.useCallback(z=>{z.key==="Enter"&&(z.preventDefault(),z.currentTarget.blur()),z.key==="Escape"&&(z.preventDefault(),z.currentTarget.textContent=N?.title||"",z.currentTarget.blur());},[N]),tt=react.useCallback(()=>{N&&e&&N.description!==e.description&&r?.(N.id,{description:N.description}),j(false);},[N,e,r]),lt=react.useCallback(z=>{if(N){let de={...N,columnId:z};U(de),r?.(N.id,{columnId:z}),ce(false);}},[N,r]),Ue=react.useCallback(z=>{if(N){let de={...N,priority:z};U(de),r?.(N.id,{priority:z}),me(false);}},[N,r]),qe=react.useCallback(z=>{if(N){let de=N.assignedUserIds||[],Ge=de.includes(z)?de.filter(mt=>mt!==z):[...de,z],St={...N,assignedUserIds:Ge};U(St),r?.(N.id,{assignedUserIds:Ge});}},[N,r]),ae=react.useCallback(z=>{if(N){let de=N.labels||[],Ge=de.includes(z)?de.filter(mt=>mt!==z):[...de,z],St={...N,labels:Ge};U(St),r?.(N.id,{labels:Ge});}},[N,r]),S=react.useCallback(z=>{if(N){let de={...N,tags:z};U(de),r?.(N.id,{tags:z});}},[N,r]),we=react.useCallback(z=>{if(N){let de=z.target.value,Ge={...N,endDate:de};U(Ge),r?.(N.id,{endDate:de}),ct(false);}},[N,r]),X=react.useCallback(z=>{if(N){let de={...N,estimatedTime:parseFloat(z)||0};U(de),r?.(N.id,{estimatedTime:parseFloat(z)||0});}},[N,r]),Te=react.useCallback(()=>{if(be.trim()&&N){let z={id:`subtask-${Date.now()}`,title:be.trim(),completed:false,createdAt:new Date},de=[...ne,z];re(de),Be(""),ye(false),T?.(N.id,de);}},[be,ne,N,T]),Ce=react.useCallback(z=>{let de=ne.map(Ge=>Ge.id===z?{...Ge,completed:!Ge.completed,updatedAt:new Date}:Ge);re(de),N&&T?.(N.id,de);},[ne,N,T]),We=react.useCallback(z=>{let de=ne.filter(Ge=>Ge.id!==z);re(de),N&&T?.(N.id,de);},[ne,N,T]),Oe=react.useCallback(()=>{A.trim()&&N&&u&&(u(N.id,A.trim()),O(""));},[A,N,u]),at=react.useCallback(z=>{(z.metaKey||z.ctrlKey)&&z.key==="Enter"&&(z.preventDefault(),Oe());},[Oe]),G=z=>jsxRuntime.jsx(Pf__default.default,{remarkPlugins:[Mf__default.default],rehypePlugins:[Af__default.default],components:{a:({node:de,...Ge})=>jsxRuntime.jsx("a",{...Ge,target:"_blank",rel:"noopener noreferrer"})},children:z}),K=m.filter(z=>L==="comments"?z.type.includes("COMMENT"):L==="history"?!z.type.includes("COMMENT"):true);if(!t||!e)return null;let he=N||e,Ke=s.filter(z=>he.assignedUserIds?.includes(z.id)),Ie=ne.filter(z=>z.completed).length;return jsxRuntime.jsx(ht,{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:z=>z.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":F,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:wt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:je,onKeyDown:Re,children:he.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:Ye,children:[jsxRuntime.jsxs("button",{ref:Ze,className:"modal-v2-field",onClick:()=>ce(!J),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:he.columnId||"No status"})]}),jsxRuntime.jsx(Zo,{triggerRef:Ze,isOpen:J,onClose:()=>ce(false),width:250,estimatedHeight:200,children:(x.length>0?x:Lf.map(z=>({id:z,title:z}))).map(z=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${he.columnId===z.id?"active":""}`,onClick:()=>lt(z.id),children:z.title},z.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ie,children:[jsxRuntime.jsxs("button",{ref:bt,className:"modal-v2-field",onClick:()=>te(!Le),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Ke.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Ke.map(z=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:z.color},title:z.name,children:z.initials},z.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Zo,{triggerRef:bt,isOpen:Le,onClose:()=>te(false),width:280,estimatedHeight:300,children:s.map(z=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${he.assignedUserIds?.includes(z.id)?"active":""}`,onClick:()=>qe(z.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:z.color},children:z.initials}),z.name,he.assignedUserIds?.includes(z.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"})})]},z.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:B,children:[jsxRuntime.jsxs("button",{ref:q,className:"modal-v2-field",onClick:()=>me(!fe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:he.priority||"None"})]}),jsxRuntime.jsxs(Zo,{triggerRef:q,isOpen:fe,onClose:()=>me(false),width:180,estimatedHeight:220,children:[Ff.map(z=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${z.toLowerCase()} ${he.priority===z?"active":""}`,onClick:()=>Ue(z),children:z},z)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ue(""),children:"None"})]})]}),h.length>0||b?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(hr,{selectedTags:he.tags||[],availableTags:h,onChange:S,onCreateTag:b,theme:rt[F]||rt.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Se,children:[jsxRuntime.jsxs("button",{ref:Q,className:"modal-v2-field",onClick:()=>ke(!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:he.labels&&he.labels.length>0?jsxRuntime.jsx("span",{children:he.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Zo,{triggerRef:Q,isOpen:Je,onClose:()=>ke(false),width:220,estimatedHeight:200,children:(C.length>0?C:["Bug","Feature","Enhancement","Documentation"]).map(z=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${he.labels?.includes(z)?"active":""}`,onClick:()=>ae(z),children:[z,he.labels?.includes(z)&&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"})})]},z))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{ct(!Qe),setTimeout(()=>He.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:he.endDate?new Date(he.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:He,type:"date",value:typeof he.endDate=="string"?he.endDate.split("T")[0]:he.endDate?(()=>{let z=new Date(he.endDate),de=z.getUTCFullYear(),Ge=String(z.getUTCMonth()+1).padStart(2,"0"),St=String(z.getUTCDate()).padStart(2,"0");return `${de}-${Ge}-${St}`})():"",onChange:we,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>et(!ft),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:he.estimatedTime?`${he.estimatedTime}h`:"Not set"})]}),ft&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:he.estimatedTime||"",onChange:z=>X(z.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>et(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),$?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:he.description||"",onChange:z=>{if(N){let de={...N,description:z.target.value};U(de);}},onBlur:tt,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>j(true),children:he.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:G(he.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"}),ne.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Ie,"/",ne.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>ye(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:[ne.map(z=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${z.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Ce(z.id),children:z.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:z.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>We(z.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"})]})})]},z.id)),se&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:be,onChange:z=>Be(z.target.value),onKeyDown:z=>{z.key==="Enter"&&Te(),z.key==="Escape"&&(ye(false),Be(""));},onBlur:Te,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(R||w.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),w.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:w.length})]}),jsxRuntime.jsx(kr,{cardId:he.id,attachments:w,onUpload:R?z=>R(he.id,z):void 0,onDelete:v,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${L==="all"?"active":""}`,onClick:()=>_("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${L==="comments"?"active":""}`,onClick:()=>_("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${L==="history"?"active":""}`,onClick:()=>_("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Dt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:A,onChange:z=>O(z.target.value),onKeyDown:at,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:Oe,disabled:!A.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[K.map(z=>{let de=s.find(St=>St.id===z.userId);if(z.type.includes("COMMENT")){let St=n.find(mt=>mt.id===z.metadata?.commentId);return St?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[de&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:de.color},children:de.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:de?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(z.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:St.content})]})]},z.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[z.type.includes("CREATED")&&"\u2795",z.type.includes("UPDATED")&&"\u270F\uFE0F",z.type.includes("MOVED")&&"\u27A1\uFE0F",z.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",z.type.includes("ASSIGNED")&&"\u{1F464}",z.type.includes("PRIORITY")&&"\u{1F3AF}",z.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:de?.name||"Unknown"})," ",z.type.replace(/_/g," ").toLowerCase(),z.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:z.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(z.timestamp).toLocaleString()})]})]},z.id)}),K.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 Wf({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 gi({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((m,u)=>m+u.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(Wf,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,m)=>n+m.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,m)=>n+m.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,m)=>n+(m.planned||0),0)})]})]})]})}function Jf({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 fi({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,m=e[e.length-1]?.ideal||0,u=s>0?(s-n)/s*100:0,i=n<=m;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Jf,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:u>=50?"#10B981":"#F59E0B"},children:[u.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var s0={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},wc=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function i0({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,m=e+n*Math.cos(-a*(Math.PI/180)),u=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:m,y:u,fill:"white",textAnchor:m>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Cc({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 bi({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((u,i)=>u+i.value,0),n=e.map(u=>({...u,totalValue:s,color:u.color||s0[u.name]||wc[e.indexOf(u)%wc.length]})),m=n.map(u=>u.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?i0:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((u,i)=>jsxRuntime.jsx(recharts.Cell,{fill:m[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Cc,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(u,i)=>{let p=i.payload,l=s>0?(p.value/s*100).toFixed(0):"0";return `${u} (${p.value} - ${l}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Cc,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((u,i)=>jsxRuntime.jsx(recharts.Cell,{fill:m[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((u,i)=>i.value>u.value?i:u).name})]})]})]})}var On=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,m]=react.useState(false),[u,i]=react.useState(false),[p,l]=react.useState(false),[f,y]=react.useState(false);if(e.length===0)return null;let x=e.map(c=>c.id),C=c=>{r.onBulkUpdate?.(x,{priority:c}),m(false);},h=c=>{r.onBulkMove?.(x,c),i(false),a();},b=c=>{r.onBulkUpdate?.(x,{assignedUserIds:c}),l(false);},g=c=>{let T=new Set;e.forEach(R=>{R.labels?.forEach(v=>T.add(v));});let w=Array.from(new Set([...T,...c]));r.onBulkUpdate?.(x,{labels:w}),y(false);},k=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(x),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(c=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>C(c),children:[jsxRuntime.jsx("span",{className:d("asakaa-priority-dot",c==="LOW"&&"bg-asakaa-priority-low",c==="MEDIUM"&&"bg-asakaa-priority-medium",c==="HIGH"&&"bg-asakaa-priority-high",c==="URGENT"&&"bg-asakaa-priority-urgent")}),c]},c))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!u),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(c=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(c.id),children:c.title},c.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(c=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([c.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:c.color},children:c.initials}),c.name]},c.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>y(!f),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),f&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(c=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g([c]),children:c},c))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:k,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});On.displayName="BulkOperationsToolbar";function p0(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,m,u,i;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(y=>{let x=a?.find(C=>C.id===y);n=`assignee-${y}`,m=x?.name||`User ${y}`,u=x?.color,i=x?.avatar,r.has(n)||r.set(n,{id:n,title:m,groupValue:y,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",m="Unassigned",u="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:m,groupValue:null,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let f={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];m=f.title,u=f.color,r.has(n)||r.set(n,{id:n,title:m,groupValue:s,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(y=>{n=`label-${y}`,m=y,u="#6b7280",r.has(n)||r.set(n,{id:n,title:m,groupValue:y,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);}):(n="label-none",m="No Labels",u="#6b7280",r.has(n)||r.set(n,{id:n,title:m,groupValue:null,cardIds:[],color:u}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function hi({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),m=react.useMemo(()=>p0(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),u=react.useCallback(i=>{n(p=>{let l=new Set(p);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||m.length===0?jsxRuntime.jsx(Hr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:d("asakaa-swimlane-view",o),children:[m.map(i=>{let p=s.has(i.id),l=e.cards.filter(y=>i.cardIds.includes(y.id)),f={...e,cards:l};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&u(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Hr,{board:f,callbacks:r,availableUsers:a})})]},i.id)}),m.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var yi=[{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 vi({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),m=yi.find(i=>i.value===e)||yi[0];react.useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let u=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:d("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:m.icon}),jsxRuntime.jsx("span",{children:m.label}),jsxRuntime.jsx("svg",{className:d("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:yi.map(i=>jsxRuntime.jsxs("button",{onClick:()=>u(i.value),className:d("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Qo=[{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 f0(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,m=o.alt?e.altKey:!e.altKey,u=o.meta?e.metaKey:true;return s&&n&&m&&u}function Ec(e={}){let{shortcuts:t=Qo,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(u=>{o.current=[...o.current,u];},[]),m=react.useCallback(u=>{o.current=o.current.filter(i=>i.action!==u);},[]);return react.useEffect(()=>{function u(i){if(!s.current)return;let p=i.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let l of o.current)if(f0(i,l)){r&&i.preventDefault();let f=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(f);break}}}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[r]),{registerShortcut:n,unregisterShortcut:m,isEnabled:a}}function h0(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function y0(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 v0(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=y0(e),r=t?h0(t):"";return a?`${a} + ${r}`:r}function x0(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 xi({shortcuts:e=Qo,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function m(u){u.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,a]),!o||!t)return null;let n=x0(e);return jsxRuntime.jsxs("div",{className:d("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([m,u])=>u.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),m]}),jsxRuntime.jsx("div",{className:"space-y-3",children:u.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:v0(i)})]},i.action))})]},m))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var ki=[{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
+ `,y.onmouseenter=()=>{y.style.opacity="1";},y.onmouseleave=()=>{y.style.opacity="0.5";},y.onclick=w=>{w.stopPropagation();let k=r<a.length-1?r+1:0;i(),o(k);},n.appendChild(d),n.appendChild(g),n.appendChild(y);}n.appendChild(m),n.appendChild(u),document.body.appendChild(n),setTimeout(()=>{u.style.transition="opacity 0.5s ease",u.style.opacity="0";},2e3);}function Ff(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 Lf(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 ci(e){return e.startsWith("image/")}function kr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,m]=react.useState(false),[u,i]=react.useState(false),[p,d]=react.useState(null),g=react.useRef(null),y=react.useRef(e);y.current=e;let w=react.useCallback((v,I)=>{I.preventDefault(),I.stopPropagation();let B=y.current.filter(H=>ci(H.type)),N=B.findIndex(H=>H.id===v.id),G=H=>{let Y=y.current.filter(re=>ci(re.type)),le=Y[H];le&&hc(le.url,le.name,Y,H,G);};hc(v.url,v.name,B,N,G);},[]),k=react.useCallback(v=>{let I=[],B=[];return e.length+v.length>s?(B.push(`Maximum ${s} files allowed`),{valid:I,errors:B}):(v.forEach(N=>{if(N.size/1048576>r){B.push(`${N.name} is too large (max ${r}MB)`);return}if(o&&!o.some(H=>N.type.match(H))){B.push(`${N.name} has invalid file type`);return}I.push(N);}),{valid:I,errors:B})},[e.length,s,r,o]),h=react.useCallback(async v=>{let{valid:I,errors:B}=k(v);if(B.length>0){d(B.join(", ")),setTimeout(()=>d(null),5e3);return}if(I.length!==0){i(true),d(null);try{await t?.(I);}catch(N){d(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[k,t]),b=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),m(true);},[]),x=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),m(false);},[]),f=react.useCallback(v=>{v.preventDefault(),v.stopPropagation();},[]),c=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),m(false);let I=Array.from(v.dataTransfer.files);h(I);},[h]),C=react.useCallback(v=>{let I=v.target.files?Array.from(v.target.files):[];h(I),g.current&&(g.current.value="");},[h]),D=react.useCallback(()=>{g.current?.click();},[]),T=react.useCallback(v=>{confirm("Are you sure you want to delete this attachment?")&&a?.(v);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${u?"uploading":""}`,onDragEnter:b,onDragLeave:x,onDragOver:f,onDrop:c,onClick:D,children:[jsxRuntime.jsx("input",{ref:g,type:"file",multiple:true,onChange:C,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:u?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),p&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(v=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:ci(v.type)&&v.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:I=>w(v,I),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:v.thumbnailUrl||v.url,alt:v.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:Lf(v.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:v.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:v.name,children:v.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Ff(v.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(v.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>T(v.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"})})})]},v.id))})]})}function mi({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:m=[],aiInsights:u=[],attachments:i=[],onAddComment:p,onDeleteComment:d,onUploadAttachments:g,onDeleteAttachment:y,onSuggestAssignee:w,onGenerateSubtasks:k,onEstimateEffort:h,currentUserId:b="user-1"}){let[x,f]=react.useState("details"),[c,C]=react.useState(false),[D,T]=react.useState({}),[v,I]=react.useState(""),[B,N]=react.useState(false),[G,H]=react.useState({});if(!t||!e)return null;let Y=react.useCallback(()=>{C(false),T({}),f("details"),I(""),H({}),a();},[a]),le=react.useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),T({}),C(false));},[e.id,D,r]),re=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),Y());},[e.id,o,Y]),oe=react.useCallback(()=>{p&&v.trim()&&(p(e.id,v.trim()),I(""));},[e.id,v,p]),be=react.useCallback(async()=>{if(w){N(true);try{let S=await w(e);H(R=>({...R,assignees:S}));}catch(S){console.error("Failed to suggest assignee:",S);}finally{N(false);}}},[e,w]),ve=react.useCallback(async()=>{if(k){N(true);try{let S=await k(e);H(R=>({...R,subtasks:S}));}catch(S){console.error("Failed to generate subtasks:",S);}finally{N(false);}}},[e,k]),Be=react.useCallback(async()=>{if(h){N(true);try{let S=await h(e);H(R=>({...R,effort:S}));}catch(S){console.error("Failed to estimate effort:",S);}finally{N(false);}}},[e,h]),L={...e,...D},$=s.filter(S=>L.assignedUserIds?.includes(S.id));return jsxRuntime.jsx(bt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:Y,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),c?jsxRuntime.jsx("input",{type:"text",value:D.title??L.title,onChange:S=>T({...D,title:S.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:L.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:le,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{C(false),T({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>C(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:re,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:Y,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>f("details"),className:`card-detail-tab ${x==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>f("comments"),className:`card-detail-tab ${x==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("activity"),className:`card-detail-tab ${x==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",m.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:m.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("attachments"),className:`card-detail-tab ${x==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("ai"),className:`card-detail-tab ${x==="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:[x==="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"}),c?jsxRuntime.jsx("textarea",{value:D.description??L.description??"",onChange:S=>T({...D,description:S.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:L.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),c?jsxRuntime.jsx("select",{multiple:true,value:D.assignedUserIds??L.assignedUserIds??[],onChange:S=>{let R=Array.from(S.target.selectedOptions,K=>K.value);T({...D,assignedUserIds:R});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:$.length>0?$.map(S=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:S.color},children:S.initials}),jsxRuntime.jsx("span",{children:S.name})]},S.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),c?jsxRuntime.jsxs("select",{value:D.priority??L.priority??"",onChange:S=>T({...D,priority:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:L.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:L.labels&&L.labels.length>0?L.labels.map(S=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:S},S)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),c?jsxRuntime.jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:L.startDate?new Date(L.startDate).toISOString().split("T")[0]:"",onChange:S=>T({...D,startDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:L.startDate?new Date(L.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),c?jsxRuntime.jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:L.endDate?new Date(L.endDate).toISOString().split("T")[0]:"",onChange:S=>T({...D,endDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:L.endDate?new Date(L.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),c?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??L.estimatedTime??"",onChange:S=>T({...D,estimatedTime:S.target.value?parseFloat(S.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:L.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:L.dependencies&&L.dependencies.length>0?L.dependencies.map(S=>{let R=typeof S=="string"?S:S.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",R.slice(-4)]},R)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:L.createdAt?new Date(L.createdAt).toLocaleString():"Unknown"})]})]}),x==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:v,onChange:S=>I(S.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:oe,disabled:!v.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(S=>{let R=s.find(K=>K.id===S.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[R&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:R.color},children:R.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:R?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(S.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(S.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:S.content})]},S.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),x==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:m.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:m.map(S=>{let R=s.find(K=>K.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[S.type.includes("CREATED")&&"\u2795",S.type.includes("UPDATED")&&"\u270F\uFE0F",S.type.includes("MOVED")&&"\u27A1\uFE0F",S.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",S.type.includes("COMMENT")&&"\u{1F4AC}",S.type.includes("ASSIGNED")&&"\u{1F464}",S.type.includes("PRIORITY")&&"\u{1F3AF}",S.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",S.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:R?.name||"Unknown"})," ",S.type.replace(/_/g," ").toLowerCase(),S.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:S.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(S.timestamp).toLocaleString()})]})]},S.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),x==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(kr,{cardId:e.id,attachments:i,onUpload:g?S=>g(e.id,S):void 0,onDelete:y,currentUserId:b,maxSizeMB:10,maxFiles:20})}),x==="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:be,disabled:B||!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("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:B||!k,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:Be,disabled:B||!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"]})]}),G.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),G.assignees.map((S,R)=>{let K=s.find(se=>se.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[K&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:K.color},children:K.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:K?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:S.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(S.confidence*100).toFixed(0),"%"]})]})]},R)})]}),G.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),G.subtasks.map((S,R)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:S.title}),S.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:S.description}),S.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",S.estimatedTime,"h"]})]},R))]}),G.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[G.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(G.effort.confidence*100).toFixed(0),"%"]})]})]}),u.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),u.map(S=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${S.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:S.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:S.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:S.description}),S.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",S.suggestedAction]})]},S.id))]}),!G.assignees&&!G.subtasks&&!G.effort&&u.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 en({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[m,u]=react.useState({top:0,left:0}),i=react.useRef(null),p=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),g=window.innerHeight,y=window.innerWidth,w=4,k=d.left;k+o>y-10&&(k=y-o-10),k<10&&(k=10);let h=g-d.bottom,b=d.top,x;return h>=s+w?x=d.bottom+w:b>=s+w?x=d.top-s-w:h>=b?x=d.bottom+w:x=Math.max(10,d.top-s-w),{top:x,left:k}},[e,o,s]);return react.useEffect(()=>{t&&u(p());},[t,p]),react.useEffect(()=>{if(!t)return;let d=y=>{let w=y.target;i.current&&!i.current.contains(w)&&e.current&&!e.current.contains(w)&&a();},g=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(g),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(bt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${m.top}px`,left:`${m.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var tt={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#9CA3AF",dependencyHover:"#6B7280",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#4B5563",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#57534E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var Hf=["LOW","MEDIUM","HIGH","URGENT"],Wf=["todo","in-progress","review","done"];function gi({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:m=[],onAddComment:u,onDeleteComment:i,currentUser:p,onAIGenerateDescription:d,onAICreateSubtasks:g,onAIFindSimilar:y,availableColumns:w=[],availableLabels:k=[],availableTags:h=[],onCreateTag:b,onUploadCoverImage:x,unsplashAccessKey:f,theme:c,onSubtasksChange:C,attachments:D=[],onUploadAttachments:T,onDeleteAttachment:v}){let I=Co(),B=c||I?.themeName||"dark",[N,G]=react.useState(e),[H,Y]=react.useState(false),[le,re]=react.useState(e?.subtasks||[]),[oe,be]=react.useState(false),[ve,Be]=react.useState(""),[L,$]=react.useState(""),[S,R]=react.useState("all"),[K,se]=react.useState(false),[pe,me]=react.useState(false),[Le,Z]=react.useState(false),[Ze,Ne]=react.useState(false),[Xe,pt]=react.useState(false),[wt,Qe]=react.useState(false),gt=react.useRef(null),Nt=react.useRef(null),Pt=react.useRef(null),it=react.useRef(null),O=react.useRef(null),ce=react.useRef(null),we=react.useRef(null),$e=react.useRef(null),Ke=react.useRef(null),ft=react.useRef(null),X=react.useRef(null),te=react.useRef(null);react.useEffect(()=>{e&&!N?(G({...e}),re(e.subtasks||[])):e&&N&&e.id!==N.id&&(G({...e}),re(e.subtasks||[]));},[e,N]),react.useEffect(()=>{let U=ae=>{let Ue=ae.target;it.current&&!it.current.contains(Ue)&&se(false),O.current&&!O.current.contains(Ue)&&me(false),ce.current&&!ce.current.contains(Ue)&&Z(false),we.current&&!we.current.contains(Ue)&&Ne(false);};if(K||pe||Le||Ze)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[K,pe,Le,Ze]),react.useEffect(()=>{if(!t)return;let U=ae=>{let Ue=ae.target,Dt=Ue.tagName==="INPUT"||Ue.tagName==="TEXTAREA"||Ue.isContentEditable;if(ae.key==="Escape"){ae.preventDefault(),K||pe||Le||Ze||Xe||wt?(se(false),me(false),Z(false),Ne(false),pt(false),Qe(false)):Dt||a();return}if(Dt&&ae.key!=="Escape")return;let dt=ae.metaKey||ae.ctrlKey;switch(ae.key.toLowerCase()){case "s":ae.preventDefault(),se(true);break;case "a":ae.preventDefault(),Z(true);break;case "p":ae.preventDefault(),me(true);break;case "l":ae.preventDefault(),Ne(true);break;case "d":dt||(ae.preventDefault(),pt(true),setTimeout(()=>$e.current?.focus(),0));break;case "e":dt||(ae.preventDefault(),Qe(true));break;case "i":ae.preventDefault(),Y(true),setTimeout(()=>Nt.current?.focus(),0);break;case "t":ae.preventDefault(),be(true);break;case "c":ae.preventDefault(),Pt.current?.focus();break}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[t,a,K,pe,Le,Ze,Xe,wt]);let Ye=react.useCallback(U=>{let ae=U.currentTarget.textContent?.trim()||"";if(N&&ae!==N.title){let Ue={...N,title:ae};G(Ue),r?.(N.id,{title:ae});}},[N,r]),ze=react.useCallback(U=>{U.key==="Enter"&&(U.preventDefault(),U.currentTarget.blur()),U.key==="Escape"&&(U.preventDefault(),U.currentTarget.textContent=N?.title||"",U.currentTarget.blur());},[N]),et=react.useCallback(()=>{N&&e&&N.description!==e.description&&r?.(N.id,{description:N.description}),Y(false);},[N,e,r]),st=react.useCallback(U=>{if(N){let ae={...N,columnId:U};G(ae),r?.(N.id,{columnId:U}),se(false);}},[N,r]),Re=react.useCallback(U=>{if(N){let ae={...N,priority:U};G(ae),r?.(N.id,{priority:U}),me(false);}},[N,r]),qe=react.useCallback(U=>{if(N){let ae=N.assignedUserIds||[],Ue=ae.includes(U)?ae.filter(dt=>dt!==U):[...ae,U],Dt={...N,assignedUserIds:Ue};G(Dt),r?.(N.id,{assignedUserIds:Ue});}},[N,r]),ne=react.useCallback(U=>{if(N){let ae=N.labels||[],Ue=ae.includes(U)?ae.filter(dt=>dt!==U):[...ae,U],Dt={...N,labels:Ue};G(Dt),r?.(N.id,{labels:Ue});}},[N,r]),Ge=react.useCallback(U=>{if(N){let ae={...N,tags:U};G(ae),r?.(N.id,{tags:U});}},[N,r]),ca=react.useCallback(U=>{if(N){let ae=U.target.value,Ue={...N,endDate:ae};G(Ue),r?.(N.id,{endDate:ae}),pt(false);}},[N,r]),ue=react.useCallback(U=>{if(N){let ae={...N,estimatedTime:parseFloat(U)||0};G(ae),r?.(N.id,{estimatedTime:parseFloat(U)||0});}},[N,r]),Ve=react.useCallback(()=>{if(ve.trim()&&N){let U={id:`subtask-${Date.now()}`,title:ve.trim(),completed:false,createdAt:new Date},ae=[...le,U];re(ae),Be(""),be(false),C?.(N.id,ae);}},[ve,le,N,C]),Oe=react.useCallback(U=>{let ae=le.map(Ue=>Ue.id===U?{...Ue,completed:!Ue.completed,updatedAt:new Date}:Ue);re(ae),N&&C?.(N.id,ae);},[le,N,C]),P=react.useCallback(U=>{let ae=le.filter(Ue=>Ue.id!==U);re(ae),N&&C?.(N.id,ae);},[le,N,C]),ee=react.useCallback(()=>{L.trim()&&N&&u&&(u(N.id,L.trim()),$(""));},[L,N,u]),xe=react.useCallback(U=>{(U.metaKey||U.ctrlKey)&&U.key==="Enter"&&(U.preventDefault(),ee());},[ee]),z=U=>jsxRuntime.jsx($f__default.default,{remarkPlugins:[Uf__default.default],rehypePlugins:[zf__default.default],components:{a:({node:ae,...Ue})=>jsxRuntime.jsx("a",{...Ue,target:"_blank",rel:"noopener noreferrer"})},children:U}),j=m.filter(U=>S==="comments"?U.type.includes("COMMENT"):S==="history"?!U.type.includes("COMMENT"):true);if(!t||!e)return null;let ge=N||e,Ie=s.filter(U=>ge.assignedUserIds?.includes(U.id)),Te=le.filter(U=>U.completed).length;return jsxRuntime.jsx(bt,{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":B,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:gt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ye,onKeyDown:ze,children:ge.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:it,children:[jsxRuntime.jsxs("button",{ref:Ke,className:"modal-v2-field",onClick:()=>se(!K),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:ge.columnId||"No status"})]}),jsxRuntime.jsx(en,{triggerRef:Ke,isOpen:K,onClose:()=>se(false),width:250,estimatedHeight:200,children:(w.length>0?w:Wf.map(U=>({id:U,title:U}))).map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${ge.columnId===U.id?"active":""}`,onClick:()=>st(U.id),children:U.title},U.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ce,children:[jsxRuntime.jsxs("button",{ref:ft,className:"modal-v2-field",onClick:()=>Z(!Le),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Ie.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Ie.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(en,{triggerRef:ft,isOpen:Le,onClose:()=>Z(false),width:280,estimatedHeight:300,children:s.map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ge.assignedUserIds?.includes(U.id)?"active":""}`,onClick:()=>qe(U.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:U.color},children:U.initials}),U.name,ge.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:O,children:[jsxRuntime.jsxs("button",{ref:X,className:"modal-v2-field",onClick:()=>me(!pe),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:ge.priority||"None"})]}),jsxRuntime.jsxs(en,{triggerRef:X,isOpen:pe,onClose:()=>me(false),width:180,estimatedHeight:220,children:[Hf.map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${U.toLowerCase()} ${ge.priority===U?"active":""}`,onClick:()=>Re(U),children:U},U)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Re(""),children:"None"})]})]}),h.length>0||b?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(yr,{selectedTags:ge.tags||[],availableTags:h,onChange:Ge,onCreateTag:b,theme:tt[B]||tt.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:we,children:[jsxRuntime.jsxs("button",{ref:te,className:"modal-v2-field",onClick:()=>Ne(!Ze),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:ge.labels&&ge.labels.length>0?jsxRuntime.jsx("span",{children:ge.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(en,{triggerRef:te,isOpen:Ze,onClose:()=>Ne(false),width:220,estimatedHeight:200,children:(k.length>0?k:["Bug","Feature","Enhancement","Documentation"]).map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ge.labels?.includes(U)?"active":""}`,onClick:()=>ne(U),children:[U,ge.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(!Xe),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:ge.endDate?new Date(ge.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:$e,type:"date",value:typeof ge.endDate=="string"?ge.endDate.split("T")[0]:ge.endDate?(()=>{let U=new Date(ge.endDate),ae=U.getUTCFullYear(),Ue=String(U.getUTCMonth()+1).padStart(2,"0"),Dt=String(U.getUTCDate()).padStart(2,"0");return `${ae}-${Ue}-${Dt}`})():"",onChange:ca,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Qe(!wt),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:ge.estimatedTime?`${ge.estimatedTime}h`:"Not set"})]}),wt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ge.estimatedTime||"",onChange:U=>ue(U.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Qe(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),H?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:ge.description||"",onChange:U=>{if(N){let ae={...N,description:U.target.value};G(ae);}},onBlur:et,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>Y(true),children:ge.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:z(ge.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"}),le.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Te,"/",le.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>be(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:[le.map(U=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${U.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Oe(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:()=>P(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)),oe&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:ve,onChange:U=>Be(U.target.value),onKeyDown:U=>{U.key==="Enter"&&Ve(),U.key==="Escape"&&(be(false),Be(""));},onBlur:Ve,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(T||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(kr,{cardId:ge.id,attachments:D,onUpload:T?U=>T(ge.id,U):void 0,onDelete:v,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 ${S==="all"?"active":""}`,onClick:()=>R("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="comments"?"active":""}`,onClick:()=>R("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="history"?"active":""}`,onClick:()=>R("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Pt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:L,onChange:U=>$(U.target.value),onKeyDown:xe,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:ee,disabled:!L.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[j.map(U=>{let ae=s.find(Dt=>Dt.id===U.userId);if(U.type.includes("COMMENT")){let Dt=n.find(dt=>dt.id===U.metadata?.commentId);return Dt?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ae&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:ae.color},children:ae.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:ae?.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:Dt.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:ae?.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)}),j.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 Jf({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 bi({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((m,u)=>m+u.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(Jf,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,m)=>n+m.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,m)=>n+m.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,m)=>n+(m.planned||0),0)})]})]})]})}function s0({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 hi({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,m=e[e.length-1]?.ideal||0,u=s>0?(s-n)/s*100:0,i=n<=m;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(s0,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:u>=50?"#10B981":"#F59E0B"},children:[u.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var f0={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Dc=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function b0({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,m=e+n*Math.cos(-a*(Math.PI/180)),u=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:m,y:u,fill:"white",textAnchor:m>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Sc({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 yi({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((u,i)=>u+i.value,0),n=e.map(u=>({...u,totalValue:s,color:u.color||f0[u.name]||Dc[e.indexOf(u)%Dc.length]})),m=n.map(u=>u.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?b0:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((u,i)=>jsxRuntime.jsx(recharts.Cell,{fill:m[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Sc,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(u,i)=>{let p=i.payload,d=s>0?(p.value/s*100).toFixed(0):"0";return `${u} (${p.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Sc,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((u,i)=>jsxRuntime.jsx(recharts.Cell,{fill:m[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((u,i)=>i.value>u.value?i:u).name})]})]})]})}var Un=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,m]=react.useState(false),[u,i]=react.useState(false),[p,d]=react.useState(false),[g,y]=react.useState(false);if(e.length===0)return null;let w=e.map(c=>c.id),k=c=>{r.onBulkUpdate?.(w,{priority:c}),m(false);},h=c=>{r.onBulkMove?.(w,c),i(false),a();},b=c=>{r.onBulkUpdate?.(w,{assignedUserIds:c}),d(false);},x=c=>{let C=new Set;e.forEach(T=>{T.labels?.forEach(v=>C.add(v));});let D=Array.from(new Set([...C,...c]));r.onBulkUpdate?.(w,{labels:D}),y(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(w),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(c=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k(c),children:[jsxRuntime.jsx("span",{className:l("asakaa-priority-dot",c==="LOW"&&"bg-asakaa-priority-low",c==="MEDIUM"&&"bg-asakaa-priority-medium",c==="HIGH"&&"bg-asakaa-priority-high",c==="URGENT"&&"bg-asakaa-priority-urgent")}),c]},c))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!u),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(c=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(c.id),children:c.title},c.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(c=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([c.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:c.color},children:c.initials}),c.name]},c.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>y(!g),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),g&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(c=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([c]),children:c},c))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:f,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});Un.displayName="BulkOperationsToolbar";function w0(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,m,u,i;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(y=>{let w=a?.find(k=>k.id===y);n=`assignee-${y}`,m=w?.name||`User ${y}`,u=w?.color,i=w?.avatar,r.has(n)||r.set(n,{id:n,title:m,groupValue:y,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",m="Unassigned",u="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:m,groupValue:null,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let g={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];m=g.title,u=g.color,r.has(n)||r.set(n,{id:n,title:m,groupValue:s,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(y=>{n=`label-${y}`,m=y,u="#6b7280",r.has(n)||r.set(n,{id:n,title:m,groupValue:y,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);}):(n="label-none",m="No Labels",u="#6b7280",r.has(n)||r.set(n,{id:n,title:m,groupValue:null,cardIds:[],color:u}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function vi({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),m=react.useMemo(()=>w0(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),u=react.useCallback(i=>{n(p=>{let d=new Set(p);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||m.length===0?jsxRuntime.jsx(Wr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:l("asakaa-swimlane-view",o),children:[m.map(i=>{let p=s.has(i.id),d=e.cards.filter(y=>i.cardIds.includes(y.id)),g={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&u(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Wr,{board:g,callbacks:r,availableUsers:a})})]},i.id)}),m.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var xi=[{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 wi({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),m=xi.find(i=>i.value===e)||xi[0];react.useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let u=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:l("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:m.icon}),jsxRuntime.jsx("span",{children:m.label}),jsxRuntime.jsx("svg",{className:l("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref: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:xi.map(i=>jsxRuntime.jsxs("button",{onClick:()=>u(i.value),className:l("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var tn=[{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 T0(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,m=o.alt?e.altKey:!e.altKey,u=o.meta?e.metaKey:true;return s&&n&&m&&u}function Fc(e={}){let{shortcuts:t=tn,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(u=>{o.current=[...o.current,u];},[]),m=react.useCallback(u=>{o.current=o.current.filter(i=>i.action!==u);},[]);return react.useEffect(()=>{function u(i){if(!s.current)return;let p=i.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(T0(i,d)){r&&i.preventDefault();let g=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(g);break}}}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[r]),{registerShortcut:n,unregisterShortcut:m,isEnabled:a}}function D0(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function S0(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 E0(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=S0(e),r=t?D0(t):"";return a?`${a} + ${r}`:r}function P0(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 ki({shortcuts:e=tn,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function m(u){u.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,a]),!o||!t)return null;let n=P0(e);return jsxRuntime.jsxs("div",{className:l("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([m,u])=>u.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),m]}),jsxRuntime.jsx("div",{className:"space-y-3",children:u.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:E0(i)})]},i.action))})]},m))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Ci=[{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,8 +108,8 @@
108
108
  1.
109
109
 
110
110
  **Action items:**
111
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function wi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);},u=e.reduce((i,p)=>{let l=p.category||"Other";return i[l]||(i[l]=[]),i[l].push(p),i},{});return jsxRuntime.jsxs("div",{className:d("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:d("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(u).map(([i,p])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:p.map(l=>jsxRuntime.jsxs("button",{onClick:()=>m(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Ti({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,m]=react.useState("export"),[u,i]=react.useState("json"),[p,l]=react.useState(null),f=react.useRef(null);if(!t)return null;let y=async()=>{let C=o?.current||void 0,h=await ud(e,u,C);gd(h,u);},x=async C=>{let h=C.target.files?.[0];if(h){try{let b=await hd(h),g=h.name.endsWith(".json")?"json":"csv",k=bd(b,g);l(k),k.success&&r&&r(k,b);}catch(b){l({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}f.current&&(f.current.value="");}};return jsxRuntime.jsxs("div",{className:d("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>m("export"),className:d("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>m("import"),className:d("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(C=>jsxRuntime.jsxs("button",{onClick:()=>i(C),className:d("p-4 rounded-lg border-2 transition-all text-center",u===C?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[C==="json"&&"\u{1F4C4}",C==="csv"&&"\u{1F4CA}",C==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:C})]},C))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:y,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:f,type:"file",accept:".json,.csv",onChange:x,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>f.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),p&&jsxRuntime.jsxs("div",{className:d("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:d("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((C,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",C]},h))})]})]})]})]})]})}var N0=["URGENT","HIGH","MEDIUM","LOW"],D0=[{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"}],S0=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ni({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:m,availableUsers:u=[],availableLabels:i=[],availableColumns:p=[],showQuickFilters:l=true,compact:f=false,groupBy:y="none",onGroupByChange:x}){let[C,h]=react.useState(true),b=react.useCallback(w=>{a({search:w.target.value});},[a]),g=react.useCallback(w=>{a({dateFilter:w.target.value});},[a]),k=react.useCallback(w=>{r({by:w.target.value});},[r]),c=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 ${f?"filter-bar--compact":""} ${C?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!C),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:C?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:w=>{w.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:C?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),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)"]})]}),!C&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),m&&jsxRuntime.jsx("button",{onClick:m,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:g,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:w=>{let R=w.target.value;a({priorities:R==="all"?[]:[R]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),N0.map(w=>jsxRuntime.jsx("option",{value:w,children:w},w))]})}),u.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:w=>{let R=w.target.value;a({assignees:R==="all"?[]:[R]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),u.map(w=>jsxRuntime.jsx("option",{value:w.id,children:w.name},w.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:w=>{let R=w.target.value;a({labels:R==="all"?[]:[R]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(w=>jsxRuntime.jsx("option",{value:w,children:w},w))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:k,className:"filter-bar__select filter-bar__select--sm",children:D0.map(w=>jsxRuntime.jsx("option",{value:w.value,children:w.label},w.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),x&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:y,onChange:w=>x(w.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:S0.map(w=>jsxRuntime.jsx("option",{value:w.value,children:w.label},w.value))})}),T&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Di({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:m,onExportGanttCSV:u}){let[i,p]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let y=x=>{l.current&&!l.current.contains(x.target)&&p(false);};return i&&document.addEventListener("mousedown",y),()=>{document.removeEventListener("mousedown",y);}},[i]);let f=y=>{y(),p(false);};return jsxRuntime.jsxs("div",{className:d("relative",r),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",y.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",y.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>f(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:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:()=>f(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:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:()=>f(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:()=>f(async()=>await m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:()=>f(()=>u?.()),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:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:()=>f(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:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:()=>f(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:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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 Si={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"}},Ei={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"}},Pi={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"}},po={dark:Si,light:Ei,neutral:Pi},Un="dark";var zn=react.createContext(void 0),O0="asakaa-theme";function Ac({children:e,defaultTheme:t=Un,storageKey:a=O0}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let m=localStorage.getItem(a);if(m&&(m==="dark"||m==="light"||m==="neutral"))return m}return t}),s=react.useCallback(m=>{o(m),typeof window<"u"&&localStorage.setItem(a,m);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let m=document.documentElement,u=po[r];Object.entries(u.colors).forEach(([p,l])=>{l&&m.style.setProperty(`--theme-${$0(p)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,l])=>{let f=u.colors[p];f&&m.style.setProperty(l,f);}),m.setAttribute("data-theme",r),m.classList.remove("theme-dark","theme-light","theme-neutral"),m.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:po};return jsxRuntime.jsx(zn.Provider,{value:n,children:e})}function Ao(){let e=react.useContext(zn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function $0(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Mi({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Ao();return e?jsxRuntime.jsxs("div",{className:d("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(po).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:d("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Fc(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return rt[e]||rt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",rt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",rt[e].bgSecondary),bgGrid:r("--theme-bg-card",rt[e].bgGrid),bgWeekend:r("--theme-bg-hover",rt[e].bgWeekend),border:r("--theme-border-primary",rt[e].border),borderLight:r("--theme-border-subtle",rt[e].borderLight),textPrimary:r("--theme-text-primary",rt[e].textPrimary),textSecondary:r("--theme-text-secondary",rt[e].textSecondary),textTertiary:r("--theme-text-tertiary",rt[e].textTertiary),accent:r("--theme-accent-primary",rt[e].accent),accentHover:r("--theme-accent-hover",rt[e].accentHover),accentLight:r("--theme-accent-primary",rt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",rt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",rt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",rt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",rt[e].dependency),dependencyHover:r("--theme-border-secondary",rt[e].dependencyHover),criticalPath:r("--theme-error",rt[e].criticalPath),criticalPathLight:r("--theme-error",rt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",rt[e].today):e==="neutral"?r("--theme-text-primary",rt[e].today):r("--theme-error",rt[e].today),todayLight:e==="light"?r("--theme-accent-primary",rt[e].todayLight):e==="neutral"?r("--theme-text-primary",rt[e].todayLight):r("--theme-error",rt[e].todayLight),milestone:r("--theme-warning",rt[e].milestone),milestoneLight:r("--theme-warning",rt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",rt[e].statusTodo),statusInProgress:r("--theme-accent-primary",rt[e].statusInProgress),statusCompleted:r("--theme-success",rt[e].statusCompleted),hoverBg:r("--theme-bg-hover",rt[e].hoverBg),focusRing:r("--theme-accent-primary",rt[e].focusRing)}}var Hn={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Lc={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Ai={en:Hn,es:Lc};function Ic(e){return Ai[e]||Ai.en}function Fi(e,t){let a=Ic(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 Lo=react.createContext(Hn);function jr(){return react.useContext(Lo)}function nb({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[m,u]=react.useState(false),[i,p]=react.useState(null),l=react.useRef(null),f=jr();if(react.useEffect(()=>{let h=b=>{l.current&&!l.current.contains(b.target)&&u(false);};return m&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[m]),!(t||a||r||o||s||n))return null;let x=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(h=>h.handler),C=async(h,b)=>{if(b){p(h);try{await b();}catch(g){console.error(`Export ${h} failed:`,g);}finally{p(null),u(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(!m),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?e.accent:e.bgSecondary,border:`1px solid ${m?e.accent:e.borderLight}`,color:m?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:f.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:m?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:x.map((h,b)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>C(h.id,h.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<x.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===h.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):h.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})})]})}function sb({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function ib({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 lb({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=jr();react.useEffect(()=>{let i=p=>{s.current&&!s.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],u=m.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${u}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:m.map((i,p)=>{let l=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:p<m.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:i.label}),l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function db({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),m=react.useRef(null),u=jr();react.useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let y=C=>{m.current&&!m.current.contains(C.target)&&n(false);},x=C=>{C.key==="Escape"&&n(false);};document.addEventListener("mousedown",y),document.addEventListener("keydown",x),m._cleanup=()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",x);};},100);return ()=>{clearTimeout(f),m._cleanup&&m._cleanup();}},[s]);let i=[{value:"all",label:u.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:u.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:u.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:u.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=t!=="all"||r,l=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:f=>{f.stopPropagation(),n(y=>!y);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:p?l?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${p?l?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:p?"#3B82F6":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:u.toolbar.filter||"Filters"}),p&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:l?"#0F1117":"#FFFFFF",border:`1px solid ${l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:l?"#6B7280":"#9CA3AF"},children:u.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-2",children:i.map(f=>{let y=t===f.value&&!r,x=()=>f.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):f.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(f.value),o&&o(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:y?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${y?f.color:"text-gray-400"} flex-shrink-0`,children:x()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:f.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]},f.value)})}),jsxRuntime.jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all");},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?l?"#3B82F6":"#2563EB":l?"#6B7280":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:u.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]})})]})})]})}function Gn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:m,onRowDensityChange:u,showThemeSelector:i=false,showCreateTaskButton:p=false,createTaskLabel:l,onCreateTask:f,taskFilter:y="all",onTaskFilterChange:x,hideCompleted:C=false,onHideCompletedChange:h,onExportPNG:b,onExportPDF:g,onExportExcel:k,onExportCSV:c,onExportJSON:T,onExportMSProject:w}){let R=jr(),v=b||g||k||c||T||w,I=[{value:"day",label:R.toolbar.day},{value:"week",label:R.toolbar.week},{value:"month",label:R.toolbar.month}],F=[{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(ib,{options:I,value:t,onChange:N=>a(N),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(lb,{theme:e,value:m,onChange:u}),x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(db,{theme:e,value:y,onChange:x,hideCompleted:C,onHideCompletedChange:h})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:f,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||R.toolbar.createTask})]}),(v||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(nb,{theme:e,onExportPNG:b,onExportPDF:g,onExportExcel:k,onExportCSV:c,onExportJSON:T,onExportMSProject:w}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(sb,{options:F,value:s,onChange:N=>n(N),theme:e})]})]})}function _n({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),m=react.useRef(null),u=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=l=>{m.current&&!m.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let i=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:u,onClick:()=>{if(!r&&u.current){let p=u.current.getBoundingClientRect();n({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(ht,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:m,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function Io({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[m,u]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,l=r.length*36+8,f=8,y=window.innerWidth,x=window.innerHeight,C=t,h=a;t+p+f>y&&(C=t-p,C<f&&(C=f)),a+l+f>x&&(h=x-l-f,h<f&&(h=f)),u({x:C,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=f=>{n.current&&!n.current.contains(f.target)&&o();},l=f=>{f.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let i=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${m.x}px`,top:`${m.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:l=>{p.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var _t={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Gc({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:m,onTaskOutdent:u,onTaskRename:i,onTaskToggleExpand:p,onOpenTaskModal:l,enableKeyboard:f=true}){let y=react.useRef(false),x=react.useCallback(k=>{y.current=k;},[]),C=react.useCallback(k=>{let c=[],T=w=>{for(let R of w)c.push(R),R.subtasks&&R.subtasks.length>0&&R.isExpanded&&T(R.subtasks);};return T(k),c},[]),h=react.useCallback(()=>{let k=C(e);for(let c of k)if(t.has(c.id))return c;return null},[e,t,C]),b=react.useCallback((k,c)=>{let T=C(e);if(T.length===0)return;let w=h();if(!w){a(T[0].id,false);return}let R=T.findIndex(F=>F.id===w.id);if(R===-1)return;let v=k==="up"?R-1:R+1;if(v<0||v>=T.length)return;let I=T[v];a(I.id,c);},[e,h,C,a]),g=react.useCallback(k=>{if(!f)return;let c=k.target;if(c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable||y.current){k.key==="Escape"&&(c.blur(),y.current=false);return}let R=navigator.platform.toUpperCase().indexOf("MAC")>=0?k.metaKey:k.ctrlKey,v=Array.from(t),I=h();if(k.key==="ArrowUp"){k.preventDefault(),b("up",k.shiftKey);return}if(k.key==="ArrowDown"){k.preventDefault(),b("down",k.shiftKey);return}if(I&&(k.key==="ArrowRight"||k.key==="ArrowLeft")){I.subtasks&&I.subtasks.length>0&&(k.preventDefault(),(k.key==="ArrowRight"&&!I.isExpanded||k.key==="ArrowLeft"&&I.isExpanded)&&p(I.id));return}if(k.altKey&&(k.key==="ArrowUp"||k.key==="ArrowDown")){v.length>0&&(k.preventDefault(),n(v,k.key==="ArrowUp"?"up":"down"));return}if(k.key==="Tab"&&!k.shiftKey){v.length>0&&(k.preventDefault(),m(v));return}if(k.key==="Tab"&&k.shiftKey){v.length>0&&(k.preventDefault(),u(v));return}if(k.key==="Enter"&&!k.shiftKey&&!R){I&&(k.preventDefault(),r(I.id,"below"));return}if(k.key==="Enter"&&k.shiftKey&&!R){I&&(k.preventDefault(),r(I.id,"above"));return}if(k.key==="Enter"&&R){I&&(k.preventDefault(),l(I.id));return}if(k.key==="F2"){I&&(k.preventDefault(),i(I.id));return}if(k.key==="Delete"||k.key==="Backspace"&&R){v.length>0&&(k.preventDefault(),o(v));return}if(k.key==="d"&&R&&!k.shiftKey){v.length>0&&(k.preventDefault(),s(v));return}},[f,t,h,b,r,o,s,n,m,u,i,p,l]);return react.useEffect(()=>{if(f)return window.addEventListener("keydown",g),()=>{window.removeEventListener("keydown",g);}},[f,g]),{setIsEditing:x}}function Vc(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(l=>{t(new Set([l])),r(l);},[]),s=react.useCallback(l=>{t(f=>{let y=new Set(f);return y.has(l)?y.delete(l):y.add(l),y}),r(l);},[]),n=react.useCallback((l,f)=>{if(!a){o(l);return}let y=f.indexOf(a),x=f.indexOf(l);if(y===-1||x===-1){o(l);return}let C=Math.min(y,x),h=Math.max(y,x),b=f.slice(C,h+1);t(new Set(b)),r(l);},[a,o]),m=react.useCallback((l,f,y,x)=>{x?n(l,f):y?s(l):o(l);},[o,s,n]),u=react.useCallback((l,f)=>{f?t(y=>{let x=new Set(y);return x.add(l),x}):o(l);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:m,handleKeyboardSelection:u,clearSelection:i,isTaskSelected:p}}function Bo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let m={...r[n],parentId:o,level:s,position:n};t.push(m),m.subtasks&&m.subtasks.length>0&&m.isExpanded&&a(m.subtasks,m.id,s+1);}};return a(e),t}function jc(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=jc(a.subtasks,t);if(r)return r}}return null}function Ui(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Ui(a.subtasks,t);if(r)return r}return null}function zi(e,t){if(t.length===0)return e;let a=Bo(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],n=(l,f)=>{let y=[];return {tasks:l.filter(C=>{if(f.has(C.id))return y.push(C),false;if(C.subtasks){let h=n(C.subtasks,f);C.subtasks=h.tasks,y.push(...h.removed);}return true}),removed:y}},m=(l,f,y)=>l.map(x=>x.id===f?{...x,subtasks:[...x.subtasks||[],...y],isExpanded:true}:x.subtasks?{...x,subtasks:m(x.subtasks,f,y)}:x),u=new Set(t),{tasks:i,removed:p}=n(e,u);return m(i,s.id,p)}function Hi(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Ui(a,r);if(!o)continue;let s=Ui(a,o.id),n=(i,p,l)=>{for(let f=0;f<i.length;f++){let y=i[f];if(y.id===p&&y.subtasks){let x=y.subtasks.findIndex(C=>C.id===l);if(x!==-1){let[C]=y.subtasks.splice(x,1);return C}}if(y.subtasks){let x=n(y.subtasks,p,l);if(x)return x}}return null},m=(i,p,l)=>{let f=i.findIndex(y=>y.id===p);if(f!==-1)return i.splice(f+1,0,l),i;for(let y of i)y.subtasks&&m(y.subtasks,p,l);return i},u=n(a,o.id,r);u&&(s&&s.subtasks?m(s.subtasks,o.id,u):m(a,o.id,u));}return a}function Wi(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,m,u)=>{let i=n.findIndex(l=>l.id===m);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,m,u))return true;return false}let p=u==="up"?i-1:i+1;return p<0||p>=n.length?false:([n[i],n[p]]=[n[p],n[i]],true)};return s(r,o,a),r}function Gi(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 _i(e,t){let a=[...e];for(let r of t){let o=n=>{let m=n.findIndex(p=>p.id===r);if(m===-1){for(let p of n)if(p.subtasks&&o(p.subtasks))return true;return false}let u=n[m],i={...u,id:`${u.id}-copy-${Date.now()}`,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks):void 0};return n.splice(m+1,0,i),true},s=n=>n.map(m=>({...m,id:`${m.id}-copy-${Date.now()}`,subtasks:m.subtasks?s(m.subtasks):void 0}));o(a);}return a}function Kc(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},m=u=>{let i=u.findIndex(l=>l.id===t);if(i===-1){for(let l of u)if(l.subtasks&&m(l.subtasks))return true;return false}let p=a==="above"?i:i+1;return u.splice(p,0,n),true};return m(r),{tasks:r,newTask:n}}function Vi(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Vi(r.subtasks,t,a)}:r)}function ji(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:ji(a.subtasks,t)}:a)}function Ki(e,t){let a=p=>{for(let l of p){if(l.id===t)return l;if(l.subtasks){let f=a(l.subtasks);if(f)return f}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,m=r?.endDate||s,u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(m),color:r?.color||"#3B82F6"},i=p=>p.map(l=>{if(l.id===t){let f=l.subtasks||[];return {...l,subtasks:[...f,u],isExpanded:true}}return l.subtasks?{...l,subtasks:i(l.subtasks)}:l});return {tasks:i(e),newTask:u}}function Yc(e,t,a,r){if(t===a)return e;let o=jc(e,t);if(!o)return e;if(a){let m=(u,i)=>{if(!u.subtasks)return false;for(let p of u.subtasks)if(p.id===i||m(p,i))return true;return false};if(m(o,a))return e}let s=m=>m.filter(u=>u.id!==t).map(u=>u.subtasks&&u.subtasks.length>0?{...u,subtasks:s(u.subtasks)}:u),n=s(e);if(a===null){let m=r!==void 0?r:n.length;n.splice(m,0,{...o,parentId:void 0});}else {let m=u=>u.map(i=>{if(i.id===a){let p=i.subtasks||[],l=r!==void 0?r:p.length,f=[...p];return f.splice(l,0,{...o,parentId:a}),{...i,subtasks:f,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:m(i.subtasks)}:i});n=m(n);}return n}function Kn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:m,onTaskToggle:u,scrollTop:i,columns:p,onToggleColumn:l,onColumnResize:f,onTaskUpdate:y,onTaskIndent:x,onTaskOutdent:C,onTaskMove:h,onMultiTaskDelete:b,onTaskDuplicate:g,onTaskCreate:k,onTaskRename:c,onCreateSubtask:T,onOpenTaskModal:w,onDeleteRequest:R,onTaskReparent:v}){let I=react.useContext(Lo),[F,N]=react.useState(null),[U,$]=react.useState(null),[j,ne]=react.useState(""),re=react.useRef(null),[se,ye]=react.useState(null),[be,Be]=react.useState(0),[A,O]=react.useState(0),[L,_]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[J,ce]=react.useState(null),[fe,me]=react.useState(null),[Le,te]=react.useState(null),Je=react.useRef(0),ke=5,Qe=react.useRef(false),[ct,ft]=react.useState(null),[et,wt]=react.useState(false),[Mt,Dt]=react.useState(null),[Ye,B]=react.useState(false),ie=react.useRef(null);react.useEffect(()=>{function G(K){ie.current&&!ie.current.contains(K.target)&&B(false);}if(Ye)return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[Ye]),react.useEffect(()=>{U&&re.current&&(re.current.focus(),re.current.select());},[U]),react.useEffect(()=>{if(!se)return;let G=he=>{let Ke=he.clientX-be,Ie=A+Ke;f?.(se,Ie);},K=()=>{ye(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",K),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",K),document.body.style.cursor="",document.body.style.userSelect="";}},[se,be,A,f]);let{selectedTaskIds:Se,handleTaskClick:He,isTaskSelected:Ze}=Vc(),{setIsEditing:bt}=Gc({tasks:e,selectedTaskIds:Se,onTaskSelect:(G,K)=>{let Ke=Bo(e).map(Ie=>Ie.id);He(G,Ke,K||false,false);},onTaskCreate:k||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:g||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:C||(()=>{}),onTaskRename:G=>{let K=Bo(e).find(he=>he.id===G);K&&lt(K);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:G=>{let K=Bo(e).find(he=>he.id===G);K&&w&&w(K);},enableKeyboard:true}),q=(G,K=0)=>{let he=[];for(let Ke of G)he.push({task:Ke,level:K}),Ke.subtasks&&Ke.subtasks.length>0&&Ke.isExpanded&&he.push(...q(Ke.subtasks,K+1));return he},Q=q(e),je=48,Re=Math.max(Q.length*a,600-je),tt=G=>!G.startDate||!G.endDate?"-":`${Math.ceil((G.endDate.getTime()-G.startDate.getTime())/(1e3*60*60*24))}d`,lt=G=>{$(G.id),ne(G.name),bt(true);},Ue=G=>{j.trim()&&j!==e.find(K=>K.id===G)?.name&&c?.(G,j.trim()),$(null),ne(""),bt(false);},qe=()=>{$(null),ne(""),bt(false);},ae=(G,K)=>{K.stopPropagation(),T?.(G.id);},S=(G,K)=>{K.preventDefault(),Je.current=K.clientY,ce(G),Qe.current=false,wt(false),ft({x:K.clientX,y:K.clientY});},we=G=>{if(!J||(Math.abs(G.clientY-Je.current)>ke&&!Qe.current&&(Qe.current=true,wt(true)),ft({x:G.clientX,y:G.clientY}),!Qe.current))return;let he=document.querySelectorAll("[data-task-row]"),Ke=null,Ie=null;he.forEach(z=>{let de=z.getBoundingClientRect(),Ge=z.getAttribute("data-task-row");if(Ge&&Ge!==J&&G.clientY>=de.top&&G.clientY<=de.bottom){Ke=Ge;let St=G.clientY-de.top,mt=de.height;St<mt*.25?Ie="above":St>mt*.75?Ie="below":Ie="child";}}),me(Ke),te(Ie);},X=()=>{if(Qe.current&&J&&fe&&Le){if(Le==="child")v?.(J,fe);else if(Le==="above"||Le==="below"){let G=(Ke,Ie,z=null)=>{for(let de of Ke){if(de.id===Ie)return z;if(de.subtasks){let Ge=G(de.subtasks,Ie,de.id);if(Ge!==void 0)return Ge}}},K=G(e,fe,null),he=(Ke,Ie)=>{let z=Ke.findIndex(de=>de.id===Ie);return Le==="below"?z+1:z};if(K===null){let Ke=he(e,fe);v?.(J,null,Ke);}else {let Ke=Q.find(Ie=>Ie.task.id===K)?.task;if(Ke?.subtasks){let Ie=he(Ke.subtasks,fe);v?.(J,K,Ie);}}}}ce(null),me(null),te(null),ft(null),Qe.current=false,wt(false);};react.useEffect(()=>{if(J)return document.addEventListener("mousemove",we),document.addEventListener("mouseup",X),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",we),document.removeEventListener("mouseup",X),document.body.style.cursor="",document.body.style.userSelect="";}},[J,fe,Le]);let Te=(G,K,he)=>{switch(G.id){case "name":let Ke=U===K.id,Ie=F===K.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${he*20}px`},children:[v&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:Ie?1:.3},onMouseDown:H=>S(K.id,H),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),K.subtasks&&K.subtasks.length>0?jsxRuntime.jsx("button",{onClick:H=>{H.stopPropagation(),u?.(K.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:K.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:K.color||"#3B82F6",opacity:K.parentId?.6:1,borderColor:K.isMilestone?t.accent:"transparent",borderWidth:K.isMilestone?"2px":"0px"},title:K.isMilestone?"Milestone":K.parentId?"Subtask":"Task"})}),Ke?jsxRuntime.jsx("input",{ref:re,type:"text",value:j,onChange:H=>ne(H.target.value),onKeyDown:H=>{H.key==="Enter"?Ue(K.id):H.key==="Escape"&&qe();},onBlur:()=>Ue(K.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:H=>H.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:K.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:K.parentId?"13px":"14px",fontWeight:K.isMilestone?600:K.parentId?400:600,letterSpacing:K.parentId?"0":"-0.01em"},title:K.name,children:K.name}),Ie&&!Ke&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:H=>H.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:H=>ae(K,H),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:H=>{H.stopPropagation(),lt(K);},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 de=G.id==="startDate"?"startDate":"endDate",Ge=K[de],St=Mt?.taskId===K.id&&Mt?.field===de,mt=H=>H?(typeof H=="string"?new Date(H):H).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:H=>H.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:H=>{if(St)Dt(null);else {let Pe=H.currentTarget.getBoundingClientRect();Dt({taskId:K.id,field:de,month:Ge?typeof Ge=="string"?new Date(Ge):Ge:new Date,position:{top:Pe.bottom+4,left:Pe.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:mt(Ge)})]}),St&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Dt(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:Mt?.position.top,left:Mt?.position.left},onClick:H=>H.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let H=new Date,Pe=new Date(H);Pe.setDate(H.getDate()+1);let Me=new Date(H);Me.setDate(H.getDate()+7);let Ut=new Date(H);return Ut.setDate(H.getDate()+14),[{label:"Hoy",date:H},{label:"Ma\xF1ana",date:Pe},{label:"Pr\xF3xima semana",date:Me},{label:"2 semanas",date:Ut}].map((_e,xt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:ze=>ze.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ze=>ze.currentTarget.style.backgroundColor="transparent",onClick:()=>{y?.(K.id,{[de]:_e.date}),Dt(null);},children:_e.label},xt))})(),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:H=>H.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:H=>H.currentTarget.style.backgroundColor="transparent",onClick:()=>{y?.(K.id,{[de]:void 0}),Dt(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:()=>Dt(H=>H?{...H,month:new Date(H.month.getFullYear(),H.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:Mt?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Dt(H=>H?{...H,month:new Date(H.month.getFullYear(),H.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((H,Pe)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:H},Pe))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let H=Mt?.month||new Date,Pe=H.getFullYear(),Me=H.getMonth(),Ut=new Date(Pe,Me,1).getDay(),pe=new Date(Pe,Me+1,0).getDate(),_e=new Date,xt=[];for(let gt=Ut-1;gt>=0;gt--)xt.push({day:new Date(Pe,Me,-gt).getDate(),date:new Date(Pe,Me-1,new Date(Pe,Me,-gt).getDate()),isCurrentMonth:false});for(let gt=1;gt<=pe;gt++)xt.push({day:gt,date:new Date(Pe,Me,gt),isCurrentMonth:true});let ze=42-xt.length;for(let gt=1;gt<=ze;gt++)xt.push({day:gt,date:new Date(Pe,Me+1,gt),isCurrentMonth:false});return xt.map((gt,va)=>{let ka=gt.date.toDateString()===_e.toDateString(),Xe=(Ge?typeof Ge=="string"?new Date(Ge):Ge:null)?.toDateString()===gt.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:gt.isCurrentMonth?Xe?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Xe?"#3B82F6":"transparent",boxShadow:ka&&!Xe?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{y?.(K.id,{[de]:gt.date}),Dt(null);},children:gt.day},va)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:tt(K)})});case "assignees":let Dr=r.filter(H=>K.assignees?.some(Pe=>Pe.name===H.name||Pe.initials===H.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:H=>H.stopPropagation(),children:jsxRuntime.jsx(no,{assignedUsers:Dr,availableUsers:r,onChange:H=>{let Pe=H.map(Me=>({id:Me.id,name:Me.name,initials:Me.initials,color:Me.color}));y?.(K.id,{assignees:Pe.length>0?Pe:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:H=>H.stopPropagation(),children:jsxRuntime.jsx(Rd,{status:K.status||"todo",onChange:H=>{y?.(K.id,{status:H,progress:H==="completed"?100:K.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:`${K.progress}%`,backgroundColor:K.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:[K.progress,"%"]})]});case "priority":let fr={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ua={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},M=fr[K.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:H=>H.stopPropagation(),children:jsxRuntime.jsx(ro,{priority:M,onChange:H=>{H&&y?.(K.id,{priority:Ua[H]||"medium"});}})});default:return null}},Ce=G=>[{id:"hide",label:"Hide Column",icon:_t.Hide,onClick:()=>l(G),disabled:G==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:_t.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:_t.SortDesc,onClick:()=>{}}],We=G=>G.subtasks&&G.subtasks.length>0?[{id:"addSubtask",label:I?.contextMenu?.addSubtask||"Add Subtask",icon:_t.Add,onClick:()=>{T?.(G.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:I?.contextMenu?.deleteTask||"Delete Task",icon:_t.Delete,onClick:()=>{R?R(G.id,G.name):b?.([G.id]);}}]:[{id:"edit",label:I?.contextMenu?.editTask||"Edit Task",icon:_t.Pencil,onClick:()=>{n?.(G);}},{id:"addSubtask",label:I?.contextMenu?.addSubtask||"Add Subtask",icon:_t.Add,onClick:()=>{T?.(G.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:I?.contextMenu?.markIncomplete||"Mark Incomplete",icon:_t.MarkIncomplete,onClick:()=>{y?.(G.id,{status:"todo",progress:0});},disabled:G.status==="todo"},{id:"setInProgress",label:I?.contextMenu?.setInProgress||"Set In Progress",icon:_t.SetInProgress,onClick:()=>{y?.(G.id,{status:"in-progress"});},disabled:G.status==="in-progress"},{id:"markComplete",label:I?.contextMenu?.markComplete||"Mark Complete",icon:_t.MarkComplete,onClick:()=>{y?.(G.id,{status:"completed",progress:100});},disabled:G.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:I?.contextMenu?.splitTask||"Split Task",icon:_t.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:I?.contextMenu?.deleteTask||"Delete Task",icon:_t.Delete,onClick:()=>{R?R(G.id,G.name):b?.([G.id]);}}],Oe=p.filter(G=>G.visible),at=Oe.reduce((G,K)=>G+K.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:at},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${je}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:Oe.map((G,K)=>{let he=K===Oe.length-1,Ke=G.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ke?"":"justify-center"}`,style:{width:`${G.width}px`,minWidth:`${G.minWidth??(Ke?200:60)}px`,maxWidth:`${G.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:he?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Ie=>{Ie.preventDefault(),_({isOpen:true,x:Ie.clientX,y:Ie.clientY,type:"header",columnId:G.id});},onMouseEnter:Ie=>{Ie.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Ie=>{Ie.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:G.label,children:G.label}),G.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:se===G.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Ie=>{Ie.preventDefault(),Ie.stopPropagation(),ye(G.id),Be(Ie.clientX),O(G.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"}})})]},G.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(_n,{columns:p,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>B(!Ye),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"})}),Ye&&jsxRuntime.jsxs("div",{ref:ie,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:G=>G.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>B(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Re},children:Q.map(({task:G,level:K},he)=>{let Ke=Ze(G.id),Ie=fe===G.id,z=Ie&&Le==="above",de=Ie&&Le==="below",Ge=Ie&&Le==="child",St={};return Ge&&(St.backgroundColor=`${t.accent}15`,St.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":G.id,className:`flex items-center cursor-pointer group ${J===G.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ke?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ke?t.accentLight:Ge?`${t.accent}15`:he%2===0?t.bgPrimary:t.bgGrid,...St},onMouseEnter:()=>N(G.id),onMouseLeave:()=>N(null),onClick:mt=>{let fr=Bo(e).map(H=>H.id),M=navigator.platform.toUpperCase().indexOf("MAC")>=0?mt.metaKey:mt.ctrlKey;He(G.id,fr,M,mt.shiftKey),s?.(G);},onDoubleClick:mt=>{mt.stopPropagation(),n?.(G);},onContextMenu:mt=>{mt.preventDefault(),_({isOpen:true,x:mt.clientX,y:mt.clientY,type:"task",task:G}),m?.(G,mt);},whileHover:{backgroundColor:Ke?t.accentLight:t.hoverBg},children:[z&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),de&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Oe.map((mt,Dr)=>{let fr=Dr===Oe.length-1,Ua=mt.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Ua?"justify-start":"justify-center"}`,style:{width:`${mt.width}px`,minWidth:`${mt.minWidth??(Ua?200:60)}px`,maxWidth:`${mt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:fr?"none":`1px solid ${F===G.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Te(mt,G,Ua?K:0)},`${G.id}-${mt.id}`)})]},G.id)})}),jsxRuntime.jsx(Io,{isOpen:L.isOpen,x:L.x,y:L.y,items:L.type==="header"&&L.columnId?Ce(L.columnId):L.type==="task"&&L.task?We(L.task):[],onClose:()=>_({...L,isOpen:false}),theme:t}),et&&ct&&J&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:ct.x+12,top:ct.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let G=Q.find(K=>K.task.id===J)?.task;return G?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:G.name})}):null})()}),document.body)]})}function Qc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,m]=react.useState(e),[u,i]=react.useState(t),[p,l]=react.useState(null),[f,y]=react.useState(null),[x,C]=react.useState(null),[h,b]=react.useState(null),[g,k]=react.useState(0),[c,T]=react.useState(0),[w,R]=react.useState(null),[v,I]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:m,ghostWidth:u,setGhostWidth:i,connectionLine:p,setConnectionLine:l,hoveredTaskId:f,setHoveredTaskId:y,activeZone:x,setActiveZone:C,draggedSegmentIndex:h,setDraggedSegmentIndex:b,draggedSegmentStartX:g,setDraggedSegmentStartX:k,segmentDragOffsetX:c,setSegmentDragOffsetX:T,hoveredSegmentIndex:w,setHoveredSegmentIndex:R,isHovered:v,setIsHovered:I,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(j,ne)=>{r("none"),l(null),y(null),m(j),i(ne),T(0),b(null),k(0);}}}function qn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:m,onClick:u,onDoubleClick:i,onContextMenu:p,onDateChange:l,onDependencyCreate:f,allTaskPositions:y=[],onDragMove:x,onHoverChange:C}){let h=Qc(t,r),b=react.useRef(null),g=react.useRef(null),k=react.useRef(null),{dragMode:c,setDragMode:T,dragOffset:w,setDragOffset:R,ghostX:v,setGhostX:I,ghostWidth:F,setGhostWidth:N,connectionLine:U,setConnectionLine:$,hoveredTaskId:j,setHoveredTaskId:ne,activeZone:re,setActiveZone:se,draggedSegmentIndex:ye,setDraggedSegmentIndex:be,draggedSegmentStartX:Be,setDraggedSegmentStartX:A,segmentDragOffsetX:O,setSegmentDragOffsetX:L,hoveredSegmentIndex:_,setHoveredSegmentIndex:J,isHovered:ce,setIsHovered:fe,isDragging:me,isResizing:Le,isConnecting:te,resetDragState:Je}=h,ke=32,Qe=8,ct=e.endDate&&e.endDate<new Date&&e.progress<100,ft=e.isCriticalPath,et=o.name==="neutral"||o.today==="#1C1917",wt=e.status==="completed"||e.progress===100,Mt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Ye=e.isCriticalPath||ct?"#DC2626":e.color?e.color:e.priority&&Mt[e.priority]?Mt[e.priority]:o.taskBarPrimary,ie=(X=>X>=80?20:X>=60?15:X>=50?12:10)(r),Se=r<50,He=r<40;react.useEffect(()=>{if(C)if(ce&&!me&&!e.segments){let X=a<100;C({task:e,x:t,y:a,width:r,height:ke,showBelow:X});}else C(null);},[ce,me,e,t,a,r,ke,C]);let Ze=X=>X.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),bt=()=>{let X=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${X} day${X!==1?"s":""}`},q=X=>Math.round(X/s)*s,Q=X=>{let Te=Math.round(X/s),Ce=new Date(n);return Ce.setDate(Ce.getDate()+Te),Ce},je=(X,Te)=>{for(let Ce of y){if(Ce.id===e.id)continue;let We=5;if(X>=Ce.x-We&&X<=Ce.x+Ce.width+We&&Te>=Ce.y-We&&Te<=Ce.y+Ce.height+We)return Ce.id}return null},Re=react.useCallback((X,Te,Ce)=>{X.preventDefault(),X.stopPropagation();let We=b.current?.ownerSVGElement;if(!We)return;let Oe=We.createSVGPoint();Oe.x=X.clientX,Oe.y=X.clientY;let at=Oe.matrixTransform(We.getScreenCTM()?.inverse()),G=Ce!==void 0?Ce:t,K=Te;if(!K){let he=at.x-G;X.shiftKey?(K="connect",$({x:t+r,y:a+ke/2})):X.ctrlKey||X.metaKey?K="move":X.altKey?K=he<r/2?"resize-start":"resize-end":He?he<r/2?K="move":K="resize-end":Se?he<=ie/2?K="resize-start":he>=r-ie/2?K="resize-end":K="move":he<=ie?K="resize-start":he>=r-ie?K="resize-end":K="move";}T(K),fe(false),se(null),K==="move"?R(at.x-G):K==="connect"?$({x:t+r,y:a+ke/2}):R(0),I(G),N(r);},[t,r,a,ke]),tt=react.useCallback(X=>{let Te=b.current?.ownerSVGElement;if(!Te)return;let Ce=Te.closest(".gantt-timeline-scroll");if(!Ce)return;let We=Ce.getBoundingClientRect(),Oe=60,at=15,G=0;if(X.clientX<We.left+Oe){let K=We.left+Oe-X.clientX;G=-Math.min(at,K/2);}else if(X.clientX>We.right-Oe){let K=X.clientX-(We.right-Oe);G=Math.min(at,K/2);}return G!==0&&(Ce.scrollLeft+=G),G!==0},[]),lt=react.useCallback(X=>{if(c==="none")return;k.current=X;let Te=b.current?.ownerSVGElement;if(!Te)return;if(c==="move"||c==="resize-start"||c==="resize-end"){let Oe=tt(X);Oe&&!g.current?g.current=window.setInterval(()=>{k.current&&(tt(k.current),lt(k.current));},16):!Oe&&g.current&&(window.clearInterval(g.current),g.current=null);}let Ce=Te.createSVGPoint();Ce.x=X.clientX,Ce.y=X.clientY;let We=Ce.matrixTransform(Te.getScreenCTM()?.inverse());if(c==="connect"){$({x:We.x,y:We.y});let Oe=je(We.x,We.y);ne(Oe);}else if(c==="move"){let Oe=We.x-w,at=q(Oe);I(at),N(r);let G=Math.round((at-t)/s);if(x?.(e.id,G,true),e.segments&&e.segments.length>0&&ye!==null){let K=at-Be;L(K);}}else if(c==="resize-start"){let Oe=We.x,at=q(Oe),G=t+r-at;G>=s&&(I(at),N(G));}else if(c==="resize-end"){let Oe=We.x,G=q(Oe)-t;G>=s&&N(G);}},[c,t,r,s,w,e,q,ye,Be,je,ne,$,I,N,L,x,tt]),Ue=react.useCallback(()=>{if(g.current&&(window.clearInterval(g.current),g.current=null),k.current=null,c!=="none"){if(c==="connect")j&&f&&f(e,j),$(null),ne(null);else {let X=e.endDate.getTime()-e.startDate.getTime(),Te,Ce,We=true;if(c==="move"){if(Te=Q(v),Ce=new Date(Te.getTime()+X),e.segments&&e.segments.length>0&&ye!==null){let Oe=Math.round(O/s),at=e.segments.map((Ke,Ie)=>{if(Ie===ye){let z=new Date(Ke.startDate),de=new Date(Ke.endDate);return z.setDate(z.getDate()+Oe),de.setDate(de.getDate()+Oe),{startDate:z,endDate:de}}return Ke}),G=at.flatMap(Ke=>[Ke.startDate,Ke.endDate]),K=new Date(Math.min(...G.map(Ke=>Ke.getTime()))),he=new Date(Math.max(...G.map(Ke=>Ke.getTime())));l?.({...e,segments:at},K,he),Je(t,r);return}}else c==="resize-start"?(Te=Q(v),Ce=e.endDate,Te>Ce&&(console.warn("Invalid date range: start date must be before or equal to end date"),We=false)):c==="resize-end"?(Te=e.startDate,Ce=Q(v+F),Ce<Te&&(console.warn("Invalid date range: end date must be after or equal to start date"),We=false)):We=false;We&&Te&&Ce&&(Ce.getTime()<Te.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,Te,Ce));}x?.(e.id,0,false),Je(t,r);}},[c,v,F,e,l,j,f,t,r,s,Q,O,ye,Je,x]);react.useEffect(()=>{if(c==="none")return;let X=Ce=>{lt(Ce);},Te=()=>{Ue();};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",Te),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",Te),g.current&&(window.clearInterval(g.current),g.current=null);}},[c,lt,Ue]);let qe=me&&!te?v:t,ae=me&&!te?F:r,S=m.taskClass(e);return jsxRuntime.jsxs("g",{ref:b,"data-task-bar":"true",onClick:()=>!me&&u?.(e),onDoubleClick:X=>{me||(X.stopPropagation(),i?.(e));},onContextMenu:X=>{X.preventDefault(),p?.(e,X);},onMouseEnter:()=>!me&&fe(true),onMouseLeave:()=>{me||(fe(false),se(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:ke,fill:"transparent",style:{pointerEvents:"all"}}),ce&&!me&&!Se&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:ie,height:ke,fill:re==="resize-start"?o.accent:"transparent",opacity:re==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>se("resize-start"),onMouseDown:X=>Re(X,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ie,y:a,width:r-ie*2,height:ke,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>se("move"),onMouseDown:X=>Re(X,"move")}),jsxRuntime.jsx("rect",{x:t+r-ie,y:a,width:ie,height:ke,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>se("resize-end"),onMouseDown:X=>Re(X,"resize-end")})]}),ce&&!me&&He&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ke,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>se("move"),onMouseDown:X=>Re(X,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ke,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>se("resize-end"),onMouseDown:X=>Re(X,"resize-end")}),ce&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ke-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),me&&!te&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:v,y:a,width:F,height:ke,rx:Qe,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:qe,y:a,width:ae,height:ke,rx:Qe,fill:Ye,"data-task-class":S,initial:{opacity:0,scale:.95},animate:{opacity:me&&!te?.15:e.parentId?.6:ce?.9:.8,scale:ce&&!me?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:X=>Re(X),style:{cursor:me?te?"crosshair":Le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:qe,y:a,width:ae*(e.progress/100),height:ke,rx:Qe,fill:Ye,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((X,Te)=>{let Ce=(X.startDate.getTime()-n.getTime())/864e5*s,Oe=(X.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Ce+s,at=me&&c==="move"&&ye===Te,G=_===Te,K=at?Ce+O:Ce;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!me&&J(Te),onMouseLeave:()=>!me&&J(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:K,y:a,width:Oe,height:ke,rx:Qe,fill:Ye,initial:{opacity:0,scale:.95},animate:{opacity:at||e.parentId?.6:G?.9:.8,scale:G&&!me?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:he=>{he.stopPropagation(),be(Te),A(Ce),Re(he,void 0,Ce);},style:{cursor:me?te?"crosshair":Le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:K,y:a,width:Oe*(e.progress/100),height:ke,rx:Qe,fill:Ye,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Te}`)}),et&&(ct||ft)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ft&&!ct&&jsxRuntime.jsx("rect",{x:qe,y:a,width:ae,height:ke,rx:Qe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ct&&jsxRuntime.jsx("rect",{x:qe,y:a,width:ae,height:ke,rx:Qe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ae>60&&!e.segments&&(()=>{let X=m.taskLabel(e),Te=typeof X=="string"?X:e.name,Ce=Te.length>Math.floor(ae/8)?`${Te.substring(0,Math.floor(ae/8))}...`:Te;return jsxRuntime.jsx("text",{x:qe+12,y:a+ke/2,dominantBaseline:"middle",fill:wt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:wt?"line-through":"none"},children:Ce})})(),ae>100&&e.progress>0&&e.progress<100&&!me&&!e.segments&&jsxRuntime.jsxs("text",{x:qe+ae-12,y:a+ke/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&&ae>80&&!me&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:qe+ae-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:qe+ae-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ce||Le)&&!te&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:qe-2,y:a,width:16,height:ke,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>se("resize-start"),onMouseLeave:()=>se(null),onMouseDown:X=>{X.stopPropagation(),Re(X,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:qe+4,y:a+8,width:3,height:ke-16,rx:1.5,fill:re==="resize-start"||c==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:qe+ae-14,y:a,width:16,height:ke,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>se("resize-end"),onMouseLeave:()=>se(null),onMouseDown:X=>{X.stopPropagation(),Re(X,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:qe+ae-7,y:a+8,width:3,height:ke-16,rx:1.5,fill:re==="resize-end"||c==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ce&&!me&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+ke/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>se("connect"),onMouseLeave:()=>se(null),onMouseDown:X=>{X.stopPropagation(),Re(X,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+ke/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:re==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),te&&U&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ke/2,x2:U.x,y2:U.y,stroke:j?o.statusCompleted:o.accent,strokeWidth:j?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:j?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:U.x,cy:U.y,r:j?8:6,fill:j?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),j&&jsxRuntime.jsx(framerMotion.motion.text,{x:U.x+15,y:U.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:U.x+10},animate:{opacity:1,x:U.x+15},transition:{duration:.2},children:"Connect"})]}),(ce||me)&&!te&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:qe-2,y:a-2,width:ae+4,height:ke+4,rx:Qe+2,fill:"none",stroke:me?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:me?.6:.4,initial:{opacity:0},animate:{opacity:me?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:v,y1:0,x2:v,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:v+F,y1:0,x2:v+F,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ce&&!me&&!e.segments&&!C&&(()=>{let Ce=a<100,We=Ce?a+ke+13:a-82-13,Oe=Ce?`M ${qe+ae/2-6} ${a+ke+3} L ${qe+ae/2} ${a+ke+13} L ${qe+ae/2+6} ${a+ke+3}`:`M ${qe+ae/2-6} ${a-13} L ${qe+ae/2} ${a-3} L ${qe+ae/2+6} ${a-13}`,at=We+22,G=We+40,K=We+55,he=We+70,Ke=Ce?We+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Ce?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Ce?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Oe,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:qe+ae/2-120,y:We,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:qe+ae/2,y:at,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:qe+ae/2-110,y:G,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:qe+ae/2-70,y:G,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ze(e.startDate)}),jsxRuntime.jsx("text",{x:qe+ae/2-110,y:K,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:qe+ae/2-70,y:K,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ze(e.endDate)}),jsxRuntime.jsx("text",{x:qe+ae/2+10,y:G,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:qe+ae/2+65,y:G,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:bt()}),jsxRuntime.jsx("text",{x:qe+ae/2+10,y:K,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:qe+ae/2+65,y:K,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:qe+ae/2-110,y:he,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:qe+ae/2-50,y:he,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Ie=>Ie.name).join(", ").substring(0,30),e.assignees.map(Ie=>Ie.name).join(", ").length>30?"...":""]})]}),!Ce&&jsxRuntime.jsx("text",{x:qe+ae/2,y:Ke,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:He?"Left: move \u2022 Right: resize":Se?"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 am({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:m}=e,u=82,i=13,p=m?o+n+i:o-u-i,l=m?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,f=p+22,y=p+40,x=p+55,C=p+70,h=c=>c.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let c=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${c} day${c!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:m?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:m?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:p,width:240,height:u,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:f,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,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y,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:x,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:x,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,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:b()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:x,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:x,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(c=>c.name).join(", ").substring(0,30),a.assignees.map(c=>c.name).join(", ").length>30?"...":""]})]})]})})}function Zn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:m=false}){let[u,i]=react.useState(false),[p,l]=react.useState(null),f=r-t,y=f>0,x=Math.abs(f)<5,h=5,b=20,g=!x&&a<=e,k,c;if(x)if(c=(e+a)/2,n==="squared")k=`M ${e} ${t} L ${a} ${r}`;else {let re=Math.min(Math.abs(a-e)/3,30);k=`M ${e} ${t} C ${e+re} ${t}, ${a-re} ${r}, ${a} ${r}`;}else if(c=a-b,g){let se=e+15,ye=a-b,be=y?t+20:t-20;c=ye,n==="squared"?k=`M ${e} ${t} L ${se} ${t} L ${se} ${be} L ${ye} ${be} L ${ye} ${r} L ${a} ${r}`:y?k=`M ${e} ${t} L ${se-h} ${t} Q ${se} ${t} ${se} ${t+h} L ${se} ${be-h} Q ${se} ${be} ${se-h} ${be} L ${ye+h} ${be} Q ${ye} ${be} ${ye} ${be+h} L ${ye} ${r-h} Q ${ye} ${r} ${ye+h} ${r} L ${a} ${r}`:k=`M ${e} ${t} L ${se-h} ${t} Q ${se} ${t} ${se} ${t-h} L ${se} ${be+h} Q ${se} ${be} ${se-h} ${be} L ${ye+h} ${be} Q ${ye} ${be} ${ye} ${be-h} L ${ye} ${r+h} Q ${ye} ${r} ${ye+h} ${r} L ${a} ${r}`;}else n==="squared"?k=`M ${e} ${t} L ${c} ${t} L ${c} ${r} L ${a} ${r}`:y?k=`M ${e} ${t} L ${c-h} ${t} Q ${c} ${t} ${c} ${t+h} L ${c} ${r-h} Q ${c} ${r} ${c+h} ${r} L ${a} ${r}`:k=`M ${e} ${t} L ${c-h} ${t} Q ${c} ${t} ${c} ${t-h} L ${c} ${r+h} Q ${c} ${r} ${c+h} ${r} L ${a} ${r}`;let T=5,w=`M ${a} ${r} L ${a-T} ${r-T*.5} M ${a} ${r} L ${a-T} ${r+T*.5}`,R=o.dependency,v=o.dependencyHover||R,I="#f87171",F="rgba(248, 113, 113, 0.15)",N=c,U=(t+r)/2;if(p)if(x)N=Math.max(e+10,Math.min(a-10,p.x)),U=t;else if(g){let re=e+15,se=a-b,ye=y?t+20:t-20,be=[[e,t,re,t],[re,t,re,ye],[re,ye,se,ye],[se,ye,se,r],[se,r,a,r]],Be=1/0,A={x:N,y:U};for(let O of be){let L=$(p.x,p.y,O[0],O[1],O[2],O[3]),_=Math.hypot(p.x-L.x,p.y-L.y);_<Be&&(Be=_,A=L);}N=A.x,U=A.y;}else {let re=[[e,t,c,t],[c,t,c,r],[c,r,a,r]],se=1/0,ye={x:N,y:U};for(let be of re){let Be=$(p.x,p.y,be[0],be[1],be[2],be[3]),A=Math.hypot(p.x-Be.x,p.y-Be.y);A<se&&(se=A,ye=Be);}N=ye.x,U=ye.y;}function $(re,se,ye,be,Be,A){let O=Be-ye,L=A-be,_=O*O+L*L;if(_===0)return {x:ye,y:be};let J=((re-ye)*O+(se-be)*L)/_;return J=Math.max(0,Math.min(1,J)),{x:ye+J*O,y:be+J*L}}let j=re=>{let se=re.currentTarget.ownerSVGElement;if(!se)return;let ye=se.getBoundingClientRect();l({x:re.clientX-ye.left,y:re.clientY-ye.top});},ne=()=>{i(false),l(null);};return m?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:ne,onMouseMove:j,children:[jsxRuntime.jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:v,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:v,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:w,fill:"none",stroke:v,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:v,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:re=>{re.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:N,cy:U,r:9,fill:F,stroke:I,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:U-3,x2:N+3,y2:U+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:U-3,x2:N-3,y2:U+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:ne,onMouseMove:j,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:k,fill:"none",stroke:u?v:R,strokeWidth:u?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:w,fill:"none",stroke:u?v:R,strokeWidth:u?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:u?4:3,fill:u?v:R,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),u&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:re=>{re.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:N,cy:U,r:9,fill:F,stroke:I,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:U-3,x2:N+3,y2:U+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:U-3,x2:N-3,y2:U+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function es({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),m=16,u=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:m+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-m/2,y:a+16-m/2,width:m,height:m,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(m+4)/2,y:a+16-(m+4)/2,width:m+4,height:m+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:u(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 ve={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,m=new Set,u=i=>{if(!n.has(i)){n.add(i),m.add(i);let p=r.get(i)||[];for(let l of p){if(!n.has(l)&&u(l))return true;if(m.has(l))return true}}return m.delete(i),false};return u(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=ve.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ve.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ve.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=ve.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=ve.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=ve.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)=>ve.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=ve.findTaskById(e,t);return !a||!a.dependencies?[]:ve.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>ve.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>ve.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=ve.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=>ve.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=ve.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],m=s.map(u=>{let i=u.startDate&&u.endDate?ve.calculateDuration(u.startDate,u.endDate):0;return [u.name,u.startDate?ve.formatDate(u.startDate):"N/A",u.endDate?ve.formatDate(u.endDate):"N/A",i>0?`${i} days`:"N/A",`${u.progress}%`,u.status||"N/A"]});r(o,{head:n,body:m,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=ve.flattenTasks(e).map(u=>{let i=u.startDate&&u.endDate?ve.calculateDuration(u.startDate,u.endDate):0;return {"Task ID":u.id,"Task Name":u.name,"Start Date":u.startDate?ve.formatDate(u.startDate):"","End Date":u.endDate?ve.formatDate(u.endDate):"","Duration (days)":i>0?i:"","Progress (%)":u.progress,Status:u.status||"",Assignees:u.assignees?.map(p=>p.name).join(", ")||"",Dependencies:u.dependencies?.join(", ")||"","Is Milestone":u.isMilestone?"Yes":"No","Parent ID":u.parentId||"",Level:u.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let m=a.utils.book_new();a.utils.book_append_sheet(m,s,"Gantt Tasks"),a.writeFile(m,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=ve.flattenTasks(e),o=new Map;r.forEach((f,y)=>{o.set(f.id,y+1);});let s=f=>f.toISOString().replace("Z",""),n=ve.getEarliestStartDate(e)||new Date,m=ve.getLatestEndDate(e)||new Date,u=r.map((f,y)=>{let x=o.get(f.id),C=f.startDate&&f.endDate?ve.calculateDuration(f.startDate,f.endDate):0,h=(f.dependencies||[]).filter(b=>o.has(b)).map(b=>`
111
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Ti({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);},u=e.reduce((i,p)=>{let d=p.category||"Other";return i[d]||(i[d]=[]),i[d].push(p),i},{});return jsxRuntime.jsxs("div",{className:l("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:l("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref: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(u).map(([i,p])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:p.map(d=>jsxRuntime.jsxs("button",{onClick:()=>m(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Di({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,m]=react.useState("export"),[u,i]=react.useState("json"),[p,d]=react.useState(null),g=react.useRef(null);if(!t)return null;let y=async()=>{let k=o?.current||void 0,h=await fd(e,u,k);bd(h,u);},w=async k=>{let h=k.target.files?.[0];if(h){try{let b=await vd(h),x=h.name.endsWith(".json")?"json":"csv",f=yd(b,x);d(f),f.success&&r&&r(f,b);}catch(b){d({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}g.current&&(g.current.value="");}};return jsxRuntime.jsxs("div",{className:l("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>m("export"),className:l("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>m("import"),className:l("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(k=>jsxRuntime.jsxs("button",{onClick:()=>i(k),className:l("p-4 rounded-lg border-2 transition-all text-center",u===k?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[k==="json"&&"\u{1F4C4}",k==="csv"&&"\u{1F4CA}",k==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:k})]},k))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:y,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:g,type:"file",accept:".json,.csv",onChange:w,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"})]})]}),p&&jsxRuntime.jsxs("div",{className:l("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:l("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((k,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",k]},h))})]})]})]})]})]})}var I0=["URGENT","HIGH","MEDIUM","LOW"],B0=[{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"}],R0=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Si({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:m,availableUsers:u=[],availableLabels:i=[],availableColumns:p=[],showQuickFilters:d=true,compact:g=false,groupBy:y="none",onGroupByChange:w}){let[k,h]=react.useState(true),b=react.useCallback(D=>{a({search:D.target.value});},[a]),x=react.useCallback(D=>{a({dateFilter:D.target.value});},[a]),f=react.useCallback(D=>{r({by:D.target.value});},[r]),c=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),C=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":""} ${k?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!k),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:k?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter: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:k?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),C&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!k&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),m&&jsxRuntime.jsx("button",{onClick:m,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:x,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 T=D.target.value;a({priorities:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),I0.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),u.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let T=D.target.value;a({assignees:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),u.map(D=>jsxRuntime.jsx("option",{value:D.id,children:D.name},D.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let T=D.target.value;a({labels:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.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:f,className:"filter-bar__select filter-bar__select--sm",children:B0.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),w&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:y,onChange:D=>w(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:R0.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))})}),C&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Ei({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:m,onExportGanttCSV:u}){let[i,p]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let y=w=>{d.current&&!d.current.contains(w.target)&&p(false);};return i&&document.addEventListener("mousedown",y),()=>{document.removeEventListener("mousedown",y);}},[i]);let g=y=>{y(),p(false);};return jsxRuntime.jsxs("div",{className:l("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",y.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",y.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>g(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>g(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>g(async()=>await m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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(()=>u?.()),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:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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 Pi={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"}},Mi={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"}},Ai={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"}},uo={dark:Pi,light:Mi,neutral:Ai},Hn="dark";var Wn=react.createContext(void 0),j0="asakaa-theme";function Bc({children:e,defaultTheme:t=Hn,storageKey:a=j0}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let m=localStorage.getItem(a);if(m&&(m==="dark"||m==="light"||m==="neutral"))return m}return t}),s=react.useCallback(m=>{o(m),typeof window<"u"&&localStorage.setItem(a,m);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let m=document.documentElement,u=uo[r];Object.entries(u.colors).forEach(([p,d])=>{d&&m.style.setProperty(`--theme-${K0(p)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,d])=>{let g=u.colors[p];g&&m.style.setProperty(d,g);}),m.setAttribute("data-theme",r),m.classList.remove("theme-dark","theme-light","theme-neutral"),m.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:uo};return jsxRuntime.jsx(Wn.Provider,{value:n,children:e})}function Fo(){let e=react.useContext(Wn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function K0(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Fi({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Fo();return e?jsxRuntime.jsxs("div",{className:l("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(uo).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:l("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Rc(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return tt[e]||tt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",tt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",tt[e].bgSecondary),bgGrid:r("--theme-bg-card",tt[e].bgGrid),bgWeekend:r("--theme-bg-hover",tt[e].bgWeekend),border:r("--theme-border-primary",tt[e].border),borderLight:r("--theme-border-subtle",tt[e].borderLight),textPrimary:r("--theme-text-primary",tt[e].textPrimary),textSecondary:r("--theme-text-secondary",tt[e].textSecondary),textTertiary:r("--theme-text-tertiary",tt[e].textTertiary),accent:r("--theme-accent-primary",tt[e].accent),accentHover:r("--theme-accent-hover",tt[e].accentHover),accentLight:r("--theme-accent-primary",tt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",tt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",tt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",tt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",tt[e].dependency),dependencyHover:r("--theme-border-secondary",tt[e].dependencyHover),criticalPath:r("--theme-error",tt[e].criticalPath),criticalPathLight:r("--theme-error",tt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",tt[e].today):e==="neutral"?r("--theme-text-primary",tt[e].today):r("--theme-error",tt[e].today),todayLight:e==="light"?r("--theme-accent-primary",tt[e].todayLight):e==="neutral"?r("--theme-text-primary",tt[e].todayLight):r("--theme-error",tt[e].todayLight),milestone:r("--theme-warning",tt[e].milestone),milestoneLight:r("--theme-warning",tt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",tt[e].statusTodo),statusInProgress:r("--theme-accent-primary",tt[e].statusInProgress),statusCompleted:r("--theme-success",tt[e].statusCompleted),hoverBg:r("--theme-bg-hover",tt[e].hoverBg),focusRing:r("--theme-accent-primary",tt[e].focusRing)}}var Gn={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Oc={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Li={en:Gn,es:Oc};function $c(e){return Li[e]||Li.en}function Ii(e,t){let a=$c(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 Io=react.createContext(Gn);function Kr(){return react.useContext(Io)}function gb({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[m,u]=react.useState(false),[i,p]=react.useState(null),d=react.useRef(null),g=Kr();if(react.useEffect(()=>{let h=b=>{d.current&&!d.current.contains(b.target)&&u(false);};return m&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[m]),!(t||a||r||o||s||n))return null;let w=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(h=>h.handler),k=async(h,b)=>{if(b){p(h);try{await b();}catch(x){console.error(`Export ${h} failed:`,x);}finally{p(null),u(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(!m),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?e.accent:e.bgSecondary,border:`1px solid ${m?e.accent:e.borderLight}`,color:m?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:g.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:m?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:w.map((h,b)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>k(h.id,h.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<w.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===h.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):h.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})})]})}function fb({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function bb({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 hb({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Kr();react.useEffect(()=>{let i=p=>{s.current&&!s.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],u=m.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${u}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:m.map((i,p)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:p<m.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function yb({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),m=react.useRef(null),u=Kr();react.useEffect(()=>{if(!s)return;let g=setTimeout(()=>{let y=k=>{m.current&&!m.current.contains(k.target)&&n(false);},w=k=>{k.key==="Escape"&&n(false);};document.addEventListener("mousedown",y),document.addEventListener("keydown",w),m._cleanup=()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",w);};},100);return ()=>{clearTimeout(g),m._cleanup&&m._cleanup();}},[s]);let i=[{value:"all",label:u.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:u.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:u.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:u.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=t!=="all"||r,d=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:g=>{g.stopPropagation(),n(y=>!y);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:p?d?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${p?d?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:p?"#3B82F6":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:u.toolbar.filter||"Filters"}),p&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:d?"#0F1117":"#FFFFFF",border:`1px solid ${d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:d?"#6B7280":"#9CA3AF"},children:u.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-2",children:i.map(g=>{let y=t===g.value&&!r,w=()=>g.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(g.value),o&&o(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:y?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${y?g.color:"text-gray-400"} flex-shrink-0`,children:w()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:g.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]},g.value)})}),jsxRuntime.jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all");},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?d?"#3B82F6":"#2563EB":d?"#6B7280":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:u.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]})})]})})]})}function Vn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:m,onRowDensityChange:u,showThemeSelector:i=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:g,taskFilter:y="all",onTaskFilterChange:w,hideCompleted:k=false,onHideCompletedChange:h,onExportPNG:b,onExportPDF:x,onExportExcel:f,onExportCSV:c,onExportJSON:C,onExportMSProject:D}){let T=Kr(),v=b||x||f||c||C||D,I=[{value:"day",label:T.toolbar.day},{value:"week",label:T.toolbar.week},{value:"month",label:T.toolbar.month}],B=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(bb,{options:I,value:t,onChange:N=>a(N),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(hb,{theme:e,value:m,onChange:u}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(yb,{theme:e,value:y,onChange:w,hideCompleted:k,onHideCompletedChange:h})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:g,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||T.toolbar.createTask})]}),(v||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(gb,{theme:e,onExportPNG:b,onExportPDF:x,onExportExcel:f,onExportCSV:c,onExportJSON:C,onExportMSProject:D}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(fb,{options:B,value:s,onChange:N=>n(N),theme:e})]})]})}function jn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),m=react.useRef(null),u=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=d=>{m.current&&!m.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let i=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:u,onClick:()=>{if(!r&&u.current){let p=u.current.getBoundingClientRect();n({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(bt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:m,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function Bo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[m,u]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,d=r.length*36+8,g=8,y=window.innerWidth,w=window.innerHeight,k=t,h=a;t+p+g>y&&(k=t-p,k<g&&(k=g)),a+d+g>w&&(h=w-d-g,h<g&&(h=g)),u({x:k,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=g=>{n.current&&!n.current.contains(g.target)&&o();},d=g=>{g.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${m.x}px`,top:`${m.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:d=>{p.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var _t={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Kc({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:m,onTaskOutdent:u,onTaskRename:i,onTaskToggleExpand:p,onOpenTaskModal:d,enableKeyboard:g=true}){let y=react.useRef(false),w=react.useCallback(f=>{y.current=f;},[]),k=react.useCallback(f=>{let c=[],C=D=>{for(let T of D)c.push(T),T.subtasks&&T.subtasks.length>0&&T.isExpanded&&C(T.subtasks);};return C(f),c},[]),h=react.useCallback(()=>{let f=k(e);for(let c of f)if(t.has(c.id))return c;return null},[e,t,k]),b=react.useCallback((f,c)=>{let C=k(e);if(C.length===0)return;let D=h();if(!D){a(C[0].id,false);return}let T=C.findIndex(B=>B.id===D.id);if(T===-1)return;let v=f==="up"?T-1:T+1;if(v<0||v>=C.length)return;let I=C[v];a(I.id,c);},[e,h,k,a]),x=react.useCallback(f=>{if(!g)return;let c=f.target;if(c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable||y.current){f.key==="Escape"&&(c.blur(),y.current=false);return}let T=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,v=Array.from(t),I=h();if(f.key==="ArrowUp"){f.preventDefault(),b("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),b("down",f.shiftKey);return}if(I&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){I.subtasks&&I.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!I.isExpanded||f.key==="ArrowLeft"&&I.isExpanded)&&p(I.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){v.length>0&&(f.preventDefault(),n(v,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){v.length>0&&(f.preventDefault(),m(v));return}if(f.key==="Tab"&&f.shiftKey){v.length>0&&(f.preventDefault(),u(v));return}if(f.key==="Enter"&&!f.shiftKey&&!T){I&&(f.preventDefault(),r(I.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!T){I&&(f.preventDefault(),r(I.id,"above"));return}if(f.key==="Enter"&&T){I&&(f.preventDefault(),d(I.id));return}if(f.key==="F2"){I&&(f.preventDefault(),i(I.id));return}if(f.key==="Delete"||f.key==="Backspace"&&T){v.length>0&&(f.preventDefault(),o(v));return}if(f.key==="d"&&T&&!f.shiftKey){v.length>0&&(f.preventDefault(),s(v));return}},[g,t,h,b,r,o,s,n,m,u,i,p,d]);return react.useEffect(()=>{if(g)return window.addEventListener("keydown",x),()=>{window.removeEventListener("keydown",x);}},[g,x]),{setIsEditing:w}}function qc(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(g=>{let y=new Set(g);return y.has(d)?y.delete(d):y.add(d),y}),r(d);},[]),n=react.useCallback((d,g)=>{if(!a){o(d);return}let y=g.indexOf(a),w=g.indexOf(d);if(y===-1||w===-1){o(d);return}let k=Math.min(y,w),h=Math.max(y,w),b=g.slice(k,h+1);t(new Set(b)),r(d);},[a,o]),m=react.useCallback((d,g,y,w)=>{w?n(d,g):y?s(d):o(d);},[o,s,n]),u=react.useCallback((d,g)=>{g?t(y=>{let w=new Set(y);return w.add(d),w}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:m,handleKeyboardSelection:u,clearSelection:i,isTaskSelected:p}}function Ro(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let m={...r[n],parentId:o,level:s,position:n};t.push(m),m.subtasks&&m.subtasks.length>0&&m.isExpanded&&a(m.subtasks,m.id,s+1);}};return a(e),t}function Xc(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Xc(a.subtasks,t);if(r)return r}}return null}function Hi(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Hi(a.subtasks,t);if(r)return r}return null}function Wi(e,t){if(t.length===0)return e;let a=Ro(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,g)=>{let y=[];return {tasks:d.filter(k=>{if(g.has(k.id))return y.push(k),false;if(k.subtasks){let h=n(k.subtasks,g);k.subtasks=h.tasks,y.push(...h.removed);}return true}),removed:y}},m=(d,g,y)=>d.map(w=>w.id===g?{...w,subtasks:[...w.subtasks||[],...y],isExpanded:true}:w.subtasks?{...w,subtasks:m(w.subtasks,g,y)}:w),u=new Set(t),{tasks:i,removed:p}=n(e,u);return m(i,s.id,p)}function Gi(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Hi(a,r);if(!o)continue;let s=Hi(a,o.id),n=(i,p,d)=>{for(let g=0;g<i.length;g++){let y=i[g];if(y.id===p&&y.subtasks){let w=y.subtasks.findIndex(k=>k.id===d);if(w!==-1){let[k]=y.subtasks.splice(w,1);return k}}if(y.subtasks){let w=n(y.subtasks,p,d);if(w)return w}}return null},m=(i,p,d)=>{let g=i.findIndex(y=>y.id===p);if(g!==-1)return i.splice(g+1,0,d),i;for(let y of i)y.subtasks&&m(y.subtasks,p,d);return i},u=n(a,o.id,r);u&&(s&&s.subtasks?m(s.subtasks,o.id,u):m(a,o.id,u));}return a}function _i(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,m,u)=>{let i=n.findIndex(d=>d.id===m);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,m,u))return true;return false}let p=u==="up"?i-1:i+1;return p<0||p>=n.length?false:([n[i],n[p]]=[n[p],n[i]],true)};return s(r,o,a),r}function Vi(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 ji(e,t){let a=[...e];for(let r of t){let o=n=>{let m=n.findIndex(p=>p.id===r);if(m===-1){for(let p of n)if(p.subtasks&&o(p.subtasks))return true;return false}let u=n[m],i={...u,id:`${u.id}-copy-${Date.now()}`,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks):void 0};return n.splice(m+1,0,i),true},s=n=>n.map(m=>({...m,id:`${m.id}-copy-${Date.now()}`,subtasks:m.subtasks?s(m.subtasks):void 0}));o(a);}return a}function Jc(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},m=u=>{let i=u.findIndex(d=>d.id===t);if(i===-1){for(let d of u)if(d.subtasks&&m(d.subtasks))return true;return false}let p=a==="above"?i:i+1;return u.splice(p,0,n),true};return m(r),{tasks:r,newTask:n}}function Ki(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Ki(r.subtasks,t,a)}:r)}function Yi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Yi(a.subtasks,t)}:a)}function qi(e,t){let a=p=>{for(let d of p){if(d.id===t)return d;if(d.subtasks){let g=a(d.subtasks);if(g)return g}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,m=r?.endDate||s,u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(m),color:r?.color||"#3B82F6"},i=p=>p.map(d=>{if(d.id===t){let g=d.subtasks||[];return {...d,subtasks:[...g,u],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:u}}function Zc(e,t,a,r){if(t===a)return e;let o=Xc(e,t);if(!o)return e;if(a){let m=(u,i)=>{if(!u.subtasks)return false;for(let p of u.subtasks)if(p.id===i||m(p,i))return true;return false};if(m(o,a))return e}let s=m=>m.filter(u=>u.id!==t).map(u=>u.subtasks&&u.subtasks.length>0?{...u,subtasks:s(u.subtasks)}:u),n=s(e);if(a===null){let m=r!==void 0?r:n.length;n.splice(m,0,{...o,parentId:void 0});}else {let m=u=>u.map(i=>{if(i.id===a){let p=i.subtasks||[],d=r!==void 0?r:p.length,g=[...p];return g.splice(d,0,{...o,parentId:a}),{...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:m(i.subtasks)}:i});n=m(n);}return n}function qn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:m,onTaskToggle:u,scrollTop:i,columns:p,onToggleColumn:d,onColumnResize:g,onTaskUpdate:y,onTaskIndent:w,onTaskOutdent:k,onTaskMove:h,onMultiTaskDelete:b,onTaskDuplicate:x,onTaskCreate:f,onTaskRename:c,onCreateSubtask:C,onOpenTaskModal:D,onDeleteRequest:T,onTaskReparent:v}){let I=react.useContext(Io),[B,N]=react.useState(null),[G,H]=react.useState(null),[Y,le]=react.useState(""),re=react.useRef(null),[oe,be]=react.useState(null),[ve,Be]=react.useState(0),[L,$]=react.useState(0),[S,R]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[K,se]=react.useState(null),[pe,me]=react.useState(null),[Le,Z]=react.useState(null),Ze=react.useRef(0),Ne=5,Xe=react.useRef(false),[pt,wt]=react.useState(null),[Qe,gt]=react.useState(false),[Nt,Pt]=react.useState(null),[it,O]=react.useState(false),ce=react.useRef(null);react.useEffect(()=>{function z(j){ce.current&&!ce.current.contains(j.target)&&O(false);}if(it)return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[it]),react.useEffect(()=>{G&&re.current&&(re.current.focus(),re.current.select());},[G]),react.useEffect(()=>{if(!oe)return;let z=ge=>{let Ie=ge.clientX-ve,Te=L+Ie;g?.(oe,Te);},j=()=>{be(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",z),document.addEventListener("mouseup",j),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",j),document.body.style.cursor="",document.body.style.userSelect="";}},[oe,ve,L,g]);let{selectedTaskIds:we,handleTaskClick:$e,isTaskSelected:Ke}=qc(),{setIsEditing:ft}=Kc({tasks:e,selectedTaskIds:we,onTaskSelect:(z,j)=>{let Ie=Ro(e).map(Te=>Te.id);$e(z,Ie,j||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:x||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:w||(()=>{}),onTaskOutdent:k||(()=>{}),onTaskRename:z=>{let j=Ro(e).find(ge=>ge.id===z);j&&st(j);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:z=>{let j=Ro(e).find(ge=>ge.id===z);j&&D&&D(j);},enableKeyboard:true}),X=(z,j=0)=>{let ge=[];for(let Ie of z)ge.push({task:Ie,level:j}),Ie.subtasks&&Ie.subtasks.length>0&&Ie.isExpanded&&ge.push(...X(Ie.subtasks,j+1));return ge},te=X(e),Ye=48,ze=Math.max(te.length*a,600-Ye),et=z=>!z.startDate||!z.endDate?"-":`${Math.ceil((z.endDate.getTime()-z.startDate.getTime())/(1e3*60*60*24))}d`,st=z=>{H(z.id),le(z.name),ft(true);},Re=z=>{Y.trim()&&Y!==e.find(j=>j.id===z)?.name&&c?.(z,Y.trim()),H(null),le(""),ft(false);},qe=()=>{H(null),le(""),ft(false);},ne=(z,j)=>{j.stopPropagation(),C?.(z.id);},Ge=(z,j)=>{j.preventDefault(),Ze.current=j.clientY,se(z),Xe.current=false,gt(false),wt({x:j.clientX,y:j.clientY});},ca=z=>{if(!K||(Math.abs(z.clientY-Ze.current)>Ne&&!Xe.current&&(Xe.current=true,gt(true)),wt({x:z.clientX,y:z.clientY}),!Xe.current))return;let ge=document.querySelectorAll("[data-task-row]"),Ie=null,Te=null;ge.forEach(U=>{let ae=U.getBoundingClientRect(),Ue=U.getAttribute("data-task-row");if(Ue&&Ue!==K&&z.clientY>=ae.top&&z.clientY<=ae.bottom){Ie=Ue;let Dt=z.clientY-ae.top,dt=ae.height;Dt<dt*.25?Te="above":Dt>dt*.75?Te="below":Te="child";}}),me(Ie),Z(Te);},ue=()=>{if(Xe.current&&K&&pe&&Le){if(Le==="child")v?.(K,pe);else if(Le==="above"||Le==="below"){let z=(Ie,Te,U=null)=>{for(let ae of Ie){if(ae.id===Te)return U;if(ae.subtasks){let Ue=z(ae.subtasks,Te,ae.id);if(Ue!==void 0)return Ue}}},j=z(e,pe,null),ge=(Ie,Te)=>{let U=Ie.findIndex(ae=>ae.id===Te);return Le==="below"?U+1:U};if(j===null){let Ie=ge(e,pe);v?.(K,null,Ie);}else {let Ie=te.find(Te=>Te.task.id===j)?.task;if(Ie?.subtasks){let Te=ge(Ie.subtasks,pe);v?.(K,j,Te);}}}}se(null),me(null),Z(null),wt(null),Xe.current=false,gt(false);};react.useEffect(()=>{if(K)return document.addEventListener("mousemove",ca),document.addEventListener("mouseup",ue),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ca),document.removeEventListener("mouseup",ue),document.body.style.cursor="",document.body.style.userSelect="";}},[K,pe,Le]);let Ve=(z,j,ge)=>{switch(z.id){case "name":let Ie=G===j.id,Te=B===j.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ge*20}px`},children:[v&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:Te?1:.3},onMouseDown:_=>Ge(j.id,_),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),j.subtasks&&j.subtasks.length>0?jsxRuntime.jsx("button",{onClick:_=>{_.stopPropagation(),u?.(j.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:j.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:j.color||"#3B82F6",opacity:j.parentId?.6:1,borderColor:j.isMilestone?t.accent:"transparent",borderWidth:j.isMilestone?"2px":"0px"},title:j.isMilestone?"Milestone":j.parentId?"Subtask":"Task"})}),Ie?jsxRuntime.jsx("input",{ref:re,type:"text",value:Y,onChange:_=>le(_.target.value),onKeyDown:_=>{_.key==="Enter"?Re(j.id):_.key==="Escape"&&qe();},onBlur:()=>Re(j.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:_=>_.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:j.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:j.parentId?"13px":"14px",fontWeight:j.isMilestone?600:j.parentId?400:600,letterSpacing:j.parentId?"0":"-0.01em"},title:j.name,children:j.name}),Te&&!Ie&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:_=>_.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:_=>ne(j,_),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:_=>{_.stopPropagation(),st(j);},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 ae=z.id==="startDate"?"startDate":"endDate",Ue=j[ae],Dt=Nt?.taskId===j.id&&Nt?.field===ae,dt=_=>_?(typeof _=="string"?new Date(_):_).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:_=>_.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:_=>{if(Dt)Pt(null);else {let Pe=_.currentTarget.getBoundingClientRect();Pt({taskId:j.id,field:ae,month:Ue?typeof Ue=="string"?new Date(Ue):Ue:new Date,position:{top:Pe.bottom+4,left:Pe.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:dt(Ue)})]}),Dt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Pt(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:Nt?.position.top,left:Nt?.position.left},onClick:_=>_.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let _=new Date,Pe=new Date(_);Pe.setDate(_.getDate()+1);let Me=new Date(_);Me.setDate(_.getDate()+7);let Ut=new Date(_);return Ut.setDate(_.getDate()+14),[{label:"Hoy",date:_},{label:"Ma\xF1ana",date:Pe},{label:"Pr\xF3xima semana",date:Me},{label:"2 semanas",date:Ut}].map((_e,vt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:We=>We.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:We=>We.currentTarget.style.backgroundColor="transparent",onClick:()=>{y?.(j.id,{[ae]:_e.date}),Pt(null);},children:_e.label},vt))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:_=>_.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:_=>_.currentTarget.style.backgroundColor="transparent",onClick:()=>{y?.(j.id,{[ae]:void 0}),Pt(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:()=>Pt(_=>_?{..._,month:new Date(_.month.getFullYear(),_.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:Nt?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Pt(_=>_?{..._,month:new Date(_.month.getFullYear(),_.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((_,Pe)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:_},Pe))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let _=Nt?.month||new Date,Pe=_.getFullYear(),Me=_.getMonth(),Ut=new Date(Pe,Me,1).getDay(),fe=new Date(Pe,Me+1,0).getDate(),_e=new Date,vt=[];for(let ut=Ut-1;ut>=0;ut--)vt.push({day:new Date(Pe,Me,-ut).getDate(),date:new Date(Pe,Me-1,new Date(Pe,Me,-ut).getDate()),isCurrentMonth:false});for(let ut=1;ut<=fe;ut++)vt.push({day:ut,date:new Date(Pe,Me,ut),isCurrentMonth:true});let We=42-vt.length;for(let ut=1;ut<=We;ut++)vt.push({day:ut,date:new Date(Pe,Me+1,ut),isCurrentMonth:false});return vt.map((ut,wa)=>{let Ta=ut.date.toDateString()===_e.toDateString(),Je=(Ue?typeof Ue=="string"?new Date(Ue):Ue:null)?.toDateString()===ut.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:ut.isCurrentMonth?Je?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Je?"#3B82F6":"transparent",boxShadow:Ta&&!Je?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{y?.(j.id,{[ae]:ut.date}),Pt(null);},children:ut.day},wa)})})()})]})]})]}),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:et(j)})});case "assignees":let Sr=r.filter(_=>j.assignees?.some(Pe=>Pe.name===_.name||Pe.initials===_.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsxRuntime.jsx(so,{assignedUsers:Sr,availableUsers:r,onChange:_=>{let Pe=_.map(Me=>({id:Me.id,name:Me.name,initials:Me.initials,color:Me.color}));y?.(j.id,{assignees:Pe.length>0?Pe:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsxRuntime.jsx($d,{status:j.status||"todo",onChange:_=>{y?.(j.id,{status:_,progress:_==="completed"?100:j.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:`${j.progress}%`,backgroundColor:j.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:[j.progress,"%"]})]});case "priority":let fr={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},za={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},F=fr[j.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsxRuntime.jsx(oo,{priority:F,onChange:_=>{_&&y?.(j.id,{priority:za[_]||"medium"});}})});default:return null}},Oe=z=>[{id:"hide",label:"Hide Column",icon:_t.Hide,onClick:()=>d(z),disabled:z==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:_t.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:_t.SortDesc,onClick:()=>{}}],P=z=>z.subtasks&&z.subtasks.length>0?[{id:"addSubtask",label:I?.contextMenu?.addSubtask||"Add Subtask",icon:_t.Add,onClick:()=>{C?.(z.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:I?.contextMenu?.deleteTask||"Delete Task",icon:_t.Delete,onClick:()=>{T?T(z.id,z.name):b?.([z.id]);}}]:[{id:"edit",label:I?.contextMenu?.editTask||"Edit Task",icon:_t.Pencil,onClick:()=>{n?.(z);}},{id:"addSubtask",label:I?.contextMenu?.addSubtask||"Add Subtask",icon:_t.Add,onClick:()=>{C?.(z.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:I?.contextMenu?.markIncomplete||"Mark Incomplete",icon:_t.MarkIncomplete,onClick:()=>{y?.(z.id,{status:"todo",progress:0});},disabled:z.status==="todo"},{id:"setInProgress",label:I?.contextMenu?.setInProgress||"Set In Progress",icon:_t.SetInProgress,onClick:()=>{y?.(z.id,{status:"in-progress"});},disabled:z.status==="in-progress"},{id:"markComplete",label:I?.contextMenu?.markComplete||"Mark Complete",icon:_t.MarkComplete,onClick:()=>{y?.(z.id,{status:"completed",progress:100});},disabled:z.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:I?.contextMenu?.splitTask||"Split Task",icon:_t.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:I?.contextMenu?.deleteTask||"Delete Task",icon:_t.Delete,onClick:()=>{T?T(z.id,z.name):b?.([z.id]);}}],ee=p.filter(z=>z.visible),xe=ee.reduce((z,j)=>z+j.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:xe},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Ye}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:ee.map((z,j)=>{let ge=j===ee.length-1,Ie=z.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ie?"":"justify-center"}`,style:{width:`${z.width}px`,minWidth:`${z.minWidth??(Ie?200:60)}px`,maxWidth:`${z.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ge?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Te=>{Te.preventDefault(),R({isOpen:true,x:Te.clientX,y:Te.clientY,type:"header",columnId:z.id});},onMouseEnter:Te=>{Te.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Te=>{Te.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:z.label,children:z.label}),z.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:oe===z.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Te=>{Te.preventDefault(),Te.stopPropagation(),be(z.id),Be(Te.clientX),$(z.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},z.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(jn,{columns:p,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>O(!it),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"})}),it&&jsxRuntime.jsxs("div",{ref:ce,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:z=>z.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>O(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:ze},children:te.map(({task:z,level:j},ge)=>{let Ie=Ke(z.id),Te=pe===z.id,U=Te&&Le==="above",ae=Te&&Le==="below",Ue=Te&&Le==="child",Dt={};return Ue&&(Dt.backgroundColor=`${t.accent}15`,Dt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":z.id,className:`flex items-center cursor-pointer group ${K===z.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ie?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ie?t.accentLight:Ue?`${t.accent}15`:ge%2===0?t.bgPrimary:t.bgGrid,...Dt},onMouseEnter:()=>N(z.id),onMouseLeave:()=>N(null),onClick:dt=>{let fr=Ro(e).map(_=>_.id),F=navigator.platform.toUpperCase().indexOf("MAC")>=0?dt.metaKey:dt.ctrlKey;$e(z.id,fr,F,dt.shiftKey),s?.(z);},onDoubleClick:dt=>{dt.stopPropagation(),n?.(z);},onContextMenu:dt=>{dt.preventDefault(),R({isOpen:true,x:dt.clientX,y:dt.clientY,type:"task",task:z}),m?.(z,dt);},whileHover:{backgroundColor:Ie?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}}),ae&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ee.map((dt,Sr)=>{let fr=Sr===ee.length-1,za=dt.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${za?"justify-start":"justify-center"}`,style:{width:`${dt.width}px`,minWidth:`${dt.minWidth??(za?200:60)}px`,maxWidth:`${dt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:fr?"none":`1px solid ${B===z.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ve(dt,z,za?j:0)},`${z.id}-${dt.id}`)})]},z.id)})}),jsxRuntime.jsx(Bo,{isOpen:S.isOpen,x:S.x,y:S.y,items:S.type==="header"&&S.columnId?Oe(S.columnId):S.type==="task"&&S.task?P(S.task):[],onClose:()=>R({...S,isOpen:false}),theme:t}),Qe&&pt&&K&&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 z=te.find(j=>j.task.id===K)?.task;return z?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:z.name})}):null})()}),document.body)]})}function rm(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,m]=react.useState(e),[u,i]=react.useState(t),[p,d]=react.useState(null),[g,y]=react.useState(null),[w,k]=react.useState(null),[h,b]=react.useState(null),[x,f]=react.useState(0),[c,C]=react.useState(0),[D,T]=react.useState(null),[v,I]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:m,ghostWidth:u,setGhostWidth:i,connectionLine:p,setConnectionLine:d,hoveredTaskId:g,setHoveredTaskId:y,activeZone:w,setActiveZone:k,draggedSegmentIndex:h,setDraggedSegmentIndex:b,draggedSegmentStartX:x,setDraggedSegmentStartX:f,segmentDragOffsetX:c,setSegmentDragOffsetX:C,hoveredSegmentIndex:D,setHoveredSegmentIndex:T,isHovered:v,setIsHovered:I,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(Y,le)=>{r("none"),d(null),y(null),m(Y),i(le),C(0),b(null),f(0);}}}function Jn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:m,onClick:u,onDoubleClick:i,onContextMenu:p,onDateChange:d,onDependencyCreate:g,allTaskPositions:y=[],onDragMove:w,onHoverChange:k}){let h=rm(t,r),b=react.useRef(null),x=react.useRef(null),f=react.useRef(null),{dragMode:c,setDragMode:C,dragOffset:D,setDragOffset:T,ghostX:v,setGhostX:I,ghostWidth:B,setGhostWidth:N,connectionLine:G,setConnectionLine:H,hoveredTaskId:Y,setHoveredTaskId:le,activeZone:re,setActiveZone:oe,draggedSegmentIndex:be,setDraggedSegmentIndex:ve,draggedSegmentStartX:Be,setDraggedSegmentStartX:L,segmentDragOffsetX:$,setSegmentDragOffsetX:S,hoveredSegmentIndex:R,setHoveredSegmentIndex:K,isHovered:se,setIsHovered:pe,isDragging:me,isResizing:Le,isConnecting:Z,resetDragState:Ze}=h,Ne=32,Xe=8,pt=e.endDate&&e.endDate<new Date&&e.progress<100,wt=e.isCriticalPath,Qe=o.name==="neutral"||o.today==="#1C1917",gt=e.status==="completed"||e.progress===100,Nt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},it=e.isCriticalPath||pt?"#DC2626":e.color?e.color:e.priority&&Nt[e.priority]?Nt[e.priority]:o.taskBarPrimary,ce=(ue=>ue>=80?20:ue>=60?15:ue>=50?12:10)(r),we=r<50,$e=r<40;react.useEffect(()=>{if(k)if(se&&!me&&!e.segments){let ue=a<100;k({task:e,x:t,y:a,width:r,height:Ne,showBelow:ue});}else k(null);},[se,me,e,t,a,r,Ne,k]);let Ke=ue=>ue.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ft=()=>{let ue=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ue} day${ue!==1?"s":""}`},X=ue=>Math.round(ue/s)*s,te=ue=>{let Ve=Math.round(ue/s),Oe=new Date(n);return Oe.setDate(Oe.getDate()+Ve),Oe},Ye=(ue,Ve)=>{for(let Oe of y){if(Oe.id===e.id)continue;let P=5;if(ue>=Oe.x-P&&ue<=Oe.x+Oe.width+P&&Ve>=Oe.y-P&&Ve<=Oe.y+Oe.height+P)return Oe.id}return null},ze=react.useCallback((ue,Ve,Oe)=>{ue.preventDefault(),ue.stopPropagation();let P=b.current?.ownerSVGElement;if(!P)return;let ee=P.createSVGPoint();ee.x=ue.clientX,ee.y=ue.clientY;let xe=ee.matrixTransform(P.getScreenCTM()?.inverse()),z=Oe!==void 0?Oe:t,j=Ve;if(!j){let ge=xe.x-z;ue.shiftKey?(j="connect",H({x:t+r,y:a+Ne/2})):ue.ctrlKey||ue.metaKey?j="move":ue.altKey?j=ge<r/2?"resize-start":"resize-end":$e?ge<r/2?j="move":j="resize-end":we?ge<=ce/2?j="resize-start":ge>=r-ce/2?j="resize-end":j="move":ge<=ce?j="resize-start":ge>=r-ce?j="resize-end":j="move";}C(j),pe(false),oe(null),j==="move"?T(xe.x-z):j==="connect"?H({x:t+r,y:a+Ne/2}):T(0),I(z),N(r);},[t,r,a,Ne]),et=react.useCallback(ue=>{let Ve=b.current?.ownerSVGElement;if(!Ve)return;let Oe=Ve.closest(".gantt-timeline-scroll");if(!Oe)return;let P=Oe.getBoundingClientRect(),ee=60,xe=15,z=0;if(ue.clientX<P.left+ee){let j=P.left+ee-ue.clientX;z=-Math.min(xe,j/2);}else if(ue.clientX>P.right-ee){let j=ue.clientX-(P.right-ee);z=Math.min(xe,j/2);}return z!==0&&(Oe.scrollLeft+=z),z!==0},[]),st=react.useCallback(ue=>{if(c==="none")return;f.current=ue;let Ve=b.current?.ownerSVGElement;if(!Ve)return;if(c==="move"||c==="resize-start"||c==="resize-end"){let ee=et(ue);ee&&!x.current?x.current=window.setInterval(()=>{f.current&&(et(f.current),st(f.current));},16):!ee&&x.current&&(window.clearInterval(x.current),x.current=null);}let Oe=Ve.createSVGPoint();Oe.x=ue.clientX,Oe.y=ue.clientY;let P=Oe.matrixTransform(Ve.getScreenCTM()?.inverse());if(c==="connect"){H({x:P.x,y:P.y});let ee=Ye(P.x,P.y);le(ee);}else if(c==="move"){let ee=P.x-D,xe=X(ee);I(xe),N(r);let z=Math.round((xe-t)/s);if(w?.(e.id,z,true),e.segments&&e.segments.length>0&&be!==null){let j=xe-Be;S(j);}}else if(c==="resize-start"){let ee=P.x,xe=X(ee),z=t+r-xe;z>=s&&(I(xe),N(z));}else if(c==="resize-end"){let ee=P.x,z=X(ee)-t;z>=s&&N(z);}},[c,t,r,s,D,e,X,be,Be,Ye,le,H,I,N,S,w,et]),Re=react.useCallback(()=>{if(x.current&&(window.clearInterval(x.current),x.current=null),f.current=null,c!=="none"){if(c==="connect")Y&&g&&g(e,Y),H(null),le(null);else {let ue=e.endDate.getTime()-e.startDate.getTime(),Ve,Oe,P=true;if(c==="move"){if(Ve=te(v),Oe=new Date(Ve.getTime()+ue),e.segments&&e.segments.length>0&&be!==null){let ee=Math.round($/s),xe=e.segments.map((Ie,Te)=>{if(Te===be){let U=new Date(Ie.startDate),ae=new Date(Ie.endDate);return U.setDate(U.getDate()+ee),ae.setDate(ae.getDate()+ee),{startDate:U,endDate:ae}}return Ie}),z=xe.flatMap(Ie=>[Ie.startDate,Ie.endDate]),j=new Date(Math.min(...z.map(Ie=>Ie.getTime()))),ge=new Date(Math.max(...z.map(Ie=>Ie.getTime())));d?.({...e,segments:xe},j,ge),Ze(t,r);return}}else c==="resize-start"?(Ve=te(v),Oe=e.endDate,Ve>Oe&&(console.warn("Invalid date range: start date must be before or equal to end date"),P=false)):c==="resize-end"?(Ve=e.startDate,Oe=te(v+B),Oe<Ve&&(console.warn("Invalid date range: end date must be after or equal to start date"),P=false)):P=false;P&&Ve&&Oe&&(Oe.getTime()<Ve.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,Ve,Oe));}w?.(e.id,0,false),Ze(t,r);}},[c,v,B,e,d,Y,g,t,r,s,te,$,be,Ze,w]);react.useEffect(()=>{if(c==="none")return;let ue=Oe=>{st(Oe);},Ve=()=>{Re();};return window.addEventListener("mousemove",ue),window.addEventListener("mouseup",Ve),()=>{window.removeEventListener("mousemove",ue),window.removeEventListener("mouseup",Ve),x.current&&(window.clearInterval(x.current),x.current=null);}},[c,st,Re]);let qe=me&&!Z?v:t,ne=me&&!Z?B:r,Ge=m.taskClass(e);return jsxRuntime.jsxs("g",{ref:b,"data-task-bar":"true",onClick:()=>!me&&u?.(e),onDoubleClick:ue=>{me||(ue.stopPropagation(),i?.(e));},onContextMenu:ue=>{ue.preventDefault(),p?.(e,ue);},onMouseEnter:()=>!me&&pe(true),onMouseLeave:()=>{me||(pe(false),oe(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:Ne,fill:"transparent",style:{pointerEvents:"all"}}),se&&!me&&!we&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:ce,height:Ne,fill:re==="resize-start"?o.accent:"transparent",opacity:re==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>oe("resize-start"),onMouseDown:ue=>ze(ue,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ce,y:a,width:r-ce*2,height:Ne,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:ue=>ze(ue,"move")}),jsxRuntime.jsx("rect",{x:t+r-ce,y:a,width:ce,height:Ne,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:ue=>ze(ue,"resize-end")})]}),se&&!me&&$e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Ne,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:ue=>ze(ue,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ne,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:ue=>ze(ue,"resize-end")}),se&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ne-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),me&&!Z&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:v,y:a,width:B,height:Ne,rx:Xe,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:qe,y:a,width:ne,height:Ne,rx:Xe,fill:it,"data-task-class":Ge,initial:{opacity:0,scale:.95},animate:{opacity:me&&!Z?.15:e.parentId?.6:se?.9:.8,scale:se&&!me?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ue=>ze(ue),style:{cursor:me?Z?"crosshair":Le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:qe,y:a,width:ne*(e.progress/100),height:Ne,rx:Xe,fill:it,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((ue,Ve)=>{let Oe=(ue.startDate.getTime()-n.getTime())/864e5*s,ee=(ue.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Oe+s,xe=me&&c==="move"&&be===Ve,z=R===Ve,j=xe?Oe+$:Oe;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!me&&K(Ve),onMouseLeave:()=>!me&&K(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:j,y:a,width:ee,height:Ne,rx:Xe,fill:it,initial:{opacity:0,scale:.95},animate:{opacity:xe||e.parentId?.6:z?.9:.8,scale:z&&!me?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ge=>{ge.stopPropagation(),ve(Ve),L(Oe),ze(ge,void 0,Oe);},style:{cursor:me?Z?"crosshair":Le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:j,y:a,width:ee*(e.progress/100),height:Ne,rx:Xe,fill:it,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ve}`)}),Qe&&(pt||wt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[wt&&!pt&&jsxRuntime.jsx("rect",{x:qe,y:a,width:ne,height:Ne,rx:Xe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),pt&&jsxRuntime.jsx("rect",{x:qe,y:a,width:ne,height:Ne,rx:Xe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ne>60&&!e.segments&&(()=>{let ue=m.taskLabel(e),Ve=typeof ue=="string"?ue:e.name,Oe=Ve.length>Math.floor(ne/8)?`${Ve.substring(0,Math.floor(ne/8))}...`:Ve;return jsxRuntime.jsx("text",{x:qe+12,y:a+Ne/2,dominantBaseline:"middle",fill:gt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:gt?"line-through":"none"},children:Oe})})(),ne>100&&e.progress>0&&e.progress<100&&!me&&!e.segments&&jsxRuntime.jsxs("text",{x:qe+ne-12,y:a+Ne/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&&ne>80&&!me&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:qe+ne-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:qe+ne-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(se||Le)&&!Z&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:qe-2,y:a,width:16,height:Ne,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>oe("resize-start"),onMouseLeave:()=>oe(null),onMouseDown:ue=>{ue.stopPropagation(),ze(ue,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:qe+4,y:a+8,width:3,height:Ne-16,rx:1.5,fill:re==="resize-start"||c==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:qe+ne-14,y:a,width:16,height:Ne,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>oe("resize-end"),onMouseLeave:()=>oe(null),onMouseDown:ue=>{ue.stopPropagation(),ze(ue,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:qe+ne-7,y:a+8,width:3,height:Ne-16,rx:1.5,fill:re==="resize-end"||c==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:se&&!me&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+Ne/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>oe("connect"),onMouseLeave:()=>oe(null),onMouseDown:ue=>{ue.stopPropagation(),ze(ue,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Ne/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:re==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Z&&G&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Ne/2,x2:G.x,y2:G.y,stroke:Y?o.statusCompleted:o.accent,strokeWidth:Y?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:Y?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:G.x,cy:G.y,r:Y?8:6,fill:Y?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),Y&&jsxRuntime.jsx(framerMotion.motion.text,{x:G.x+15,y:G.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:G.x+10},animate:{opacity:1,x:G.x+15},transition:{duration:.2},children:"Connect"})]}),(se||me)&&!Z&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:qe-2,y:a-2,width:ne+4,height:Ne+4,rx:Xe+2,fill:"none",stroke:me?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:me?.6:.4,initial:{opacity:0},animate:{opacity:me?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:v,y1:0,x2:v,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:v+B,y1:0,x2:v+B,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:se&&!me&&!e.segments&&!k&&(()=>{let Oe=a<100,P=Oe?a+Ne+13:a-82-13,ee=Oe?`M ${qe+ne/2-6} ${a+Ne+3} L ${qe+ne/2} ${a+Ne+13} L ${qe+ne/2+6} ${a+Ne+3}`:`M ${qe+ne/2-6} ${a-13} L ${qe+ne/2} ${a-3} L ${qe+ne/2+6} ${a-13}`,xe=P+22,z=P+40,j=P+55,ge=P+70,Ie=Oe?P+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Oe?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Oe?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:ee,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:qe+ne/2-120,y:P,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:qe+ne/2,y:xe,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:qe+ne/2-110,y:z,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:qe+ne/2-70,y:z,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ke(e.startDate)}),jsxRuntime.jsx("text",{x:qe+ne/2-110,y:j,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:qe+ne/2-70,y:j,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ke(e.endDate)}),jsxRuntime.jsx("text",{x:qe+ne/2+10,y:z,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:qe+ne/2+65,y:z,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ft()}),jsxRuntime.jsx("text",{x:qe+ne/2+10,y:j,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:qe+ne/2+65,y:j,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:qe+ne/2-110,y:ge,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:qe+ne/2-50,y:ge,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Te=>Te.name).join(", ").substring(0,30),e.assignees.map(Te=>Te.name).join(", ").length>30?"...":""]})]}),!Oe&&jsxRuntime.jsx("text",{x:qe+ne/2,y:Ie,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:$e?"Left: move \u2022 Right: resize":we?"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 sm({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:m}=e,u=82,i=13,p=m?o+n+i:o-u-i,d=m?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,g=p+22,y=p+40,w=p+55,k=p+70,h=c=>c.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let c=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${c} day${c!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:m?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:m?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:p,width:240,height:u,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,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y,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:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:w,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,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:b()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:w,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:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(c=>c.name).join(", ").substring(0,30),a.assignees.map(c=>c.name).join(", ").length>30?"...":""]})]})]})})}function es({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:m=false}){let[u,i]=react.useState(false),[p,d]=react.useState(null),g=r-t,y=g>0,w=Math.abs(g)<5,h=5,b=20,x=!w&&a<=e,f,c;if(w)if(c=(e+a)/2,n==="squared")f=`M ${e} ${t} L ${a} ${r}`;else {let re=Math.min(Math.abs(a-e)/3,30);f=`M ${e} ${t} C ${e+re} ${t}, ${a-re} ${r}, ${a} ${r}`;}else if(c=a-b,x){let oe=e+15,be=a-b,ve=y?t+20:t-20;c=be,n==="squared"?f=`M ${e} ${t} L ${oe} ${t} L ${oe} ${ve} L ${be} ${ve} L ${be} ${r} L ${a} ${r}`:y?f=`M ${e} ${t} L ${oe-h} ${t} Q ${oe} ${t} ${oe} ${t+h} L ${oe} ${ve-h} Q ${oe} ${ve} ${oe-h} ${ve} L ${be+h} ${ve} Q ${be} ${ve} ${be} ${ve+h} L ${be} ${r-h} Q ${be} ${r} ${be+h} ${r} L ${a} ${r}`:f=`M ${e} ${t} L ${oe-h} ${t} Q ${oe} ${t} ${oe} ${t-h} L ${oe} ${ve+h} Q ${oe} ${ve} ${oe-h} ${ve} L ${be+h} ${ve} Q ${be} ${ve} ${be} ${ve-h} L ${be} ${r+h} Q ${be} ${r} ${be+h} ${r} L ${a} ${r}`;}else n==="squared"?f=`M ${e} ${t} L ${c} ${t} L ${c} ${r} L ${a} ${r}`:y?f=`M ${e} ${t} L ${c-h} ${t} Q ${c} ${t} ${c} ${t+h} L ${c} ${r-h} Q ${c} ${r} ${c+h} ${r} L ${a} ${r}`:f=`M ${e} ${t} L ${c-h} ${t} Q ${c} ${t} ${c} ${t-h} L ${c} ${r+h} Q ${c} ${r} ${c+h} ${r} L ${a} ${r}`;let C=5,D=`M ${a} ${r} L ${a-C} ${r-C*.5} M ${a} ${r} L ${a-C} ${r+C*.5}`,T=o.dependency,v=o.dependencyHover||T,I="#f87171",B="rgba(248, 113, 113, 0.15)",N=c,G=(t+r)/2;if(p)if(w)N=Math.max(e+10,Math.min(a-10,p.x)),G=t;else if(x){let re=e+15,oe=a-b,be=y?t+20:t-20,ve=[[e,t,re,t],[re,t,re,be],[re,be,oe,be],[oe,be,oe,r],[oe,r,a,r]],Be=1/0,L={x:N,y:G};for(let $ of ve){let S=H(p.x,p.y,$[0],$[1],$[2],$[3]),R=Math.hypot(p.x-S.x,p.y-S.y);R<Be&&(Be=R,L=S);}N=L.x,G=L.y;}else {let re=[[e,t,c,t],[c,t,c,r],[c,r,a,r]],oe=1/0,be={x:N,y:G};for(let ve of re){let Be=H(p.x,p.y,ve[0],ve[1],ve[2],ve[3]),L=Math.hypot(p.x-Be.x,p.y-Be.y);L<oe&&(oe=L,be=Be);}N=be.x,G=be.y;}function H(re,oe,be,ve,Be,L){let $=Be-be,S=L-ve,R=$*$+S*S;if(R===0)return {x:be,y:ve};let K=((re-be)*$+(oe-ve)*S)/R;return K=Math.max(0,Math.min(1,K)),{x:be+K*$,y:ve+K*S}}let Y=re=>{let oe=re.currentTarget.ownerSVGElement;if(!oe)return;let be=oe.getBoundingClientRect();d({x:re.clientX-be.left,y:re.clientY-be.top});},le=()=>{i(false),d(null);};return m?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:le,onMouseMove:Y,children:[jsxRuntime.jsx("path",{d:f,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:f,fill:"none",stroke:v,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:f,fill:"none",stroke:v,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:D,fill:"none",stroke:v,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:v,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:re=>{re.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:N,cy:G,r:9,fill:B,stroke:I,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:G-3,x2:N+3,y2:G+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:G-3,x2:N-3,y2:G+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:le,onMouseMove:Y,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:f,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:f,fill:"none",stroke:u?v:T,strokeWidth:u?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:D,fill:"none",stroke:u?v:T,strokeWidth:u?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:u?4:3,fill:u?v:T,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),u&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:re=>{re.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:N,cy:G,r:9,fill:B,stroke:I,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:G-3,x2:N+3,y2:G+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:G-3,x2:N-3,y2:G+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function as({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),m=16,u=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:m+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-m/2,y:a+16-m/2,width:m,height:m,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(m+4)/2,y:a+16-(m+4)/2,width:m+4,height:m+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:u(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 ke={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,m=new Set,u=i=>{if(!n.has(i)){n.add(i),m.add(i);let p=r.get(i)||[];for(let d of p){if(!n.has(d)&&u(d))return true;if(m.has(d))return true}}return m.delete(i),false};return u(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=ke.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ke.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ke.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=ke.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=ke.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=ke.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)=>ke.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=ke.findTaskById(e,t);return !a||!a.dependencies?[]:ke.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>ke.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>ke.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=ke.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=>ke.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=ke.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],m=s.map(u=>{let i=u.startDate&&u.endDate?ke.calculateDuration(u.startDate,u.endDate):0;return [u.name,u.startDate?ke.formatDate(u.startDate):"N/A",u.endDate?ke.formatDate(u.endDate):"N/A",i>0?`${i} days`:"N/A",`${u.progress}%`,u.status||"N/A"]});r(o,{head:n,body:m,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=ke.flattenTasks(e).map(u=>{let i=u.startDate&&u.endDate?ke.calculateDuration(u.startDate,u.endDate):0;return {"Task ID":u.id,"Task Name":u.name,"Start Date":u.startDate?ke.formatDate(u.startDate):"","End Date":u.endDate?ke.formatDate(u.endDate):"","Duration (days)":i>0?i:"","Progress (%)":u.progress,Status:u.status||"",Assignees:u.assignees?.map(p=>p.name).join(", ")||"",Dependencies:u.dependencies?.join(", ")||"","Is Milestone":u.isMilestone?"Yes":"No","Parent ID":u.parentId||"",Level:u.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let m=a.utils.book_new();a.utils.book_append_sheet(m,s,"Gantt Tasks"),a.writeFile(m,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=ke.flattenTasks(e),o=new Map;r.forEach((g,y)=>{o.set(g.id,y+1);});let s=g=>g.toISOString().replace("Z",""),n=ke.getEarliestStartDate(e)||new Date,m=ke.getLatestEndDate(e)||new Date,u=r.map((g,y)=>{let w=o.get(g.id),k=g.startDate&&g.endDate?ke.calculateDuration(g.startDate,g.endDate):0,h=(g.dependencies||[]).filter(b=>o.has(b)).map(b=>`
113
113
  <PredecessorLink>
114
114
  <PredecessorUID>${o.get(b)}</PredecessorUID>
115
115
  <Type>1</Type>
@@ -118,38 +118,38 @@
118
118
  <LagFormat>7</LagFormat>
119
119
  </PredecessorLink>`).join("");return `
120
120
  <Task>
121
- <UID>${x}</UID>
121
+ <UID>${w}</UID>
122
122
  <ID>${y+1}</ID>
123
- <Name>${f.name.replace(/[<>&'"]/g,b=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[b]||b)}</Name>
123
+ <Name>${g.name.replace(/[<>&'"]/g,b=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[b]||b)}</Name>
124
124
  <Type>0</Type>
125
125
  <IsNull>0</IsNull>
126
126
  <CreateDate>${s(new Date)}</CreateDate>
127
127
  <WBS>${y+1}</WBS>
128
128
  <OutlineNumber>${y+1}</OutlineNumber>
129
- <OutlineLevel>${f.level||0}</OutlineLevel>
129
+ <OutlineLevel>${g.level||0}</OutlineLevel>
130
130
  <Priority>500</Priority>
131
- <Start>${f.startDate?s(f.startDate):""}</Start>
132
- <Finish>${f.endDate?s(f.endDate):""}</Finish>
133
- <Duration>PT${C*8}H0M0S</Duration>
131
+ <Start>${g.startDate?s(g.startDate):""}</Start>
132
+ <Finish>${g.endDate?s(g.endDate):""}</Finish>
133
+ <Duration>PT${k*8}H0M0S</Duration>
134
134
  <DurationFormat>7</DurationFormat>
135
- <Work>PT${C*8}H0M0S</Work>
136
- <Stop>${f.endDate?s(f.endDate):""}</Stop>
137
- <Resume>${f.startDate?s(f.startDate):""}</Resume>
135
+ <Work>PT${k*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>${f.isMilestone?"1":"0"}</Milestone>
144
- <Summary>${f.subtasks&&f.subtasks.length>0?"1":"0"}</Summary>
145
- <Critical>${f.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>${f.startDate?s(f.startDate):""}</EarlyStart>
150
- <EarlyFinish>${f.endDate?s(f.endDate):""}</EarlyFinish>
151
- <LateStart>${f.startDate?s(f.startDate):""}</LateStart>
152
- <LateFinish>${f.endDate?s(f.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>${f.progress}</PercentComplete>
161
- <PercentWorkComplete>${f.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>${f.progress>0&&f.startDate?s(f.startDate):""}</ActualStart>
166
- <ActualFinish>${f.progress===100&&f.endDate?s(f.endDate):""}</ActualFinish>
167
- <ActualDuration>PT${Math.round(C*f.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(k*g.progress/100)*8}H0M0S</ActualDuration>
168
168
  <ActualCost>0</ActualCost>
169
169
  <ActualOvertimeCost>0</ActualOvertimeCost>
170
- <ActualWork>PT${Math.round(C*f.progress/100)*8}H0M0S</ActualWork>
170
+ <ActualWork>PT${Math.round(k*g.progress/100)*8}H0M0S</ActualWork>
171
171
  <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
172
- <RegularWork>PT${C*8}H0M0S</RegularWork>
173
- <RemainingDuration>PT${Math.round(C*(100-f.progress)/100)*8}H0M0S</RemainingDuration>
172
+ <RegularWork>PT${k*8}H0M0S</RegularWork>
173
+ <RemainingDuration>PT${Math.round(k*(100-g.progress)/100)*8}H0M0S</RemainingDuration>
174
174
  <RemainingCost>0</RemainingCost>
175
- <RemainingWork>PT${Math.round(C*(100-f.progress)/100)*8}H0M0S</RemainingWork>
175
+ <RemainingWork>PT${Math.round(k*(100-g.progress)/100)*8}H0M0S</RemainingWork>
176
176
  <RemainingOvertimeCost>0</RemainingOvertimeCost>
177
177
  <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
178
178
  <ACWP>0</ACWP>
@@ -195,8 +195,8 @@
195
195
  </Task>`}).join(""),i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
196
196
  <Project xmlns="http://schemas.microsoft.com/project">
197
197
  <SaveVersion>14</SaveVersion>
198
- <Name>${t.replace(/[<>&'"]/g,f=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[f]||f)}</Name>
199
- <Title>${t.replace(/[<>&'"]/g,f=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[f]||f)}</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>
@@ -339,9 +339,9 @@
339
339
  </Calendars>
340
340
  <Tasks>${u}
341
341
  </Tasks>
342
- </Project>`,p=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(p),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=ve.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let p=i.startDate&&i.endDate?ve.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let y of i.dependencies){let x=t.find(C=>C.id===y);if(x){o(x);let C=r.get(y)?.ef||0;l=Math.max(l,C);}}let f=l+p;r.set(i.id,{es:l,ef:f});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,m=i=>{if(n.has(i.id))return;let p=i.startDate&&i.endDate?ve.calculateDuration(i.startDate,i.endDate):0,l=t.filter(x=>x.dependencies&&x.dependencies.includes(i.id)),f=s;if(l.length>0)for(let x of l){m(x);let C=n.get(x.id)?.ls||0;f=Math.min(f,C);}let y=f-p;n.set(i.id,{ls:y,lf:f});};a.forEach(m);let u=[];for(let i of a){let p=r.get(i.id),l=n.get(i.id);if(p&&l){let f=l.ls-p.es;Math.abs(f)<.01&&u.push(i.id);}}return u},calculateSlack:(e,t)=>{let a=ve.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ve.calculateCriticalPath(e).includes(t))return 0;let o=ve.getDependentTasks(e,t);if(o.length===0){let m=ve.getLatestEndDate(e);if(!m)return null;let u=ve.calculateDuration(a.endDate,m);return Math.max(0,u)}let s=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,u)=>m-u)[0];if(!s)return null;let n=ve.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>ve.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ve.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ve.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let m=ve.calculateDuration(n.startDate,n.endDate),u;a!==void 0?(u=new Date(n.startDate),u.setDate(u.getDate()+a)):(u=new Date(r.endDate),u.setDate(u.getDate()+1));let i=ve.calculateEndDate(u,m),p=l=>l.map(f=>f.id===n.id?{...f,startDate:u,endDate:i}:f.subtasks?{...f,subtasks:p(f.subtasks)}:f);s=p(s),s=ve.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,m)=>{if(a===0)return [];let u=[],i=o.getTime(),p=1e3*60*60*24,l=ve.findTaskById(e,t);if(!l||!l.endDate)return [];let f=(y,x,C=new Set)=>{if(C.has(y))return;C.add(y);let h=ve.getDependentTasks(e,y);for(let b of h){if(!b.startDate||!b.endDate)continue;let g=r.findIndex(N=>N.id===b.id);if(g===-1)continue;let k=b.startDate.getTime(),T=(b.endDate.getTime()-k)/p,R=(k-i)/p*s,v=R+x*s,I=Math.max(T*s,s),F=m+g*n+12;u.push({taskId:b.id,taskName:b.name,originalX:R,previewX:v,width:I,y:F,rowIndex:g,daysDelta:x,color:b.color}),f(b.id,x,C);}};return f(t,a),u},splitTask:(e,t,a,r=3)=>{let o=ve.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let m=new Date(o.endDate);m.setDate(m.getDate()+r);let u=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:m}],i=p=>p.map(l=>l.id===o.id?{...l,endDate:m,segments:u}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function as({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:m="en",templates:u,dependencyLineStyle:i="curved",onTaskClick:p,onTaskDblClick:l,onTaskContextMenu:f,onTaskDateChange:y,onDependencyCreate:x,onDependencyDelete:C}){let b=jr(),[g,k]=react.useState([]),[c,T]=react.useState(null),w=react.useCallback(A=>{T(A);},[]),R=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),v=r==="day"?60:r==="week"?20:8,I=R*v*n,F=A=>{let O=new Date(Date.UTC(A.getFullYear(),A.getMonth(),A.getDate())),L=O.getUTCDay()||7;O.setUTCDate(O.getUTCDate()+4-L);let _=new Date(Date.UTC(O.getUTCFullYear(),0,1));return Math.ceil(((O.getTime()-_.getTime())/864e5+1)/7)},N=A=>{let O=A.getDay();return O===0||O===6},U=react.useCallback(A=>{let O=Math.round(A/(v*n)),L=new Date(o);return L.setDate(L.getDate()+O),L},[o,v,n]),$=react.useCallback((A,O)=>{if(O.startDate&&O.endDate)return;let L=A.currentTarget.ownerSVGElement;if(!L)return;let _=L.createSVGPoint();_.x=A.clientX,_.y=A.clientY;let J=_.matrixTransform(L.getScreenCTM()?.inverse()),ce=U(J.x),fe=new Date(ce);fe.setDate(fe.getDate()+1),y?.(O,ce,fe);},[U,y]),j=react.useMemo(()=>{let A=J=>J.map(ce=>{if(ce.subtasks&&ce.subtasks.length>0){let fe=A(ce.subtasks),me=fe.filter(Le=>Le.startDate&&Le.endDate);if(me.length>0){let Le=me.map(Qe=>Qe.startDate.getTime()),te=me.map(Qe=>Qe.endDate.getTime()),Je=new Date(Math.min(...Le)),ke=new Date(Math.max(...te));return {...ce,subtasks:fe,startDate:Je,endDate:ke}}return {...ce,subtasks:fe}}return ce}),O=(J,ce=[])=>{for(let fe of J)ce.push(fe),fe.subtasks&&fe.subtasks.length>0&&(fe.isExpanded===void 0||fe.isExpanded)&&O(fe.subtasks,ce);return ce},L=A(e);return O(L)},[e]),ne=react.useCallback(A=>{if(!A.startDate||!A.endDate)return {x:0,width:0};let O=A.startDate.getTime(),L=A.endDate.getTime(),_=o.getTime(),J=(O-_)/(1e3*60*60*24),ce=(L-O)/(1e3*60*60*24),fe=J*v*n,me=Math.max(v*n,40),Le=Math.max(ce*v*n,me);return {x:fe,width:Le}},[o,v,n]),re=react.useMemo(()=>j.filter(A=>A.startDate&&A.endDate).map(A=>{let{x:O,width:L}=ne(A),J=j.findIndex(ce=>ce.id===A.id)*a+12;return {id:A.id,x:O,y:J,width:L,height:32}}),[j,ne]),se=react.useCallback((A,O,L)=>{if(!L||O===0){k([]);return}let _=ve.calculateCascadePreview(e,A,O,j,o,v*n,a,48);k(_);},[e,j,o,v,n,a,48]),ye=react.useMemo(()=>{let A=[],O=new Date(o);for(;O<=s;){let J=(O.getTime()-o.getTime())/864e5*v*n;if(r==="day")A.push({date:new Date(O),label:O.toLocaleDateString(m,{day:"numeric",month:"short"}),x:J}),O.setDate(O.getDate()+1);else if(r==="week"){let ce=F(O);A.push({date:new Date(O),label:`${b.labels.week} ${ce}`,x:J}),O.setDate(O.getDate()+7);}else A.push({date:new Date(O),label:O.toLocaleDateString(m,{month:"short",year:"numeric"}),x:J}),O.setMonth(O.getMonth()+1);}return A},[o,s,r,v,n,m,b.labels.week]),be=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*v*n,[o,v,n]),Be=Math.max(j.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(I,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(I,1e3),height:48,fill:t.bgGrid}),ye.map((A,O)=>jsxRuntime.jsxs("g",{children:[O>0&&jsxRuntime.jsx("line",{x1:A.x,y1:0,x2:A.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:A.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:A.label})]},`header-${O}`)),be>=0&&be<=I&&jsxRuntime.jsx("circle",{cx:be,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(I,1e3),height:Be,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(I,1e3),height:Be,fill:t.bgPrimary}),ye.map((A,O)=>{let L=ye[O+1]?.x||I,_=N(A.date);return jsxRuntime.jsxs("g",{children:[_&&jsxRuntime.jsx("rect",{x:A.x,y:0,width:L-A.x,height:j.length*a,fill:t.bgWeekend,opacity:1}),O>0&&jsxRuntime.jsx("line",{x1:A.x,y1:0,x2:A.x,y2:j.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},O)}),j.map((A,O)=>{let L=A.startDate&&A.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:O*a,width:I,height:a,fill:O%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${A.id}`),!L&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:O*a,width:I,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:_=>$(_,A),onMouseEnter:_=>{_.currentTarget.setAttribute("fill",t.accentLight),_.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:_=>{_.currentTarget.setAttribute("fill","transparent"),_.currentTarget.setAttribute("opacity","1");}},`clickable-${A.id}`),jsxRuntime.jsx("text",{x:be>0?be:100,y:O*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:b.labels.clickToSetDates},`placeholder-${A.id}`)]})]},`row-group-${A.id}`)}),j.map((A,O)=>{if(!A.startDate||!A.endDate)return null;let{x:L,width:_}=ne(A),J=O*a+12,ce=A.subtasks&&A.subtasks.length>0&&!A.isMilestone;return A.isMilestone?jsxRuntime.jsx(es,{task:A,x:L+_/2,y:J+16,theme:t,onClick:p},A.id):ce?jsxRuntime.jsxs("g",{onClick:()=>p?.(A),onContextMenu:fe=>{fe.preventDefault(),fe.stopPropagation(),f?.(A,fe);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:L,y:J,width:_,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:L,y1:J,x2:L+_,y2:J,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:L,y1:J,x2:L,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:L+_,y1:J,x2:L+_,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:L,y1:J+32,x2:L+_,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),_>60&&jsxRuntime.jsx("text",{x:L+12,y:J+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:A.name})]},A.id):jsxRuntime.jsx(qn,{task:A,x:L,y:J,width:_,theme:t,dayWidth:v*n,startDate:o,templates:u,onClick:p,onDoubleClick:l,onContextMenu:f,onDateChange:y,onDependencyCreate:x,allTaskPositions:re,onDragMove:se,onHoverChange:w},A.id)}),j.map((A,O)=>!A.dependencies||A.dependencies.length===0||!A.startDate||!A.endDate?null:A.dependencies.map(L=>{let _=j.find(ke=>ke.id===L);if(!_||!_.startDate||!_.endDate)return null;let J=j.findIndex(ke=>ke.id===L),ce=ne(_),fe=ne(A),me=ce.x+ce.width,Le=J*a+28,te=fe.x,Je=O*a+28;return jsxRuntime.jsx(Zn,{x1:me,y1:Le,x2:te,y2:Je,theme:t,lineStyle:i,onDelete:()=>C?.(A.id,L)},`dep-${L}-${A.id}`)})),g.map(A=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:A.previewX,y:A.y-48,width:A.width,height:32,rx:8,fill:A.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(A.daysDelta)>0&&jsxRuntime.jsx("text",{x:A.previewX+A.width/2,y:A.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:A.daysDelta>0?`+${A.daysDelta}d`:`${A.daysDelta}d`})]},`cascade-preview-${A.taskId}`)),be>=0&&be<=I&&jsxRuntime.jsx("line",{x1:be,y1:0,x2:be,y2:Be,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),c&&jsxRuntime.jsx(am,{tooltipData:c,theme:t})]})]})}var Zb=['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"'],sm=()=>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"})]}),Qb=()=>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"})}),eh=()=>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"})}),th=()=>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"})}),ah=()=>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 rs({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:m,onDependencyDelete:u}){let[i,p]=react.useState(false),[l,f]=react.useState(false),[y,x]=react.useState([]),[C,h]=react.useState(""),[b,g]=react.useState(false),[k,c]=react.useState(true),T=react.useRef(null),w=react.useRef(null),R=react.useRef(null),{enabled:v=true,placeholder:I='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:F="bottom-right",onCommand:N,suggestions:U=Zb,maxHistory:$=50,persistHistory:j}=a,ne=j?.storageKey||"gantt-ai-history",re=j?.maxMessages??5;react.useEffect(()=>{if(j?.enabled)try{let O=localStorage.getItem(ne);if(O){let _=JSON.parse(O).map(J=>({...J,timestamp:new Date(J.timestamp)}));x(_.slice(-re));}}catch(O){console.warn("[GanttAIAssistant] Failed to load persisted history:",O);}},[j?.enabled,ne,re]),react.useEffect(()=>{if(j?.enabled&&y.length>0)try{let O=y.filter(L=>!L.isLoading).slice(-re);localStorage.setItem(ne,JSON.stringify(O));}catch(O){console.warn("[GanttAIAssistant] Failed to persist history:",O);}},[y,j?.enabled,ne,re]),react.useEffect(()=>{w.current&&w.current.scrollIntoView({behavior:"smooth"});},[y]),react.useEffect(()=>{i&&!l&&T.current&&setTimeout(()=>T.current?.focus(),100);},[i,l]);let se=react.useCallback(O=>{if(O.success)switch(O.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":O.taskId&&O.updates&&o?.(O.taskId,O.updates);break;case "create_task":O.newTask&&s?.(O.newTask);break;case "delete_task":O.taskId&&n?.(O.taskId);break;case "link_tasks":O.dependencyFrom&&O.dependencyTo&&m?.(O.dependencyFrom,O.dependencyTo);break;case "unlink_tasks":O.taskId&&O.dependencyFrom&&u?.(O.taskId,O.dependencyFrom);break}},[o,s,n,m,u]),ye=react.useCallback(async O=>{if(!O.trim()||b)return;let L={id:`user-${Date.now()}`,role:"user",content:O,timestamp:new Date};x(J=>[...J.slice(-($-1)),L]),h(""),c(false),g(true);let _={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};x(J=>[...J,_]);try{if(N){let J=await N(O,e);x(ce=>{let fe=ce.filter(Le=>!Le.isLoading),me={id:`assistant-${Date.now()}`,role:"assistant",content:J.message,timestamp:new Date,command:J};return [...fe,me]}),se(J);}else x(J=>[...J.filter(fe=>!fe.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(J){x(ce=>[...ce.filter(me=>!me.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${J instanceof Error?J.message:"Unknown error"}`,timestamp:new Date}]);}finally{g(false);}},[b,$,N,e,se]),be=O=>{O.preventDefault(),ye(C);},Be=O=>{h(O),T.current?.focus();};if(react.useEffect(()=>{let O=L=>{(L.metaKey||L.ctrlKey)&&L.key==="k"&&(L.preventDefault(),p(_=>!_),i||f(false)),L.key==="Escape"&&i&&p(false);};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[i]),react.useEffect(()=>{if(!i)return;let O=_=>{let J=_.target;R.current&&!R.current.contains(J)&&p(false);},L=setTimeout(()=>{document.addEventListener("mousedown",O);},100);return ()=>{clearTimeout(L),document.removeEventListener("mousedown",O);}},[i]),!v)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(ht,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${A[F]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>p(true),children:[jsxRuntime.jsx(sm,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:R,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${A[F]} 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(sm,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>f(O=>!O),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(th,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(eh,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[y.length===0&&k&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:U.slice(0,4).map((O,L)=>jsxRuntime.jsx("button",{onClick:()=>Be(O),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:O.length>30?O.slice(0,30)+"...":O},L))})]}),y.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(ah,{}):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:w})]}),jsxRuntime.jsxs("form",{onSubmit:be,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:T,type:"text",value:C,onChange:O=>h(O.target.value),placeholder:I,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!C.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:C.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:C.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Qb,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function im(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,p=true)=>{r(l=>{let f=typeof i=="function"?i(l.present):i;if(o.current)return {...l,present:f};if(!p)return {...l,present:f};let y=[...l.past,l.present];return y.length>t&&y.shift(),{past:y,present:f,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let p=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:p,future:[i.present,...i.future]}});},[]),m=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let p=i.future[0],l=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:p,future:l}});},[]),u=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:u}}function lm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,u=m?n.metaKey:n.ctrlKey;if(u&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!m&&u&&n.key==="y"){n.preventDefault(),t();return}if(m&&u&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var sh={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ve.formatDate(e.startDate)} - ${ve.formatDate(e.endDate)}`);let a=ve.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=>ve.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function dm(e){return {...sh,...e}}var gh=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},pm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:m="comfortable",showThemeSelector:u=true,showExportButton:i=true,availableUsers:p=[],templates:l,enableAutoCriticalPath:f=true,persistExpandedState:y,persistFilter:x,aiAssistant:C,locale:h="en",customTranslations:b,showCreateTaskButton:g=false,createTaskLabel:k,onCreateTask:c,taskFilter:T,onTaskFilterChange:w,onThemeChange:R,onTaskClick:v,onTaskDblClick:I,onTaskContextMenu:F,onTaskUpdate:N,onProgressChange:U,onTaskEdit:$,onTaskAddSubtask:j,onTaskMarkIncomplete:ne,onTaskSetInProgress:re,onDependencyCreate:se,onDependencyDelete:ye,onBeforeTaskAdd:be,onAfterTaskAdd:Be,onBeforeTaskUpdate:A,onAfterTaskUpdate:O,onBeforeTaskDelete:L,onAfterTaskDelete:_}=a,ce=react.useContext(zn)?.theme,[fe,me]=react.useState(ce||s||"dark"),[Le,te]=react.useState(n),[Je,ke]=react.useState(m),[Qe,ct]=react.useState(1),ft=react.useCallback(()=>x?typeof x=="string"?x:"gantt-filter-state":null,[x]),[et,wt]=react.useState(()=>{if(!x)return "all";try{let D=typeof x=="string"?x:"gantt-filter-state",P=localStorage.getItem(D);if(P){let V=JSON.parse(P);if(V.taskFilter)return V.taskFilter}}catch(D){console.warn("[GanttBoard] Error loading filter state from localStorage:",D);}return "all"}),Mt=T??et,Dt=w??wt,[Ye,B]=react.useState(()=>{if(!x)return false;try{let D=typeof x=="string"?x:"gantt-filter-state",P=localStorage.getItem(D);if(P){let V=JSON.parse(P);if(typeof V.hideCompleted=="boolean")return V.hideCompleted}}catch(D){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",D);}return false});react.useEffect(()=>{let D=ft();if(D)try{let P={taskFilter:Mt,hideCompleted:Ye};localStorage.setItem(D,JSON.stringify(P));}catch(P){console.warn("[GanttBoard] Error saving filter state to localStorage:",P);}},[Mt,Ye,ft]);let[ie,Se]=react.useState(0),[He,Ze]=react.useState(false),[bt,q]=react.useState(null),[Q,je]=react.useState({isOpen:false,x:0,y:0,task:null}),[Re,tt]=react.useState(null),[lt,Ue]=react.useState(null);react.useEffect(()=>{ce&&ce!==fe&&me(ce);},[ce]),react.useEffect(()=>{s&&s!==fe&&me(s);},[s]);let qe=react.useCallback(D=>{me(D),R?.(D);},[R]),{state:ae,setState:S,undo:we,redo:X,canUndo:Te,canRedo:Ce,clearHistory:We}=im(t,50),Oe=react.useCallback(()=>y?typeof y=="string"?y:"gantt-expanded-tasks":null,[y]),at=react.useRef(new Map),G=react.useRef(false);if(!G.current&&y){G.current=true;let D=typeof y=="string"?y:"gantt-expanded-tasks";try{let P=localStorage.getItem(D);if(P){let V=JSON.parse(P);Array.isArray(V)&&(at.current=new Map(V));}}catch(P){console.warn("[GanttBoard] Error loading expanded state from localStorage:",P);}}let K=react.useCallback(()=>{let D=Oe();if(D)try{let P=Array.from(at.current.entries());localStorage.setItem(D,JSON.stringify(P));}catch(P){console.warn("[GanttBoard] Error saving expanded state to localStorage:",P);}},[Oe]);react.useEffect(()=>{let D=P=>P.map(V=>{let oe=at.current.get(V.id),ue=oe!==void 0?{...V,isExpanded:oe}:V;return ue.subtasks?.length?{...ue,subtasks:D(ue.subtasks)}:ue});at.current.size>0?S(D(t)):S(t);},[t,S]);let he=react.useRef(t),Ke=react.useRef(true);react.useEffect(()=>{if(Ke.current){Ke.current=false,he.current=ae;return}if(!r)return;let D=JSON.stringify(he.current),P=JSON.stringify(ae);D!==P&&(he.current=ae,r(ae));},[ae,r]);let Ie=react.useMemo(()=>Fi(h,b),[h,b]),z=react.useCallback(D=>[{id:"name",label:D.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:D.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:D.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:D.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:D.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:D.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:D.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:D.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[de,Ge]=react.useState(()=>z(Ie));react.useEffect(()=>{Ge(D=>D.map(P=>({...P,label:Ie.columns[P.id==="name"?"taskName":P.id]||P.label})));},[Ie]);let St=react.useMemo(()=>de.filter(P=>P.visible).reduce((P,V)=>P+V.width,0),[de]),mt=react.useRef(de.filter(D=>D.visible).map(D=>D.id).join(","));react.useEffect(()=>{let D=de.filter(oe=>oe.visible),P=D.map(oe=>oe.id).join(","),V=mt.current;if(P!==V){let oe=D.some(Ee=>Ee.id!=="name"),ue=V.includes(",");oe?!ue&&oe&&q(null):q(null),mt.current=P;}},[de]);let Dr=60,fr=.6,Ua=react.useMemo(()=>{let P=St+Dr,V=typeof window<"u"?window.innerWidth*fr:800,oe=Math.max(P,V);return bt!==null?Math.max(200,Math.min(bt,oe)):Math.max(200,P)},[bt,St]),M=react.useRef(null),H=react.useRef(null),Pe=react.useRef(null),Me=react.useMemo(()=>Fc(fe),[fe]),Ut=react.useMemo(()=>({theme:Me,themeName:fe}),[Me,fe]),pe=react.useMemo(()=>dm(l),[l]),_e=react.useMemo(()=>{if(!f)return ae;let D=ve.calculateCriticalPath(ae),P=V=>V.map(oe=>({...oe,isCriticalPath:D.includes(oe.id),subtasks:oe.subtasks?P(oe.subtasks):void 0}));return P(ae)},[ae,f]),xt=react.useMemo(()=>{if(Mt==="all"&&!Ye)return _e;let D=P=>{let V=[];for(let oe of P){let ue=oe.subtasks?.length?D(oe.subtasks):void 0,Ee=false;if(Ye)Ee=oe.progress<100;else switch(Mt){case "all":Ee=true;break;case "incomplete":Ee=oe.progress<100;break;case "in_progress":Ee=oe.progress>0&&oe.progress<100;break;case "completed":Ee=oe.progress===100;break}(Ee||ue&&ue.length>0)&&V.push({...oe,subtasks:ue});}return V};return D(_e)},[_e,Mt,Ye]),ze=gh(Je);lm({undo:we,redo:X,canUndo:Te,canRedo:Ce,enabled:true}),react.useImperativeHandle(o,()=>({getTask:D=>ve.findTaskById(ae,D),addTask:(D,P)=>{S(V=>{if(!P)return [...V,{...D,level:0}];let oe=ue=>ue.map(Ee=>Ee.id===P?{...Ee,subtasks:[...Ee.subtasks||[],{...D,parentId:P,level:(Ee.level||0)+1}],isExpanded:true}:Ee.subtasks?{...Ee,subtasks:oe(Ee.subtasks)}:Ee);return oe(V)});},updateTask:(D,P)=>{S(V=>{let oe=ue=>ue.map(Ee=>Ee.id===D?{...Ee,...P}:Ee.subtasks?{...Ee,subtasks:oe(Ee.subtasks)}:Ee);return oe(V)});},deleteTask:D=>{S(P=>{let V=oe=>oe.filter(ue=>ue.id===D?false:(ue.subtasks&&(ue.subtasks=V(ue.subtasks)),true));return V(P)});},deleteTasks:D=>{S(P=>Gi(P,D));},duplicateTask:D=>{S(P=>_i(P,[D]));},splitTask:(D,P,V=3)=>{S(oe=>ve.splitTask(oe,D,P,V));},calculateEndDate:ve.calculateEndDate,calculateDuration:ve.calculateDuration,validateDependency:(D,P)=>!ve.validateDependencies(ae,D,P),getAllTasks:()=>ve.flattenTasks(ae),getTasksByStatus:D=>ve.flattenTasks(ae).filter(P=>P.status===D),getTasksByParent:D=>D?ve.findTaskById(ae,D)?.subtasks||[]:ae.filter(V=>!V.parentId),getCriticalPath:()=>ve.flattenTasks(ae).filter(D=>D.isCriticalPath),indentTask:D=>{S(P=>zi(P,[D]));},outdentTask:D=>{S(P=>Hi(P,[D]));},moveTask:(D,P)=>{S(V=>Wi(V,[D],P));},createSubtask:async D=>{let{tasks:P,newTask:V}=Ki(ae,D);if(be){let oe=be({...V,parentId:D});if((oe instanceof Promise?await oe:oe)===false)return}S(P),Be&&Be({...V,parentId:D});},scrollToTask:D=>{let V=ve.flattenTasks(ae).findIndex(oe=>oe.id===D);if(V!==-1&&M.current){let oe=V*ze;M.current.scrollTo({top:oe,behavior:"smooth"}),H.current&&H.current.scrollTo({top:oe,behavior:"smooth"});}},highlightTask:(D,P=2e3)=>{},expandTask:D=>{S(P=>{let V=oe=>oe.map(ue=>ue.id===D?{...ue,isExpanded:true}:ue.subtasks?{...ue,subtasks:V(ue.subtasks)}:ue);return V(P)});},collapseTask:D=>{S(P=>{let V=oe=>oe.map(ue=>ue.id===D?{...ue,isExpanded:false}:ue.subtasks?{...ue,subtasks:V(ue.subtasks)}:ue);return V(P)});},expandAll:()=>{S(D=>{let P=V=>V.map(oe=>({...oe,isExpanded:true,subtasks:oe.subtasks?P(oe.subtasks):void 0}));return P(D)});},collapseAll:()=>{S(D=>{let P=V=>V.map(oe=>({...oe,isExpanded:false,subtasks:oe.subtasks?P(oe.subtasks):void 0}));return P(D)});},undo:we,redo:X,canUndo:()=>Te,canRedo:()=>Ce,clearHistory:We,exportToPNG:async()=>{if(!Pe.current||!M.current||!H.current)throw new Error("Gantt container not found");let D=Pe.current,P=M.current.querySelector(".gantt-grid-scroll"),V=H.current,oe=P?.scrollTop||0,ue=V.scrollTop,Ee=D.style.overflow,Bt=D.style.height;try{let pt=P?.querySelector(".gantt-taskgrid-content"),qt=V.querySelector("svg"),wa=pt?.scrollHeight||P?.scrollHeight||600,Da=qt?.getBoundingClientRect().height||V.scrollHeight,eo=(D.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(wa,Da)+20;P&&(P.scrollTop=0),V.scrollTop=0,D.style.overflow="visible",D.style.height=`${eo}px`,await new Promise(Br=>setTimeout(Br,100));let br=await mm__default.default(D,{backgroundColor:Me.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Br=>{let ko=window.getComputedStyle(Br),to=parseInt(ko.zIndex,10);return !isNaN(to)&&to>=50||ko.position==="fixed"}});return new Promise((Br,ko)=>{br.toBlob(to=>{to?Br(to):ko(new Error("Failed to create blob from canvas"));},"image/png");})}finally{D.style.overflow=Ee,D.style.height=Bt,P&&(P.scrollTop=oe),V.scrollTop=ue;}},exportToPDF:async D=>{await ve.exportToPDF(ae,D);},exportToExcel:async D=>{await ve.exportToExcel(ae,D);},exportToJSON:()=>ve.exportToJSON(ae),exportToCSV:()=>ve.exportToCSV(ae),importFromJSON:D=>{let P=ve.importFromJSON(D);S(P);},getTasks:()=>ae,refresh:()=>{S(D=>[...D]);},clearAll:()=>{S([]);}}),[ae,we,X,Te,Ce,We,Me,ze]);let gt=react.useCallback(D=>{Ge(P=>P.map(V=>V.id===D?{...V,visible:!V.visible}:V));},[]),va=react.useCallback((D,P)=>{Ge(V=>V.map(oe=>{if(oe.id!==D)return oe;let ue=oe.minWidth??100,Ee=oe.maxWidth??800,Bt=Math.max(ue,Math.min(Ee,P));return {...oe,width:Bt}}));},[]),ka=react.useCallback(D=>{S(P=>{let V=ji(P,D),oe=ue=>{for(let Ee of ue){if(Ee.id===D){at.current.set(D,Ee.isExpanded??true);return}Ee.subtasks?.length&&oe(Ee.subtasks);}};return oe(V),K(),V}),a.onTaskToggleExpand?.(D);},[a,K]),Ft=react.useCallback((D,P)=>{if(A&&A(D,P)===false)return;let oe=ve.findTaskById(ae,D)?.progress,ue=Bt=>Bt.map(pt=>pt.id===D?{...pt,...P}:pt.subtasks?{...pt,subtasks:ue(pt.subtasks)}:pt);S(ue(ae));let Ee=ve.findTaskById(ue(ae),D);Ee&&(N?.(Ee),O?.(Ee),P.progress!==void 0&&oe!==void 0&&P.progress!==oe&&U?.(D,oe,P.progress));},[ae,N,A,O,U]),Xe=react.useCallback(D=>{D.length!==0&&(S(P=>zi(P,D)),a.onTaskIndent?.(D[0]));},[a]),Yt=react.useCallback(D=>{D.length!==0&&(S(P=>Hi(P,D)),a.onTaskOutdent?.(D[0]));},[a]),ua=react.useCallback((D,P,V)=>{S(oe=>Yc(oe,D,P,V)),a.onTaskReparent?.(D,P,V);},[a]),Lr=react.useCallback((D,P)=>{D.length!==0&&(S(V=>Wi(V,D,P)),a.onTaskMove?.(D[0],P));},[a]),Es=react.useCallback(async D=>{let P=[];for(let V of D)L&&await Promise.resolve(L(V))===false||P.push(V);P.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(P):(S(V=>Gi(V,P)),P.forEach(V=>a.onTaskDelete?.(V))),_&&P.forEach(V=>_(V)));},[a,L,_]),yu=react.useCallback(D=>{S(P=>_i(P,D)),D.forEach(P=>a.onTaskDuplicate?.(P));},[a]),vu=react.useCallback((D,P)=>{S(V=>{let{tasks:oe,newTask:ue}=Kc(V,D,P);return be&&be(ue)===false?V:(a.onTaskCreate?.(ue.parentId,ue.position||0),Be?.(ue),oe)});},[a,be,Be]),xu=react.useCallback((D,P)=>{S(V=>Vi(V,D,P)),a.onTaskRename?.(D,P);},[a]),Ps=react.useCallback(D=>{S(P=>{let{tasks:V}=Ki(P,D);return a.onTaskCreate?.(D,0),V});},[a]),ku=react.useCallback((D,P,V)=>{let oe=D.startDate?Math.round((P.getTime()-D.startDate.getTime())/864e5):0,ue=pt=>pt.map(qt=>qt.id===D.id?{...qt,startDate:P,endDate:V,...D.segments&&{segments:D.segments}}:qt.subtasks?{...qt,subtasks:ue(qt.subtasks)}:qt),Ee=ue(ae);Ee=ve.autoScheduleDependents(Ee,D.id,oe),S(Ee);let Bt={...D,startDate:P,endDate:V};N?.(Bt);},[ae,N]),wu=react.useCallback((D,P)=>{F?.(D,P),je({isOpen:true,x:P.clientX,y:P.clientY,task:D});},[F]),Cu=react.useCallback((D,P)=>{let V=ve.splitTask(ae,D.id,P);S(V),je({isOpen:false,x:0,y:0,task:null});},[ae]),ed=react.useCallback(D=>{let P=ve.findTaskById(ae,D.id)||D;I?.(P),$||tt(P);},[ae,I,$]),td=react.useCallback((D,P,V)=>{let oe=new Map,ue=wa=>{wa.forEach(Da=>{Da.dependencies&&oe.set(Da.id,Da.dependencies),Da.subtasks&&ue(Da.subtasks);});};ue(V);let Ee=oe.get(P)||[];oe.set(P,[...Ee,D]);let Bt=new Set,pt=new Set,qt=wa=>{if(!Bt.has(wa)){Bt.add(wa),pt.add(wa);let Da=oe.get(wa)||[];for(let Ir of Da){if(!Bt.has(Ir)&&qt(Ir))return true;if(pt.has(Ir))return true}}return pt.delete(wa),false};return qt(P)},[]),ad=react.useCallback((D,P)=>{if(td(D.id,P,ae)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
342
+ </Project>`,p=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(p),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=ke.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let p=i.startDate&&i.endDate?ke.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let y of i.dependencies){let w=t.find(k=>k.id===y);if(w){o(w);let k=r.get(y)?.ef||0;d=Math.max(d,k);}}let g=d+p;r.set(i.id,{es:d,ef:g});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,m=i=>{if(n.has(i.id))return;let p=i.startDate&&i.endDate?ke.calculateDuration(i.startDate,i.endDate):0,d=t.filter(w=>w.dependencies&&w.dependencies.includes(i.id)),g=s;if(d.length>0)for(let w of d){m(w);let k=n.get(w.id)?.ls||0;g=Math.min(g,k);}let y=g-p;n.set(i.id,{ls:y,lf:g});};a.forEach(m);let u=[];for(let i of a){let p=r.get(i.id),d=n.get(i.id);if(p&&d){let g=d.ls-p.es;Math.abs(g)<.01&&u.push(i.id);}}return u},calculateSlack:(e,t)=>{let a=ke.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ke.calculateCriticalPath(e).includes(t))return 0;let o=ke.getDependentTasks(e,t);if(o.length===0){let m=ke.getLatestEndDate(e);if(!m)return null;let u=ke.calculateDuration(a.endDate,m);return Math.max(0,u)}let s=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,u)=>m-u)[0];if(!s)return null;let n=ke.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>ke.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ke.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ke.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let m=ke.calculateDuration(n.startDate,n.endDate),u;a!==void 0?(u=new Date(n.startDate),u.setDate(u.getDate()+a)):(u=new Date(r.endDate),u.setDate(u.getDate()+1));let i=ke.calculateEndDate(u,m),p=d=>d.map(g=>g.id===n.id?{...g,startDate:u,endDate:i}:g.subtasks?{...g,subtasks:p(g.subtasks)}:g);s=p(s),s=ke.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,m)=>{if(a===0)return [];let u=[],i=o.getTime(),p=1e3*60*60*24,d=ke.findTaskById(e,t);if(!d||!d.endDate)return [];let g=(y,w,k=new Set)=>{if(k.has(y))return;k.add(y);let h=ke.getDependentTasks(e,y);for(let b of h){if(!b.startDate||!b.endDate)continue;let x=r.findIndex(N=>N.id===b.id);if(x===-1)continue;let f=b.startDate.getTime(),C=(b.endDate.getTime()-f)/p,T=(f-i)/p*s,v=T+w*s,I=Math.max(C*s,s),B=m+x*n+12;u.push({taskId:b.id,taskName:b.name,originalX:T,previewX:v,width:I,y:B,rowIndex:x,daysDelta:w,color:b.color}),g(b.id,w,k);}};return g(t,a),u},splitTask:(e,t,a,r=3)=>{let o=ke.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let m=new Date(o.endDate);m.setDate(m.getDate()+r);let u=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:m}],i=p=>p.map(d=>d.id===o.id?{...d,endDate:m,segments:u}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function os({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:m="en",templates:u,dependencyLineStyle:i="curved",onTaskClick:p,onTaskDblClick:d,onTaskContextMenu:g,onTaskDateChange:y,onDependencyCreate:w,onDependencyDelete:k}){let b=Kr(),[x,f]=react.useState([]),[c,C]=react.useState(null),D=react.useCallback(L=>{C(L);},[]),T=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),v=r==="day"?60:r==="week"?20:8,I=T*v*n,B=L=>{let $=new Date(Date.UTC(L.getFullYear(),L.getMonth(),L.getDate())),S=$.getUTCDay()||7;$.setUTCDate($.getUTCDate()+4-S);let R=new Date(Date.UTC($.getUTCFullYear(),0,1));return Math.ceil((($.getTime()-R.getTime())/864e5+1)/7)},N=L=>{let $=L.getDay();return $===0||$===6},G=react.useCallback(L=>{let $=Math.round(L/(v*n)),S=new Date(o);return S.setDate(S.getDate()+$),S},[o,v,n]),H=react.useCallback((L,$)=>{if($.startDate&&$.endDate)return;let S=L.currentTarget.ownerSVGElement;if(!S)return;let R=S.createSVGPoint();R.x=L.clientX,R.y=L.clientY;let K=R.matrixTransform(S.getScreenCTM()?.inverse()),se=G(K.x),pe=new Date(se);pe.setDate(pe.getDate()+1),y?.($,se,pe);},[G,y]),Y=react.useMemo(()=>{let L=K=>K.map(se=>{if(se.subtasks&&se.subtasks.length>0){let pe=L(se.subtasks),me=pe.filter(Le=>Le.startDate&&Le.endDate);if(me.length>0){let Le=me.map(Xe=>Xe.startDate.getTime()),Z=me.map(Xe=>Xe.endDate.getTime()),Ze=new Date(Math.min(...Le)),Ne=new Date(Math.max(...Z));return {...se,subtasks:pe,startDate:Ze,endDate:Ne}}return {...se,subtasks:pe}}return se}),$=(K,se=[])=>{for(let pe of K)se.push(pe),pe.subtasks&&pe.subtasks.length>0&&(pe.isExpanded===void 0||pe.isExpanded)&&$(pe.subtasks,se);return se},S=L(e);return $(S)},[e]),le=react.useCallback(L=>{if(!L.startDate||!L.endDate)return {x:0,width:0};let $=L.startDate.getTime(),S=L.endDate.getTime(),R=o.getTime(),K=($-R)/(1e3*60*60*24),se=(S-$)/(1e3*60*60*24),pe=K*v*n,me=Math.max(v*n,40),Le=Math.max(se*v*n,me);return {x:pe,width:Le}},[o,v,n]),re=react.useMemo(()=>Y.filter(L=>L.startDate&&L.endDate).map(L=>{let{x:$,width:S}=le(L),K=Y.findIndex(se=>se.id===L.id)*a+12;return {id:L.id,x:$,y:K,width:S,height:32}}),[Y,le]),oe=react.useCallback((L,$,S)=>{if(!S||$===0){f([]);return}let R=ke.calculateCascadePreview(e,L,$,Y,o,v*n,a,48);f(R);},[e,Y,o,v,n,a,48]),be=react.useMemo(()=>{let L=[],$=new Date(o);for(;$<=s;){let K=($.getTime()-o.getTime())/864e5*v*n;if(r==="day")L.push({date:new Date($),label:$.toLocaleDateString(m,{day:"numeric",month:"short"}),x:K}),$.setDate($.getDate()+1);else if(r==="week"){let se=B($);L.push({date:new Date($),label:`${b.labels.week} ${se}`,x:K}),$.setDate($.getDate()+7);}else L.push({date:new Date($),label:$.toLocaleDateString(m,{month:"short",year:"numeric"}),x:K}),$.setMonth($.getMonth()+1);}return L},[o,s,r,v,n,m,b.labels.week]),ve=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*v*n,[o,v,n]),Be=Math.max(Y.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(I,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(I,1e3),height:48,fill:t.bgGrid}),be.map((L,$)=>jsxRuntime.jsxs("g",{children:[$>0&&jsxRuntime.jsx("line",{x1:L.x,y1:0,x2:L.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:L.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:L.label})]},`header-${$}`)),ve>=0&&ve<=I&&jsxRuntime.jsx("circle",{cx:ve,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(I,1e3),height:Be,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(I,1e3),height:Be,fill:t.bgPrimary}),be.map((L,$)=>{let S=be[$+1]?.x||I,R=N(L.date);return jsxRuntime.jsxs("g",{children:[R&&jsxRuntime.jsx("rect",{x:L.x,y:0,width:S-L.x,height:Y.length*a,fill:t.bgWeekend,opacity:1}),$>0&&jsxRuntime.jsx("line",{x1:L.x,y1:0,x2:L.x,y2:Y.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},$)}),Y.map((L,$)=>{let S=L.startDate&&L.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:$*a,width:I,height:a,fill:$%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${L.id}`),!S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:$*a,width:I,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:R=>H(R,L),onMouseEnter:R=>{R.currentTarget.setAttribute("fill",t.accentLight),R.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:R=>{R.currentTarget.setAttribute("fill","transparent"),R.currentTarget.setAttribute("opacity","1");}},`clickable-${L.id}`),jsxRuntime.jsx("text",{x:ve>0?ve:100,y:$*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:b.labels.clickToSetDates},`placeholder-${L.id}`)]})]},`row-group-${L.id}`)}),Y.map((L,$)=>{if(!L.startDate||!L.endDate)return null;let{x:S,width:R}=le(L),K=$*a+12,se=L.subtasks&&L.subtasks.length>0&&!L.isMilestone;return L.isMilestone?jsxRuntime.jsx(as,{task:L,x:S+R/2,y:K+16,theme:t,onClick:p},L.id):se?jsxRuntime.jsxs("g",{onClick:()=>p?.(L),onContextMenu:pe=>{pe.preventDefault(),pe.stopPropagation(),g?.(L,pe);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:S,y:K,width:R,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:S,y1:K,x2:S+R,y2:K,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:K,x2:S,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S+R,y1:K,x2:S+R,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:K+32,x2:S+R,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),R>60&&jsxRuntime.jsx("text",{x:S+12,y:K+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:L.name})]},L.id):jsxRuntime.jsx(Jn,{task:L,x:S,y:K,width:R,theme:t,dayWidth:v*n,startDate:o,templates:u,onClick:p,onDoubleClick:d,onContextMenu:g,onDateChange:y,onDependencyCreate:w,allTaskPositions:re,onDragMove:oe,onHoverChange:D},L.id)}),Y.map((L,$)=>!L.dependencies||L.dependencies.length===0||!L.startDate||!L.endDate?null:L.dependencies.map(S=>{let R=Y.find(Ne=>Ne.id===S);if(!R||!R.startDate||!R.endDate)return null;let K=Y.findIndex(Ne=>Ne.id===S),se=le(R),pe=le(L),me=se.x+se.width,Le=K*a+28,Z=pe.x,Ze=$*a+28;return jsxRuntime.jsx(es,{x1:me,y1:Le,x2:Z,y2:Ze,theme:t,lineStyle:i,onDelete:()=>k?.(L.id,S)},`dep-${S}-${L.id}`)})),x.map(L=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:L.previewX,y:L.y-48,width:L.width,height:32,rx:8,fill:L.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(L.daysDelta)>0&&jsxRuntime.jsx("text",{x:L.previewX+L.width/2,y:L.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:L.daysDelta>0?`+${L.daysDelta}d`:`${L.daysDelta}d`})]},`cascade-preview-${L.taskId}`)),ve>=0&&ve<=I&&jsxRuntime.jsx("line",{x1:ve,y1:0,x2:ve,y2:Be,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),c&&jsxRuntime.jsx(sm,{tooltipData:c,theme:t})]})]})}var ih=['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"'],cm=()=>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"})]}),lh=()=>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"})}),dh=()=>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"})}),ch=()=>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"})}),mh=()=>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 ns({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:m,onDependencyDelete:u}){let[i,p]=react.useState(false),[d,g]=react.useState(false),[y,w]=react.useState([]),[k,h]=react.useState(""),[b,x]=react.useState(false),[f,c]=react.useState(true),C=react.useRef(null),D=react.useRef(null),T=react.useRef(null),{enabled:v=true,placeholder:I='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:N,suggestions:G=ih,maxHistory:H=50,persistHistory:Y}=a,le=Y?.storageKey||"gantt-ai-history",re=Y?.maxMessages??5;react.useEffect(()=>{if(Y?.enabled)try{let $=localStorage.getItem(le);if($){let R=JSON.parse($).map(K=>({...K,timestamp:new Date(K.timestamp)}));w(R.slice(-re));}}catch($){console.warn("[GanttAIAssistant] Failed to load persisted history:",$);}},[Y?.enabled,le,re]),react.useEffect(()=>{if(Y?.enabled&&y.length>0)try{let $=y.filter(S=>!S.isLoading).slice(-re);localStorage.setItem(le,JSON.stringify($));}catch($){console.warn("[GanttAIAssistant] Failed to persist history:",$);}},[y,Y?.enabled,le,re]),react.useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"});},[y]),react.useEffect(()=>{i&&!d&&C.current&&setTimeout(()=>C.current?.focus(),100);},[i,d]);let oe=react.useCallback($=>{if($.success)switch($.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":$.taskId&&$.updates&&o?.($.taskId,$.updates);break;case "create_task":$.newTask&&s?.($.newTask);break;case "delete_task":$.taskId&&n?.($.taskId);break;case "link_tasks":$.dependencyFrom&&$.dependencyTo&&m?.($.dependencyFrom,$.dependencyTo);break;case "unlink_tasks":$.taskId&&$.dependencyFrom&&u?.($.taskId,$.dependencyFrom);break}},[o,s,n,m,u]),be=react.useCallback(async $=>{if(!$.trim()||b)return;let S={id:`user-${Date.now()}`,role:"user",content:$,timestamp:new Date};w(K=>[...K.slice(-(H-1)),S]),h(""),c(false),x(true);let R={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};w(K=>[...K,R]);try{if(N){let K=await N($,e);w(se=>{let pe=se.filter(Le=>!Le.isLoading),me={id:`assistant-${Date.now()}`,role:"assistant",content:K.message,timestamp:new Date,command:K};return [...pe,me]}),oe(K);}else w(K=>[...K.filter(pe=>!pe.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(K){w(se=>[...se.filter(me=>!me.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${K instanceof Error?K.message:"Unknown error"}`,timestamp:new Date}]);}finally{x(false);}},[b,H,N,e,oe]),ve=$=>{$.preventDefault(),be(k);},Be=$=>{h($),C.current?.focus();};if(react.useEffect(()=>{let $=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),p(R=>!R),i||g(false)),S.key==="Escape"&&i&&p(false);};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[i]),react.useEffect(()=>{if(!i)return;let $=R=>{let K=R.target;T.current&&!T.current.contains(K)&&p(false);},S=setTimeout(()=>{document.addEventListener("mousedown",$);},100);return ()=>{clearTimeout(S),document.removeEventListener("mousedown",$);}},[i]),!v)return null;let L={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(bt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${L[B]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>p(true),children:[jsxRuntime.jsx(cm,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:T,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${L[B]} 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(cm,{}),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($=>!$),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(ch,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(dh,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[y.length===0&&f&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:G.slice(0,4).map(($,S)=>jsxRuntime.jsx("button",{onClick:()=>Be($),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:$.length>30?$.slice(0,30)+"...":$},S))})]}),y.map($=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${$.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${$.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:$.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:$.role==="user"?"white":t.textPrimary},children:[$.isLoading?jsxRuntime.jsx(mh,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:$.content}),$.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:$.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:$.command.success?"#10B981":"#EF4444"},children:[$.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:$.command.type.replace(/_/g," ")})]})]})},$.id)),jsxRuntime.jsx("div",{ref:D})]}),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:C,type:"text",value:k,onChange:$=>h($.target.value),placeholder:I,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!k.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:k.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:k.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(lh,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function mm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,p=true)=>{r(d=>{let g=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:g};if(!p)return {...d,present:g};let y=[...d.past,d.present];return y.length>t&&y.shift(),{past:y,present:g,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let p=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:p,future:[i.present,...i.future]}});},[]),m=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let p=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:p,future:d}});},[]),u=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:u}}function pm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,u=m?n.metaKey:n.ctrlKey;if(u&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!m&&u&&n.key==="y"){n.preventDefault(),t();return}if(m&&u&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var fh={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ke.formatDate(e.startDate)} - ${ke.formatDate(e.endDate)}`);let a=ke.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=>ke.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function um(e){return {...fh,...e}}var Ch=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},bm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:m="comfortable",showThemeSelector:u=true,showExportButton:i=true,availableUsers:p=[],templates:d,enableAutoCriticalPath:g=true,persistExpandedState:y,persistFilter:w,aiAssistant:k,locale:h="en",customTranslations:b,showCreateTaskButton:x=false,createTaskLabel:f,onCreateTask:c,taskFilter:C,onTaskFilterChange:D,onThemeChange:T,onTaskClick:v,onTaskDblClick:I,onTaskContextMenu:B,onTaskUpdate:N,onProgressChange:G,onTaskEdit:H,onTaskAddSubtask:Y,onTaskMarkIncomplete:le,onTaskSetInProgress:re,onDependencyCreate:oe,onDependencyDelete:be,onBeforeTaskAdd:ve,onAfterTaskAdd:Be,onBeforeTaskUpdate:L,onAfterTaskUpdate:$,onBeforeTaskDelete:S,onAfterTaskDelete:R}=a,se=react.useContext(Wn)?.theme,[pe,me]=react.useState(se||s||"dark"),[Le,Z]=react.useState(n),[Ze,Ne]=react.useState(m),[Xe,pt]=react.useState(1),wt=react.useCallback(()=>w?typeof w=="string"?w:"gantt-filter-state":null,[w]),[Qe,gt]=react.useState(()=>{if(!w)return "all";try{let E=typeof w=="string"?w:"gantt-filter-state",A=localStorage.getItem(E);if(A){let V=JSON.parse(A);if(V.taskFilter)return V.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),Nt=C??Qe,Pt=D??gt,[it,O]=react.useState(()=>{if(!w)return false;try{let E=typeof w=="string"?w:"gantt-filter-state",A=localStorage.getItem(E);if(A){let V=JSON.parse(A);if(typeof V.hideCompleted=="boolean")return V.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});react.useEffect(()=>{let E=wt();if(E)try{let A={taskFilter:Nt,hideCompleted:it};localStorage.setItem(E,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving filter state to localStorage:",A);}},[Nt,it,wt]);let[ce,we]=react.useState(0),[$e,Ke]=react.useState(false),[ft,X]=react.useState(null),[te,Ye]=react.useState({isOpen:false,x:0,y:0,task:null}),[ze,et]=react.useState(null),[st,Re]=react.useState(null);react.useEffect(()=>{se&&se!==pe&&me(se);},[se]),react.useEffect(()=>{s&&s!==pe&&me(s);},[s]);let qe=react.useCallback(E=>{me(E),T?.(E);},[T]),{state:ne,setState:Ge,undo:ca,redo:ue,canUndo:Ve,canRedo:Oe,clearHistory:P}=mm(t,50),ee=react.useCallback(()=>y?typeof y=="string"?y:"gantt-expanded-tasks":null,[y]),xe=react.useRef(new Map),z=react.useRef(false);if(!z.current&&y){z.current=true;let E=typeof y=="string"?y:"gantt-expanded-tasks";try{let A=localStorage.getItem(E);if(A){let V=JSON.parse(A);Array.isArray(V)&&(xe.current=new Map(V));}}catch(A){console.warn("[GanttBoard] Error loading expanded state from localStorage:",A);}}let j=react.useCallback(()=>{let E=ee();if(E)try{let A=Array.from(xe.current.entries());localStorage.setItem(E,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving expanded state to localStorage:",A);}},[ee]);react.useEffect(()=>{let E=A=>A.map(V=>{let ie=xe.current.get(V.id),he=ie!==void 0?{...V,isExpanded:ie}:V;return he.subtasks?.length?{...he,subtasks:E(he.subtasks)}:he});xe.current.size>0?Ge(E(t)):Ge(t);},[t,Ge]);let ge=react.useRef(t),Ie=react.useRef(true);react.useEffect(()=>{if(Ie.current){Ie.current=false,ge.current=ne;return}if(!r)return;let E=JSON.stringify(ge.current),A=JSON.stringify(ne);E!==A&&(ge.current=ne,r(ne));},[ne,r]);let Te=react.useMemo(()=>Ii(h,b),[h,b]),U=react.useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[ae,Ue]=react.useState(()=>U(Te));react.useEffect(()=>{Ue(E=>E.map(A=>({...A,label:Te.columns[A.id==="name"?"taskName":A.id]||A.label})));},[Te]);let Dt=react.useMemo(()=>ae.filter(A=>A.visible).reduce((A,V)=>A+V.width,0),[ae]),dt=react.useRef(ae.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=ae.filter(ie=>ie.visible),A=E.map(ie=>ie.id).join(","),V=dt.current;if(A!==V){let ie=E.some(Ee=>Ee.id!=="name"),he=V.includes(",");ie?!he&&ie&&X(null):X(null),dt.current=A;}},[ae]);let Sr=60,fr=.6,za=react.useMemo(()=>{let A=Dt+Sr,V=typeof window<"u"?window.innerWidth*fr:800,ie=Math.max(A,V);return ft!==null?Math.max(200,Math.min(ft,ie)):Math.max(200,A)},[ft,Dt]),F=react.useRef(null),_=react.useRef(null),Pe=react.useRef(null),Me=react.useMemo(()=>Rc(pe),[pe]),Ut=react.useMemo(()=>({theme:Me,themeName:pe}),[Me,pe]),fe=react.useMemo(()=>um(d),[d]),_e=react.useMemo(()=>{if(!g)return ne;let E=ke.calculateCriticalPath(ne),A=V=>V.map(ie=>({...ie,isCriticalPath:E.includes(ie.id),subtasks:ie.subtasks?A(ie.subtasks):void 0}));return A(ne)},[ne,g]),vt=react.useMemo(()=>{if(Nt==="all"&&!it)return _e;let E=A=>{let V=[];for(let ie of A){let he=ie.subtasks?.length?E(ie.subtasks):void 0,Ee=false;if(it)Ee=ie.progress<100;else switch(Nt){case "all":Ee=true;break;case "incomplete":Ee=ie.progress<100;break;case "in_progress":Ee=ie.progress>0&&ie.progress<100;break;case "completed":Ee=ie.progress===100;break}(Ee||he&&he.length>0)&&V.push({...ie,subtasks:he});}return V};return E(_e)},[_e,Nt,it]),We=Ch(Ze);pm({undo:ca,redo:ue,canUndo:Ve,canRedo:Oe,enabled:true}),react.useImperativeHandle(o,()=>({getTask:E=>ke.findTaskById(ne,E),addTask:(E,A)=>{Ge(V=>{if(!A)return [...V,{...E,level:0}];let ie=he=>he.map(Ee=>Ee.id===A?{...Ee,subtasks:[...Ee.subtasks||[],{...E,parentId:A,level:(Ee.level||0)+1}],isExpanded:true}:Ee.subtasks?{...Ee,subtasks:ie(Ee.subtasks)}:Ee);return ie(V)});},updateTask:(E,A)=>{Ge(V=>{let ie=he=>he.map(Ee=>Ee.id===E?{...Ee,...A}:Ee.subtasks?{...Ee,subtasks:ie(Ee.subtasks)}:Ee);return ie(V)});},deleteTask:E=>{Ge(A=>{let V=ie=>ie.filter(he=>he.id===E?false:(he.subtasks&&(he.subtasks=V(he.subtasks)),true));return V(A)});},deleteTasks:E=>{Ge(A=>Vi(A,E));},duplicateTask:E=>{Ge(A=>ji(A,[E]));},splitTask:(E,A,V=3)=>{Ge(ie=>ke.splitTask(ie,E,A,V));},calculateEndDate:ke.calculateEndDate,calculateDuration:ke.calculateDuration,validateDependency:(E,A)=>!ke.validateDependencies(ne,E,A),getAllTasks:()=>ke.flattenTasks(ne),getTasksByStatus:E=>ke.flattenTasks(ne).filter(A=>A.status===E),getTasksByParent:E=>E?ke.findTaskById(ne,E)?.subtasks||[]:ne.filter(V=>!V.parentId),getCriticalPath:()=>ke.flattenTasks(ne).filter(E=>E.isCriticalPath),indentTask:E=>{Ge(A=>Wi(A,[E]));},outdentTask:E=>{Ge(A=>Gi(A,[E]));},moveTask:(E,A)=>{Ge(V=>_i(V,[E],A));},createSubtask:async E=>{let{tasks:A,newTask:V}=qi(ne,E);if(ve){let ie=ve({...V,parentId:E});if((ie instanceof Promise?await ie:ie)===false)return}Ge(A),Be&&Be({...V,parentId:E});},scrollToTask:E=>{let V=ke.flattenTasks(ne).findIndex(ie=>ie.id===E);if(V!==-1&&F.current){let ie=V*We;F.current.scrollTo({top:ie,behavior:"smooth"}),_.current&&_.current.scrollTo({top:ie,behavior:"smooth"});}},highlightTask:(E,A=2e3)=>{},expandTask:E=>{Ge(A=>{let V=ie=>ie.map(he=>he.id===E?{...he,isExpanded:true}:he.subtasks?{...he,subtasks:V(he.subtasks)}:he);return V(A)});},collapseTask:E=>{Ge(A=>{let V=ie=>ie.map(he=>he.id===E?{...he,isExpanded:false}:he.subtasks?{...he,subtasks:V(he.subtasks)}:he);return V(A)});},expandAll:()=>{Ge(E=>{let A=V=>V.map(ie=>({...ie,isExpanded:true,subtasks:ie.subtasks?A(ie.subtasks):void 0}));return A(E)});},collapseAll:()=>{Ge(E=>{let A=V=>V.map(ie=>({...ie,isExpanded:false,subtasks:ie.subtasks?A(ie.subtasks):void 0}));return A(E)});},undo:ca,redo:ue,canUndo:()=>Ve,canRedo:()=>Oe,clearHistory:P,exportToPNG:async()=>{if(!Pe.current||!F.current||!_.current)throw new Error("Gantt container not found");let E=Pe.current,A=F.current.querySelector(".gantt-grid-scroll"),V=_.current,ie=A?.scrollTop||0,he=V.scrollTop,Ee=E.style.overflow,Bt=E.style.height;try{let ct=A?.querySelector(".gantt-taskgrid-content"),qt=V.querySelector("svg"),Na=ct?.scrollHeight||A?.scrollHeight||600,Sa=qt?.getBoundingClientRect().height||V.scrollHeight,to=(E.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(Na,Sa)+20;A&&(A.scrollTop=0),V.scrollTop=0,E.style.overflow="visible",E.style.height=`${to}px`,await new Promise(Rr=>setTimeout(Rr,100));let br=await fm__default.default(E,{backgroundColor:Me.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Rr=>{let ko=window.getComputedStyle(Rr),ao=parseInt(ko.zIndex,10);return !isNaN(ao)&&ao>=50||ko.position==="fixed"}});return new Promise((Rr,ko)=>{br.toBlob(ao=>{ao?Rr(ao):ko(new Error("Failed to create blob from canvas"));},"image/png");})}finally{E.style.overflow=Ee,E.style.height=Bt,A&&(A.scrollTop=ie),V.scrollTop=he;}},exportToPDF:async E=>{await ke.exportToPDF(ne,E);},exportToExcel:async E=>{await ke.exportToExcel(ne,E);},exportToJSON:()=>ke.exportToJSON(ne),exportToCSV:()=>ke.exportToCSV(ne),importFromJSON:E=>{let A=ke.importFromJSON(E);Ge(A);},getTasks:()=>ne,refresh:()=>{Ge(E=>[...E]);},clearAll:()=>{Ge([]);}}),[ne,ca,ue,Ve,Oe,P,Me,We]);let ut=react.useCallback(E=>{Ue(A=>A.map(V=>V.id===E?{...V,visible:!V.visible}:V));},[]),wa=react.useCallback((E,A)=>{Ue(V=>V.map(ie=>{if(ie.id!==E)return ie;let he=ie.minWidth??100,Ee=ie.maxWidth??800,Bt=Math.max(he,Math.min(Ee,A));return {...ie,width:Bt}}));},[]),Ta=react.useCallback(E=>{Ge(A=>{let V=Yi(A,E),ie=he=>{for(let Ee of he){if(Ee.id===E){xe.current.set(E,Ee.isExpanded??true);return}Ee.subtasks?.length&&ie(Ee.subtasks);}};return ie(V),j(),V}),a.onTaskToggleExpand?.(E);},[a,j]),Ft=react.useCallback((E,A)=>{if(L&&L(E,A)===false)return;let ie=ke.findTaskById(ne,E)?.progress,he=Bt=>Bt.map(ct=>ct.id===E?{...ct,...A}:ct.subtasks?{...ct,subtasks:he(ct.subtasks)}:ct);Ge(he(ne));let Ee=ke.findTaskById(he(ne),E);Ee&&(N?.(Ee),$?.(Ee),A.progress!==void 0&&ie!==void 0&&A.progress!==ie&&G?.(E,ie,A.progress));},[ne,N,L,$,G]),Je=react.useCallback(E=>{E.length!==0&&(Ge(A=>Wi(A,E)),a.onTaskIndent?.(E[0]));},[a]),Yt=react.useCallback(E=>{E.length!==0&&(Ge(A=>Gi(A,E)),a.onTaskOutdent?.(E[0]));},[a]),ga=react.useCallback((E,A,V)=>{Ge(ie=>Zc(ie,E,A,V)),a.onTaskReparent?.(E,A,V);},[a]),Ir=react.useCallback((E,A)=>{E.length!==0&&(Ge(V=>_i(V,E,A)),a.onTaskMove?.(E[0],A));},[a]),Ms=react.useCallback(async E=>{let A=[];for(let V of E)S&&await Promise.resolve(S(V))===false||A.push(V);A.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(A):(Ge(V=>Vi(V,A)),A.forEach(V=>a.onTaskDelete?.(V))),R&&A.forEach(V=>R(V)));},[a,S,R]),ku=react.useCallback(E=>{Ge(A=>ji(A,E)),E.forEach(A=>a.onTaskDuplicate?.(A));},[a]),Cu=react.useCallback((E,A)=>{Ge(V=>{let{tasks:ie,newTask:he}=Jc(V,E,A);return ve&&ve(he)===false?V:(a.onTaskCreate?.(he.parentId,he.position||0),Be?.(he),ie)});},[a,ve,Be]),Tu=react.useCallback((E,A)=>{Ge(V=>Ki(V,E,A)),a.onTaskRename?.(E,A);},[a]),As=react.useCallback(E=>{Ge(A=>{let{tasks:V}=qi(A,E);return a.onTaskCreate?.(E,0),V});},[a]),Nu=react.useCallback((E,A,V)=>{let ie=E.startDate?Math.round((A.getTime()-E.startDate.getTime())/864e5):0,he=ct=>ct.map(qt=>qt.id===E.id?{...qt,startDate:A,endDate:V,...E.segments&&{segments:E.segments}}:qt.subtasks?{...qt,subtasks:he(qt.subtasks)}:qt),Ee=he(ne);Ee=ke.autoScheduleDependents(Ee,E.id,ie),Ge(Ee);let Bt={...E,startDate:A,endDate:V};N?.(Bt);},[ne,N]),Du=react.useCallback((E,A)=>{B?.(E,A),Ye({isOpen:true,x:A.clientX,y:A.clientY,task:E});},[B]),Su=react.useCallback((E,A)=>{let V=ke.splitTask(ne,E.id,A);Ge(V),Ye({isOpen:false,x:0,y:0,task:null});},[ne]),ad=react.useCallback(E=>{let A=ke.findTaskById(ne,E.id)||E;I?.(A),H||et(A);},[ne,I,H]),rd=react.useCallback((E,A,V)=>{let ie=new Map,he=Na=>{Na.forEach(Sa=>{Sa.dependencies&&ie.set(Sa.id,Sa.dependencies),Sa.subtasks&&he(Sa.subtasks);});};he(V);let Ee=ie.get(A)||[];ie.set(A,[...Ee,E]);let Bt=new Set,ct=new Set,qt=Na=>{if(!Bt.has(Na)){Bt.add(Na),ct.add(Na);let Sa=ie.get(Na)||[];for(let Br of Sa){if(!Bt.has(Br)&&qt(Br))return true;if(ct.has(Br))return true}}return ct.delete(Na),false};return qt(A)},[]),od=react.useCallback((E,A)=>{if(rd(E.id,A,ne)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
343
343
 
344
- Task dependencies must flow in one direction only.`);return}let V=oe=>oe.map(ue=>{if(ue.id===P){let Ee=ue.dependencies||[];if(!Ee.includes(D.id))return {...ue,dependencies:[...Ee,D.id]}}return ue.subtasks?{...ue,subtasks:V(ue.subtasks)}:ue});S(V(ae)),se?.(D.id,P);},[ae,se,td]),rd=react.useCallback((D,P)=>{let V=oe=>oe.map(ue=>{if(ue.id===D&&ue.dependencies){let Ee=ue.dependencies.filter(Bt=>Bt!==P);return {...ue,dependencies:Ee}}return ue.subtasks?{...ue,subtasks:V(ue.subtasks)}:ue});S(V(ae)),ye?.(D,P);},[ae,ye]),{startDate:yn,endDate:Tu}=react.useMemo(()=>{let D=ae.filter(Ee=>Ee.startDate&&Ee.endDate);if(D.length===0){let Ee=new Date,Bt=new Date(Ee);Bt.setDate(Bt.getDate()-30);let pt=new Date(Ee);return pt.setDate(pt.getDate()+60),{startDate:Bt,endDate:pt}}let P=D.flatMap(Ee=>[Ee.startDate,Ee.endDate]).filter(Ee=>Ee!==void 0),V=new Date(Math.min(...P.map(Ee=>Ee.getTime()))),oe=new Date(Math.max(...P.map(Ee=>Ee.getTime()))),ue=Le==="day"?7:Le==="week"?14:30;return V.setDate(V.getDate()-ue),oe.setDate(oe.getDate()+ue),{startDate:V,endDate:oe}},[ae,Le]),Nu=react.useCallback(async()=>{if(!Pe.current||!M.current||!H.current)return;await new Promise(eo=>setTimeout(eo,200));let D=Pe.current,P=M.current.querySelector(".gantt-grid-scroll"),V=H.current,oe=P?.scrollTop||0,ue=P?.scrollLeft||0,Ee=V.scrollTop,Bt=V.scrollLeft,pt=D.style.overflow,qt=D.style.height,wa=P?.style.overflow||"",Da=V.style.overflow,Ir=D.style.width,vn=V.style.width;try{let eo=P?.querySelector(".gantt-taskgrid-content"),br=V.querySelector("svg"),Br=br?.getAttribute("height")?parseInt(br.getAttribute("height"),10):br?.getBoundingClientRect().height||0,ko=eo?.scrollHeight||P?.scrollHeight||600,to=Math.max(Br,V.scrollHeight),sd=br?.getAttribute("width")?parseInt(br.getAttribute("width"),10):br?.getBoundingClientRect().width||V.scrollWidth,Lu=D.querySelector('[class*="h-12"]')?.offsetHeight||48,As=Math.max(ko,to,Br),Fs=Lu+As+50,Ls=(P?.offsetWidth||300)+sd+10;P&&(P.scrollTop=0,P.scrollLeft=0),V.scrollTop=0,V.scrollLeft=0,D.style.overflow="visible",D.style.height=`${Fs}px`,D.style.width=`${Ls}px`,P&&(P.style.overflow="visible",P.style.height=`${As+50}px`),V.style.overflow="visible",V.style.height=`${As+50}px`,V.style.width=`${sd+10}px`,await new Promise(Bs=>setTimeout(Bs,150));let Iu=await mm__default.default(D,{backgroundColor:Me.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:Ls,height:Fs,windowWidth:Ls+100,windowHeight:Fs+100,scrollX:0,scrollY:0,ignoreElements:Bs=>{let id=window.getComputedStyle(Bs),ld=parseInt(id.zIndex,10);return !isNaN(ld)&&ld>=50||id.position==="fixed"}}),Is=document.createElement("a");Is.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Is.href=Iu.toDataURL("image/png"),Is.click();}finally{D.style.overflow=pt,D.style.height=qt,D.style.width=Ir,P&&(P.style.overflow=wa,P.style.height="",P.scrollTop=oe,P.scrollLeft=ue),V.style.overflow=Da,V.style.height="",V.style.width=vn,V.scrollTop=Ee,V.scrollLeft=Bt;}},[Me]),Du=react.useCallback(async()=>{await ve.exportToPDF(ae);},[ae]),Su=react.useCallback(async()=>{await ve.exportToExcel(ae);},[ae]),Eu=react.useCallback(()=>{let D=ve.exportToCSV(ae),P=new Blob([D],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(P),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[ae]),Pu=react.useCallback(()=>{let D=ve.exportToJSON(ae),P=new Blob([D],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(P),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[ae]),Mu=react.useCallback(()=>{ve.exportToMSProject(ae,"Gantt Project","project.xml");},[ae]),Au=D=>{D.preventDefault(),Ze(true);},xo=react.useRef(false),[Ms,od]=react.useState(false),Wo=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let D=H.current,P=M.current?.querySelector(".gantt-grid-scroll");if(!D||!P)return;let V=()=>{if(xo.current)return;xo.current=true;let pt=D.scrollTop;Se(pt),P.scrollTop=pt,requestAnimationFrame(()=>{xo.current=false;});},oe=()=>{if(xo.current)return;xo.current=true;let pt=P.scrollTop;Se(pt),D.scrollTop=pt,requestAnimationFrame(()=>{xo.current=false;});},ue=pt=>{if(He&&P){let wa=P.parentElement?.getBoundingClientRect()?.left||0,Da=pt.clientX-wa,Ir=200,vn=St+Dr,eo=window.innerWidth*fr,br=Math.max(vn,eo);Da>=Ir&&Da<=br&&q(Da);}if(Ms&&D){let qt=pt.clientX-Wo.current.x,wa=pt.clientY-Wo.current.y;D.scrollLeft=Wo.current.scrollLeft-qt,D.scrollTop=Wo.current.scrollTop-wa;}},Ee=()=>{Ze(false),od(false);},Bt=pt=>{if(pt.button!==0)return;let qt=pt.target;qt.closest("[data-task-bar]")||qt.closest("[data-dependency-line]")||qt.closest("button")||qt.closest('[role="button"]')||qt.tagName==="rect"&&qt.getAttribute("data-clickable")==="true"||(od(true),Wo.current={x:pt.clientX,y:pt.clientY,scrollLeft:D.scrollLeft,scrollTop:D.scrollTop},pt.preventDefault());};return D.addEventListener("scroll",V),P.addEventListener("scroll",oe),D.addEventListener("mousedown",Bt),document.addEventListener("mousemove",ue),document.addEventListener("mouseup",Ee),()=>{D.removeEventListener("scroll",V),P.removeEventListener("scroll",oe),D.removeEventListener("mousedown",Bt),document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",Ee);}},[He,Ms,St]);let nd=react.useRef(false),Fu=react.useRef(null);return react.useLayoutEffect(()=>{if(nd.current||ae.length===0||!H.current)return;nd.current=true,Fu.current=yn;let D=H.current,P=new Date,V=Le==="day"?60:Le==="week"?20:8,oe=(P.getTime()-yn.getTime())/(1e3*60*60*24),ue=D.clientWidth,Bt=oe*V*Qe-ue/2;oe>=0&&ue>0&&(D.scrollLeft=Math.max(0,Bt));},[ae.length,yn,Le,Qe]),jsxRuntime.jsx(Lo.Provider,{value:Ie,children:jsxRuntime.jsx(zs.Provider,{value:Ut,children:jsxRuntime.jsxs("div",{ref:Pe,className:"flex flex-col h-full w-full",style:{backgroundColor:Me.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Gn,{theme:Me,timeScale:Le,onTimeScaleChange:te,zoom:Qe,onZoomChange:ct,currentTheme:fe,onThemeChange:qe,rowDensity:Je,onRowDensityChange:ke,showThemeSelector:u,showCreateTaskButton:g,createTaskLabel:k,onCreateTask:c,taskFilter:Mt,onTaskFilterChange:Dt,hideCompleted:Ye,onHideCompletedChange:B,onExportPNG:i?Nu:void 0,onExportPDF:i?Du:void 0,onExportExcel:i?Su:void 0,onExportCSV:i?Eu:void 0,onExportJSON:i?Pu:void 0,onExportMSProject:i?Mu:void 0}),jsxRuntime.jsxs("div",{ref:M,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:Ua,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Kn,{tasks:xt,theme:Me,rowHeight:ze,availableUsers:p,templates:pe,onTaskClick:v,onTaskDblClick:ed,onTaskContextMenu:F,onTaskToggle:ka,scrollTop:ie,columns:de,onToggleColumn:gt,onColumnResize:va,onTaskUpdate:Ft,onTaskIndent:Xe,onTaskOutdent:Yt,onTaskMove:Lr,onMultiTaskDelete:Es,onTaskDuplicate:yu,onTaskCreate:vu,onTaskRename:xu,onCreateSubtask:Ps,onOpenTaskModal:v?D=>v(D):void 0,onDeleteRequest:(D,P)=>Ue({taskId:D,taskName:P}),onTaskReparent:ua})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Me.border,zIndex:15},onMouseDown:Au}),jsxRuntime.jsx("div",{ref:H,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Ms?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(as,{tasks:xt,theme:Me,rowHeight:ze,timeScale:Le,startDate:yn,endDate:Tu,zoom:Qe,locale:h,templates:pe,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:v,onTaskDblClick:ed,onTaskContextMenu:wu,onTaskDateChange:ku,onDependencyCreate:ad,onDependencyDelete:rd})})]}),Q.task&&jsxRuntime.jsx(Io,{isOpen:Q.isOpen,x:Q.x,y:Q.y,theme:Me,onClose:()=>je({isOpen:false,x:0,y:0,task:null}),items:(()=>{let D=Q.task;if(!D)return [];let P=ve.findTaskById(ae,D.id)||D;return P.subtasks&&P.subtasks.length>0?[{id:"addSubtask",label:Ie.contextMenu?.addSubtask||"Add Subtask",icon:_t.Add,onClick:()=>{j?j(P):Ps(P.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Ie.contextMenu?.deleteTask||"Delete Task",icon:_t.Delete,onClick:()=>{Ue({taskId:P.id,taskName:P.name});}}]:[{id:"edit",label:Ie.contextMenu?.editTask||"Edit Task",icon:_t.Pencil,onClick:()=>{$?$(P):tt(P);}},{id:"addSubtask",label:Ie.contextMenu?.addSubtask||"Add Subtask",icon:_t.Add,onClick:()=>{j?j(P):Ps(P.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:Ie.contextMenu?.markIncomplete||"Mark Incomplete",icon:_t.MarkIncomplete,onClick:()=>{ne?ne(P):Ft(P.id,{status:"todo",progress:0});},disabled:P.status==="todo"},{id:"setInProgress",label:Ie.contextMenu?.setInProgress||"Set In Progress",icon:_t.SetInProgress,onClick:()=>{re?re(P):Ft(P.id,{status:"in-progress"});},disabled:P.status==="in-progress"},{id:"markComplete",label:Ie.contextMenu?.markComplete||"Mark Complete",icon:_t.MarkComplete,onClick:()=>{Ft(P.id,{status:"completed",progress:100});},disabled:P.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:Ie.contextMenu?.splitTask||"Split Task",icon:_t.Split,onClick:()=>{if(!P.startDate||!P.endDate){console.warn("Cannot split task without dates");return}let oe=P.startDate.getTime(),ue=P.endDate.getTime(),Ee=oe+(ue-oe)/2,Bt=new Date(Ee);Cu(P,Bt);},disabled:!P.startDate||!P.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Ie.contextMenu?.deleteTask||"Delete Task",icon:_t.Delete,onClick:()=>{Ue({taskId:P.id,taskName:P.name});}}]})()}),jsxRuntime.jsx(lo,{task:Re,isOpen:!!Re,onClose:()=>tt(null),onTaskUpdate:D=>{Re&&(Ft(Re.id,D),tt(null));},theme:fe==="light"?"light":"dark",locale:h==="es"?"es":"en",availableUsers:p,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:lt&&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:()=>Ue(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:D=>D.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Me.bgSecondary,border:`1px solid ${Me.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Me.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:Me.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ie.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Me.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:Me.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:Me.textPrimary},children:['"',lt.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Me.bgPrimary,borderTop:`1px solid ${Me.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Ue(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Me.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor=Me.hoverBg;},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:h==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Es([lt.taskId]),Ue(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),h==="es"?"Eliminar":"Delete"]})]})]})})}),C?.enabled&&jsxRuntime.jsx(rs,{tasks:ae,theme:Me,config:C,onTasksUpdate:S,onTaskUpdate:Ft,onTaskCreate:D=>{S(P=>[...P,D]);},onTaskDelete:D=>{Es([D]);},onDependencyCreate:(D,P)=>{let V=ve.findTaskById(ae,D);V&&ad(V,P);},onDependencyDelete:rd})]})})})});var Zi=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Qi=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function bm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:m=a?"edit":"create",theme:u="dark",customStatuses:i=[],availableTags:p=[],onCreateTag:l,attachments:f=[],onUploadAttachments:y,onDeleteAttachment:x}){let C=[...Zi,...i.filter(B=>!Zi.some(ie=>ie.id===B.id))],h=rt[u]||rt.dark,[b,g]=react.useState(false),[k,c]=react.useState(false),[T,w]=react.useState(false),[R,v]=react.useState(false),[I,F]=react.useState({top:0,left:0}),[N,U]=react.useState(null),[$,j]=react.useState(new Date),[ne,re]=react.useState({top:0,left:0}),[se,ye]=react.useState(false),[be,Be]=react.useState([]),[A,O]=react.useState(false),[L,_]=react.useState(""),J=react.useRef(null),ce=react.useRef(null),fe=react.useRef(null),me=react.useRef(null),Le=react.useRef(null),[te,Je]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[ke,Qe]=react.useState({});react.useEffect(()=>{a?(Je({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)&&ye(true)):(Je({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),ye(false),Be([]));},[a,e]),react.useEffect(()=>{let B=ie=>{J.current&&!J.current.contains(ie.target)&&g(false),ce.current&&!ce.current.contains(ie.target)&&c(false),fe.current&&!fe.current.contains(ie.target)&&w(false),me.current&&!me.current.contains(ie.target)&&v(false);};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);let ct=()=>{let B={};return te.name.trim()||(B.name="El nombre es requerido"),te.startDate&&te.endDate&&te.startDate>te.endDate&&(B.endDate="La fecha de fin debe ser posterior a la de inicio"),Qe(B),Object.keys(B).length===0},ft=async B=>{if(B.preventDefault(),!!ct())try{let ie=m==="create"&&be.length>0?{...te,pendingFiles:be}:te;await s(ie),Be([]),t();}catch(ie){console.error("Error submitting task:",ie);}},et=(B,ie)=>{Je(Se=>{let He={...Se,[B]:ie};if(B==="status"){let Ze=ie;Ze==="todo"?He.progress=0:Ze==="in-progress"?(Se.progress===0||Se.progress===100)&&(He.progress=50):Ze==="completed"||Ze==="closed"?He.progress=100:(Ze==="in-review"||Ze==="review")&&(He.progress=75);}if(B==="progress"){let Ze=typeof ie=="number"?ie:parseInt(ie,10);Ze===100&&Se.status!=="completed"?He.status="completed":Ze>0&&Ze<100&&Se.status==="todo"?He.status="in-progress":Ze===0&&Se.status!=="todo"&&(He.status="todo");}return He}),ke[B]&&Qe(Se=>{let He={...Se};return delete He[B],He});},wt=C.find(B=>B.id===te.status)??Zi[0],Mt=Qi.find(B=>B.id===te.priority)??Qi[1],Dt=yr.find(B=>B.value===te.color)??yr[0],Ye={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":u,style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},onClick:B=>B.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:wt.color||h.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:h.textSecondary},children:m==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:h.textTertiary},onMouseEnter:B=>{B.currentTarget.style.backgroundColor=h.hoverBg,B.currentTarget.style.color=h.textPrimary;},onMouseLeave:B=>{B.currentTarget.style.backgroundColor="transparent",B.currentTarget.style.color=h.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:ft,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:te.name,onChange:B=>et("name",B.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:h.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),ke.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"}),ke.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:te.description||"",onChange:B=>et("description",B.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:h.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${h.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:J,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&g(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...Ye,borderColor:wt.color,backgroundColor:`${wt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:wt.color}}),jsxRuntime.jsx("span",{style:{color:wt.color},children:wt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:wt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},children:C.map(B=>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:()=>{et("status",B.id),g(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:B.color}}),B.title,te.status===B.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},B.id))})})]}),jsxRuntime.jsxs("div",{ref:ce,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&c(!k),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ye,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:Mt.color}}),jsxRuntime.jsx("span",{children:Mt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},children:Qi.map(B=>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:()=>{et("priority",B.id),c(false);},children:[jsxRuntime.jsx("span",{children:B.icon}),B.label,te.priority===B.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},B.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:fe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!T),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ye,disabled:n,children:[te.assignees&&te.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:te.assignees.slice(0,3).map((B,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:B.color||h.accent,borderColor:h.bgSecondary},children:B.initials},ie))}),te.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:h.textTertiary},children:["+",te.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: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:h.bgPrimary,border:`1px solid ${h.border}`},children:o.map(B=>{let ie=te.assignees?.some(Se=>Se.name===B.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:Se=>Se.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:Se=>Se.currentTarget.style.backgroundColor="transparent",onClick:()=>{let Se=ie?(te.assignees||[]).filter(He=>He.name!==B.name):[...te.assignees||[],{name:B.name,avatar:B.avatar,initials:B.name.split(" ").map(He=>He[0]).join("").toUpperCase().slice(0,2),color:h.accent}];et("assignees",Se);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:h.accent},children:B.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:B.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}})})]},B.id)})})})]}),jsxRuntime.jsxs("div",{ref:me,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(R)v(false);else {if(me.current){let B=me.current.getBoundingClientRect(),ie=window.innerHeight,Se=120,Ze=ie-B.bottom<Se?B.top-Se-8:B.bottom+8;F({top:Ze,left:B.left});}v(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ye,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:te.color}}),jsxRuntime.jsx("span",{children:Dt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&jsxRuntime.jsxs(ht,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>v(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${I.top}px`,left:`${I.left}px`,zIndex:99999,backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:B=>B.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:yr.slice(0,18).map(B=>{let ie=te.color===B.value;return jsxRuntime.jsx("button",{type:"button",onClick:Se=>{Se.preventDefault(),Se.stopPropagation(),et("color",B.value),v(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:B.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:B.value,outline:ie?`2px solid ${B.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},B.value)})})})})]})})]}),p.length>0||l?jsxRuntime.jsx(hr,{selectedTags:te.tags||[],availableTags:p,onChange:B=>et("tags",B),onCreateTag:l,theme:h,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:h.textTertiary}}),jsxRuntime.jsxs("div",{ref:Le,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!te.isMilestone)if(N==="start")U(null);else {if(Le.current){let B=Le.current.getBoundingClientRect(),ie=window.innerHeight,Se=320,Ze=ie-B.bottom<Se?B.top-Se-8:B.bottom+8;re({top:Ze,left:B.left});}U("start"),j(te.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ye,opacity:te.isMilestone?.5:1,cursor:te.isMilestone?"not-allowed":"pointer"},disabled:n||te.isMilestone,children:te.startDate?te.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:h.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!te.isMilestone)if(N==="end")U(null);else {if(Le.current){let B=Le.current.getBoundingClientRect(),ie=window.innerHeight,Se=320,Ze=ie-B.bottom<Se?B.top-Se-8:B.bottom+8;re({top:Ze,left:B.left});}U("end"),j(te.endDate||te.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ye,opacity:te.isMilestone?.5:1,cursor:te.isMilestone?"not-allowed":"pointer"},disabled:n||te.isMilestone,children:te.endDate?te.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(ht,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>U(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:`${ne.top}px`,left:`${ne.left}px`,zIndex:99999,backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${h.border}`},children:[(()=>{let B=new Date,ie=new Date(B);ie.setDate(B.getDate()+1);let Se=new Date(B);Se.setDate(B.getDate()+7);let He=new Date(B);return He.setDate(B.getDate()+14),[{label:"Hoy",date:B},{label:"Ma\xF1ana",date:ie},{label:"Pr\xF3xima semana",date:Se},{label:"2 semanas",date:He}].map((bt,q)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:h.textPrimary},onMouseEnter:Q=>Q.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:Q=>Q.currentTarget.style.backgroundColor="transparent",onClick:()=>{N==="start"?(et("startDate",bt.date),(!te.endDate||bt.date>te.endDate)&&et("endDate",bt.date),U("end")):(et("endDate",bt.date),(!te.startDate||bt.date<te.startDate)&&et("startDate",bt.date),U(null));},children:bt.label},q))})(),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:B=>B.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{et("startDate",void 0),et("endDate",void 0),U(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>j(new Date($.getFullYear(),$.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:$.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>j(new Date($.getFullYear(),$.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:h.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((B,ie)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:h.textTertiary},children:B},ie))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let B=$.getFullYear(),ie=$.getMonth(),Se=new Date(B,ie,1).getDay(),He=new Date(B,ie+1,0).getDate(),Ze=new Date,bt=[];for(let Q=Se-1;Q>=0;Q--)bt.push({day:new Date(B,ie,-Q).getDate(),date:new Date(B,ie-1,new Date(B,ie,-Q).getDate()),isCurrentMonth:false});for(let Q=1;Q<=He;Q++)bt.push({day:Q,date:new Date(B,ie,Q),isCurrentMonth:true});let q=42-bt.length;for(let Q=1;Q<=q;Q++)bt.push({day:Q,date:new Date(B,ie+1,Q),isCurrentMonth:false});return bt.map((Q,je)=>{let Re=Q.date.toDateString()===Ze.toDateString(),tt=te.startDate?.toDateString()===Q.date.toDateString(),lt=te.endDate?.toDateString()===Q.date.toDateString(),Ue=te.startDate&&te.endDate&&Q.date>=te.startDate&&Q.date<=te.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:Q.isCurrentMonth?tt||lt?"#FFF":h.textPrimary:h.textTertiary,backgroundColor:tt?"#3B82F6":lt?"#7C3AED":Ue?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Re&&!tt&&!lt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{N==="start"?(et("startDate",Q.date),te.endDate&&Q.date>te.endDate&&et("endDate",Q.date),U("end")):(et("endDate",Q.date),te.startDate&&Q.date<te.startDate&&et("startDate",Q.date),U(null));},children:Q.day},je)})})()})]})]})]})})]}),ke.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:ke.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:te.progress,onChange:B=>et("progress",parseInt(B.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:h.bgSecondary,accentColor:te.progress<30?"#EF4444":te.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${te.progress<30?"#EF4444":te.progress<70?"#F59E0B":"#10B981"}20`,color:te.progress<30?"#EF4444":te.progress<70?"#F59E0B":"#10B981"},children:[te.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>ye(!se),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 ${se?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:se&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[(y||f.length>0||m==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color: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 ",m==="create"?be.length>0&&`(${be.length})`:f.length>0&&`(${f.length})`]})]}),m==="create"?jsxRuntime.jsx(kr,{cardId:"pending",attachments:be.map((B,ie)=>({id:`pending-${ie}`,cardId:"pending",name:B.name,size:B.size,type:B.type,url:URL.createObjectURL(B),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:B=>Be(ie=>[...ie,...B]),onDelete:B=>{let ie=parseInt(B.replace("pending-",""),10);Be(Se=>Se.filter((He,Ze)=>Ze!==ie));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(kr,{cardId:a?.id||"new",attachments:f,onUpload:y&&a?.id?B=>y(a.id,B):void 0,onDelete:x,maxSizeMB:10,maxFiles:20}),m==="create"&&be.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:h.textTertiary},children:[be.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:te.isMilestone,onChange:B=>et("isMilestone",B.target.checked),className:"w-4 h-4 rounded",style:{accentColor:h.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:h.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",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"]}),te.dependencies&&te.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:te.dependencies.map(B=>{let ie=r.find(Se=>Se.id===B);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${h.accent}20`,color:h.accent},children:[ie?.name||B.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let Se=(te.dependencies||[]).filter(He=>He!==B);et("dependencies",Se);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},B)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{O(!A),_("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:h.bgSecondary,color:h.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:A&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{O(false),_("");}}),jsxRuntime.jsxs(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 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${h.border}`},children:jsxRuntime.jsx("input",{type:"text",value:L,onChange:B=>_(B.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:h.bgSecondary,color:h.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(B=>B.id!==a?.id).filter(B=>L===""||B.name.toLowerCase().includes(L.toLowerCase())).map(B=>{let ie=te.dependencies?.includes(B.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let Se=te.dependencies||[],He;ie?He=Se.filter(Ze=>Ze!==B.id):He=[...Se,B.id],et("dependencies",He);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:ie?`${h.accent}10`:"transparent"},onMouseEnter:Se=>{ie||(Se.currentTarget.style.backgroundColor=h.hoverBg);},onMouseLeave:Se=>{Se.currentTarget.style.backgroundColor=ie?`${h.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:ie?h.accent:"transparent",borderColor:ie?h.accent:h.borderLight},children:ie&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:h.textPrimary},children:B.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:h.textTertiary},children:B.id.slice(0,8)})]})]},B.id)}),r.filter(B=>B.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:h.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),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:B=>B.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:h.accent,color:"#FFF"},onMouseEnter:B=>!n&&(B.currentTarget.style.opacity="0.9"),onMouseLeave:B=>!n&&(B.currentTarget.style.opacity="1"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:m==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var hm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
344
+ Task dependencies must flow in one direction only.`);return}let V=ie=>ie.map(he=>{if(he.id===A){let Ee=he.dependencies||[];if(!Ee.includes(E.id))return {...he,dependencies:[...Ee,E.id]}}return he.subtasks?{...he,subtasks:V(he.subtasks)}:he});Ge(V(ne)),oe?.(E.id,A);},[ne,oe,rd]),nd=react.useCallback((E,A)=>{let V=ie=>ie.map(he=>{if(he.id===E&&he.dependencies){let Ee=he.dependencies.filter(Bt=>Bt!==A);return {...he,dependencies:Ee}}return he.subtasks?{...he,subtasks:V(he.subtasks)}:he});Ge(V(ne)),be?.(E,A);},[ne,be]),{startDate:xn,endDate:Eu}=react.useMemo(()=>{let E=ne.filter(Ee=>Ee.startDate&&Ee.endDate);if(E.length===0){let Ee=new Date,Bt=new Date(Ee);Bt.setDate(Bt.getDate()-30);let ct=new Date(Ee);return ct.setDate(ct.getDate()+60),{startDate:Bt,endDate:ct}}let A=E.flatMap(Ee=>[Ee.startDate,Ee.endDate]).filter(Ee=>Ee!==void 0),V=new Date(Math.min(...A.map(Ee=>Ee.getTime()))),ie=new Date(Math.max(...A.map(Ee=>Ee.getTime()))),he=Le==="day"?7:Le==="week"?14:30;return V.setDate(V.getDate()-he),ie.setDate(ie.getDate()+he),{startDate:V,endDate:ie}},[ne,Le]),Pu=react.useCallback(async()=>{if(!Pe.current||!F.current||!_.current)return;await new Promise(to=>setTimeout(to,200));let E=Pe.current,A=F.current.querySelector(".gantt-grid-scroll"),V=_.current,ie=A?.scrollTop||0,he=A?.scrollLeft||0,Ee=V.scrollTop,Bt=V.scrollLeft,ct=E.style.overflow,qt=E.style.height,Na=A?.style.overflow||"",Sa=V.style.overflow,Br=E.style.width,wn=V.style.width;try{let to=A?.querySelector(".gantt-taskgrid-content"),br=V.querySelector("svg"),Rr=br?.getAttribute("height")?parseInt(br.getAttribute("height"),10):br?.getBoundingClientRect().height||0,ko=to?.scrollHeight||A?.scrollHeight||600,ao=Math.max(Rr,V.scrollHeight),ld=br?.getAttribute("width")?parseInt(br.getAttribute("width"),10):br?.getBoundingClientRect().width||V.scrollWidth,Ou=E.querySelector('[class*="h-12"]')?.offsetHeight||48,Ls=Math.max(ko,ao,Rr),Is=Ou+Ls+50,Bs=(A?.offsetWidth||300)+ld+10;A&&(A.scrollTop=0,A.scrollLeft=0),V.scrollTop=0,V.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Is}px`,E.style.width=`${Bs}px`,A&&(A.style.overflow="visible",A.style.height=`${Ls+50}px`),V.style.overflow="visible",V.style.height=`${Ls+50}px`,V.style.width=`${ld+10}px`,await new Promise(Os=>setTimeout(Os,150));let $u=await fm__default.default(E,{backgroundColor:Me.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:Bs,height:Is,windowWidth:Bs+100,windowHeight:Is+100,scrollX:0,scrollY:0,ignoreElements:Os=>{let dd=window.getComputedStyle(Os),cd=parseInt(dd.zIndex,10);return !isNaN(cd)&&cd>=50||dd.position==="fixed"}}),Rs=document.createElement("a");Rs.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Rs.href=$u.toDataURL("image/png"),Rs.click();}finally{E.style.overflow=ct,E.style.height=qt,E.style.width=Br,A&&(A.style.overflow=Na,A.style.height="",A.scrollTop=ie,A.scrollLeft=he),V.style.overflow=Sa,V.style.height="",V.style.width=wn,V.scrollTop=Ee,V.scrollLeft=Bt;}},[Me]),Mu=react.useCallback(async()=>{await ke.exportToPDF(ne);},[ne]),Au=react.useCallback(async()=>{await ke.exportToExcel(ne);},[ne]),Fu=react.useCallback(()=>{let E=ke.exportToCSV(ne),A=new Blob([E],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(A),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[ne]),Lu=react.useCallback(()=>{let E=ke.exportToJSON(ne),A=new Blob([E],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(A),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[ne]),Iu=react.useCallback(()=>{ke.exportToMSProject(ne,"Gantt Project","project.xml");},[ne]),Bu=E=>{E.preventDefault(),Ke(true);},wo=react.useRef(false),[Fs,sd]=react.useState(false),Go=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=_.current,A=F.current?.querySelector(".gantt-grid-scroll");if(!E||!A)return;let V=()=>{if(wo.current)return;wo.current=true;let ct=E.scrollTop;we(ct),A.scrollTop=ct,requestAnimationFrame(()=>{wo.current=false;});},ie=()=>{if(wo.current)return;wo.current=true;let ct=A.scrollTop;we(ct),E.scrollTop=ct,requestAnimationFrame(()=>{wo.current=false;});},he=ct=>{if($e&&A){let Na=A.parentElement?.getBoundingClientRect()?.left||0,Sa=ct.clientX-Na,Br=200,wn=Dt+Sr,to=window.innerWidth*fr,br=Math.max(wn,to);Sa>=Br&&Sa<=br&&X(Sa);}if(Fs&&E){let qt=ct.clientX-Go.current.x,Na=ct.clientY-Go.current.y;E.scrollLeft=Go.current.scrollLeft-qt,E.scrollTop=Go.current.scrollTop-Na;}},Ee=()=>{Ke(false),sd(false);},Bt=ct=>{if(ct.button!==0)return;let qt=ct.target;qt.closest("[data-task-bar]")||qt.closest("[data-dependency-line]")||qt.closest("button")||qt.closest('[role="button"]')||qt.tagName==="rect"&&qt.getAttribute("data-clickable")==="true"||(sd(true),Go.current={x:ct.clientX,y:ct.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},ct.preventDefault());};return E.addEventListener("scroll",V),A.addEventListener("scroll",ie),E.addEventListener("mousedown",Bt),document.addEventListener("mousemove",he),document.addEventListener("mouseup",Ee),()=>{E.removeEventListener("scroll",V),A.removeEventListener("scroll",ie),E.removeEventListener("mousedown",Bt),document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",Ee);}},[$e,Fs,Dt]);let id=react.useRef(false),Ru=react.useRef(null);return react.useLayoutEffect(()=>{if(id.current||ne.length===0||!_.current)return;id.current=true,Ru.current=xn;let E=_.current,A=new Date,V=Le==="day"?60:Le==="week"?20:8,ie=(A.getTime()-xn.getTime())/(1e3*60*60*24),he=E.clientWidth,Bt=ie*V*Xe-he/2;ie>=0&&he>0&&(E.scrollLeft=Math.max(0,Bt));},[ne.length,xn,Le,Xe]),jsxRuntime.jsx(Io.Provider,{value:Te,children:jsxRuntime.jsx(Ws.Provider,{value:Ut,children:jsxRuntime.jsxs("div",{ref:Pe,className:"flex flex-col h-full w-full",style:{backgroundColor:Me.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Vn,{theme:Me,timeScale:Le,onTimeScaleChange:Z,zoom:Xe,onZoomChange:pt,currentTheme:pe,onThemeChange:qe,rowDensity:Ze,onRowDensityChange:Ne,showThemeSelector:u,showCreateTaskButton:x,createTaskLabel:f,onCreateTask:c,taskFilter:Nt,onTaskFilterChange:Pt,hideCompleted:it,onHideCompletedChange:O,onExportPNG:i?Pu:void 0,onExportPDF:i?Mu:void 0,onExportExcel:i?Au:void 0,onExportCSV:i?Fu:void 0,onExportJSON:i?Lu:void 0,onExportMSProject:i?Iu:void 0}),jsxRuntime.jsxs("div",{ref:F,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:za,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(qn,{tasks:vt,theme:Me,rowHeight:We,availableUsers:p,templates:fe,onTaskClick:v,onTaskDblClick:ad,onTaskContextMenu:B,onTaskToggle:Ta,scrollTop:ce,columns:ae,onToggleColumn:ut,onColumnResize:wa,onTaskUpdate:Ft,onTaskIndent:Je,onTaskOutdent:Yt,onTaskMove:Ir,onMultiTaskDelete:Ms,onTaskDuplicate:ku,onTaskCreate:Cu,onTaskRename:Tu,onCreateSubtask:As,onOpenTaskModal:v?E=>v(E):void 0,onDeleteRequest:(E,A)=>Re({taskId:E,taskName:A}),onTaskReparent:ga})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Me.border,zIndex:15},onMouseDown:Bu}),jsxRuntime.jsx("div",{ref:_,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Fs?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(os,{tasks:vt,theme:Me,rowHeight:We,timeScale:Le,startDate:xn,endDate:Eu,zoom:Xe,locale:h,templates:fe,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:v,onTaskDblClick:ad,onTaskContextMenu:Du,onTaskDateChange:Nu,onDependencyCreate:od,onDependencyDelete:nd})})]}),te.task&&jsxRuntime.jsx(Bo,{isOpen:te.isOpen,x:te.x,y:te.y,theme:Me,onClose:()=>Ye({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=te.task;if(!E)return [];let A=ke.findTaskById(ne,E.id)||E;return A.subtasks&&A.subtasks.length>0?[{id:"addSubtask",label:Te.contextMenu?.addSubtask||"Add Subtask",icon:_t.Add,onClick:()=>{Y?Y(A):As(A.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Te.contextMenu?.deleteTask||"Delete Task",icon:_t.Delete,onClick:()=>{Re({taskId:A.id,taskName:A.name});}}]:[{id:"edit",label:Te.contextMenu?.editTask||"Edit Task",icon:_t.Pencil,onClick:()=>{H?H(A):et(A);}},{id:"addSubtask",label:Te.contextMenu?.addSubtask||"Add Subtask",icon:_t.Add,onClick:()=>{Y?Y(A):As(A.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:Te.contextMenu?.markIncomplete||"Mark Incomplete",icon:_t.MarkIncomplete,onClick:()=>{le?le(A):Ft(A.id,{status:"todo",progress:0});},disabled:A.status==="todo"},{id:"setInProgress",label:Te.contextMenu?.setInProgress||"Set In Progress",icon:_t.SetInProgress,onClick:()=>{re?re(A):Ft(A.id,{status:"in-progress"});},disabled:A.status==="in-progress"},{id:"markComplete",label:Te.contextMenu?.markComplete||"Mark Complete",icon:_t.MarkComplete,onClick:()=>{Ft(A.id,{status:"completed",progress:100});},disabled:A.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:Te.contextMenu?.splitTask||"Split Task",icon:_t.Split,onClick:()=>{if(!A.startDate||!A.endDate){console.warn("Cannot split task without dates");return}let ie=A.startDate.getTime(),he=A.endDate.getTime(),Ee=ie+(he-ie)/2,Bt=new Date(Ee);Su(A,Bt);},disabled:!A.startDate||!A.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Te.contextMenu?.deleteTask||"Delete Task",icon:_t.Delete,onClick:()=>{Re({taskId:A.id,taskName:A.name});}}]})()}),jsxRuntime.jsx(co,{task:ze,isOpen:!!ze,onClose:()=>et(null),onTaskUpdate:E=>{ze&&(Ft(ze.id,E),et(null));},theme:pe==="light"?"light":"dark",locale:h==="es"?"es":"en",availableUsers:p,availableTasks:t}),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:()=>Re(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Me.bgSecondary,border:`1px solid ${Me.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Me.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:Me.textPrimary,fontFamily:"Inter, sans-serif"},children:[Te.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Me.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:Me.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:Me.textPrimary},children:['"',st.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Me.bgPrimary,borderTop:`1px solid ${Me.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Re(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Me.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=Me.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:h==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Ms([st.taskId]),Re(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),h==="es"?"Eliminar":"Delete"]})]})]})})}),k?.enabled&&jsxRuntime.jsx(ns,{tasks:ne,theme:Me,config:k,onTasksUpdate:Ge,onTaskUpdate:Ft,onTaskCreate:E=>{Ge(A=>[...A,E]);},onTaskDelete:E=>{Ms([E]);},onDependencyCreate:(E,A)=>{let V=ke.findTaskById(ne,E);V&&od(V,A);},onDependencyDelete:nd})]})})})});var el=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],tl=[{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 xm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:m=a?"edit":"create",theme:u="dark",customStatuses:i=[],availableTags:p=[],onCreateTag:d,attachments:g=[],onUploadAttachments:y,onDeleteAttachment:w}){let k=[...el,...i.filter(O=>!el.some(ce=>ce.id===O.id))],h=tt[u]||tt.dark,[b,x]=react.useState(false),[f,c]=react.useState(false),[C,D]=react.useState(false),[T,v]=react.useState(false),[I,B]=react.useState({top:0,left:0}),[N,G]=react.useState(null),[H,Y]=react.useState(new Date),[le,re]=react.useState({top:0,left:0}),[oe,be]=react.useState(false),[ve,Be]=react.useState([]),[L,$]=react.useState(false),[S,R]=react.useState(""),K=react.useRef(null),se=react.useRef(null),pe=react.useRef(null),me=react.useRef(null),Le=react.useRef(null),[Z,Ze]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Ne,Xe]=react.useState({});react.useEffect(()=>{a?(Ze({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)&&be(true)):(Ze({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),be(false),Be([]));},[a,e]),react.useEffect(()=>{let O=ce=>{K.current&&!K.current.contains(ce.target)&&x(false),se.current&&!se.current.contains(ce.target)&&c(false),pe.current&&!pe.current.contains(ce.target)&&D(false),me.current&&!me.current.contains(ce.target)&&v(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let pt=()=>{let O={};return Z.name.trim()||(O.name="El nombre es requerido"),Z.startDate&&Z.endDate&&Z.startDate>Z.endDate&&(O.endDate="La fecha de fin debe ser posterior a la de inicio"),Xe(O),Object.keys(O).length===0},wt=async O=>{if(O.preventDefault(),!!pt())try{let ce=m==="create"&&ve.length>0?{...Z,pendingFiles:ve}:Z;await s(ce),Be([]),t();}catch(ce){console.error("Error submitting task:",ce);}},Qe=(O,ce)=>{Ze(we=>{let $e={...we,[O]:ce};if(O==="status"){let Ke=ce;Ke==="todo"?$e.progress=0:Ke==="in-progress"?(we.progress===0||we.progress===100)&&($e.progress=50):Ke==="completed"||Ke==="closed"?$e.progress=100:(Ke==="in-review"||Ke==="review")&&($e.progress=75);}if(O==="progress"){let Ke=typeof ce=="number"?ce:parseInt(ce,10);Ke===100&&we.status!=="completed"?$e.status="completed":Ke>0&&Ke<100&&we.status==="todo"?$e.status="in-progress":Ke===0&&we.status!=="todo"&&($e.status="todo");}return $e}),Ne[O]&&Xe(we=>{let $e={...we};return delete $e[O],$e});},gt=k.find(O=>O.id===Z.status)??el[0],Nt=tl.find(O=>O.id===Z.priority)??tl[1],Pt=vr.find(O=>O.value===Z.color)??vr[0],it={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":u,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:gt.color||h.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:h.textSecondary},children:m==="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:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:wt,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:Z.name,onChange:O=>Qe("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:n,autoFocus:true}),Ne.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"}),Ne.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:Z.description||"",onChange:O=>Qe("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:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${h.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:K,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&x(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...it,borderColor:gt.color,backgroundColor:`${gt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:gt.color}}),jsxRuntime.jsx("span",{style:{color:gt.color},children:gt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:gt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&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:k.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:ce=>ce.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{Qe("status",O.id),x(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:O.color}}),O.title,Z.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:se,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&c(!f),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:it,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:Nt.color}}),jsxRuntime.jsx("span",{children:Nt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},children:tl.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:ce=>ce.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{Qe("priority",O.id),c(false);},children:[jsxRuntime.jsx("span",{children:O.icon}),O.label,Z.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:pe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:it,disabled:n,children:[Z.assignees&&Z.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:Z.assignees.slice(0,3).map((O,ce)=>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},ce))}),Z.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:h.textTertiary},children:["+",Z.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:h.textTertiary}}),jsxRuntime.jsx("span",{style:{color:h.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&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 ce=Z.assignees?.some(we=>we.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:we=>we.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:we=>we.currentTarget.style.backgroundColor="transparent",onClick:()=>{let we=ce?(Z.assignees||[]).filter($e=>$e.name!==O.name):[...Z.assignees||[],{name:O.name,avatar:O.avatar,initials:O.name.split(" ").map($e=>$e[0]).join("").toUpperCase().slice(0,2),color:h.accent}];Qe("assignees",we);},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:ce&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:h.accent}})})]},O.id)})})})]}),jsxRuntime.jsxs("div",{ref:me,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)v(false);else {if(me.current){let O=me.current.getBoundingClientRect(),ce=window.innerHeight,we=120,Ke=ce-O.bottom<we?O.top-we-8:O.bottom+8;B({top:Ke,left:O.left});}v(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:it,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:Z.color}}),jsxRuntime.jsx("span",{children:Pt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(bt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>v(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${I.top}px`,left:`${I.left}px`,zIndex:99999,backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick: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:vr.slice(0,18).map(O=>{let ce=Z.color===O.value;return jsxRuntime.jsx("button",{type:"button",onClick:we=>{we.preventDefault(),we.stopPropagation(),Qe("color",O.value),v(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:ce?`2px solid ${O.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},O.value)})})})})]})})]}),p.length>0||d?jsxRuntime.jsx(yr,{selectedTags:Z.tags||[],availableTags:p,onChange:O=>Qe("tags",O),onCreateTag:d,theme:h,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:h.textTertiary}}),jsxRuntime.jsxs("div",{ref:Le,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!Z.isMilestone)if(N==="start")G(null);else {if(Le.current){let O=Le.current.getBoundingClientRect(),ce=window.innerHeight,we=320,Ke=ce-O.bottom<we?O.top-we-8:O.bottom+8;re({top:Ke,left:O.left});}G("start"),Y(Z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...it,opacity:Z.isMilestone?.5:1,cursor:Z.isMilestone?"not-allowed":"pointer"},disabled:n||Z.isMilestone,children:Z.startDate?Z.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:h.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!Z.isMilestone)if(N==="end")G(null);else {if(Le.current){let O=Le.current.getBoundingClientRect(),ce=window.innerHeight,we=320,Ke=ce-O.bottom<we?O.top-we-8:O.bottom+8;re({top:Ke,left:O.left});}G("end"),Y(Z.endDate||Z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...it,opacity:Z.isMilestone?.5:1,cursor:Z.isMilestone?"not-allowed":"pointer"},disabled:n||Z.isMilestone,children:Z.endDate?Z.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(bt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>G(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${le.top}px`,left:`${le.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,ce=new Date(O);ce.setDate(O.getDate()+1);let we=new Date(O);we.setDate(O.getDate()+7);let $e=new Date(O);return $e.setDate(O.getDate()+14),[{label:"Hoy",date:O},{label:"Ma\xF1ana",date:ce},{label:"Pr\xF3xima semana",date:we},{label:"2 semanas",date:$e}].map((ft,X)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:h.textPrimary},onMouseEnter:te=>te.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:te=>te.currentTarget.style.backgroundColor="transparent",onClick:()=>{N==="start"?(Qe("startDate",ft.date),(!Z.endDate||ft.date>Z.endDate)&&Qe("endDate",ft.date),G("end")):(Qe("endDate",ft.date),(!Z.startDate||ft.date<Z.startDate)&&Qe("startDate",ft.date),G(null));},children:ft.label},X))})(),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:()=>{Qe("startDate",void 0),Qe("endDate",void 0),G(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>Y(new Date(H.getFullYear(),H.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:H.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Y(new Date(H.getFullYear(),H.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,ce)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:h.textTertiary},children:O},ce))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=H.getFullYear(),ce=H.getMonth(),we=new Date(O,ce,1).getDay(),$e=new Date(O,ce+1,0).getDate(),Ke=new Date,ft=[];for(let te=we-1;te>=0;te--)ft.push({day:new Date(O,ce,-te).getDate(),date:new Date(O,ce-1,new Date(O,ce,-te).getDate()),isCurrentMonth:false});for(let te=1;te<=$e;te++)ft.push({day:te,date:new Date(O,ce,te),isCurrentMonth:true});let X=42-ft.length;for(let te=1;te<=X;te++)ft.push({day:te,date:new Date(O,ce+1,te),isCurrentMonth:false});return ft.map((te,Ye)=>{let ze=te.date.toDateString()===Ke.toDateString(),et=Z.startDate?.toDateString()===te.date.toDateString(),st=Z.endDate?.toDateString()===te.date.toDateString(),Re=Z.startDate&&Z.endDate&&te.date>=Z.startDate&&te.date<=Z.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:te.isCurrentMonth?et||st?"#FFF":h.textPrimary:h.textTertiary,backgroundColor:et?"#3B82F6":st?"#7C3AED":Re?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ze&&!et&&!st?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{N==="start"?(Qe("startDate",te.date),Z.endDate&&te.date>Z.endDate&&Qe("endDate",te.date),G("end")):(Qe("endDate",te.date),Z.startDate&&te.date<Z.startDate&&Qe("startDate",te.date),G(null));},children:te.day},Ye)})})()})]})]})]})})]}),Ne.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Ne.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:h.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:Z.progress,onChange:O=>Qe("progress",parseInt(O.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:h.bgSecondary,accentColor:Z.progress<30?"#EF4444":Z.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${Z.progress<30?"#EF4444":Z.progress<70?"#F59E0B":"#10B981"}20`,color:Z.progress<30?"#EF4444":Z.progress<70?"#F59E0B":"#10B981"},children:[Z.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>be(!oe),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 ${oe?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:oe&&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:[(y||g.length>0||m==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color: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 ",m==="create"?ve.length>0&&`(${ve.length})`:g.length>0&&`(${g.length})`]})]}),m==="create"?jsxRuntime.jsx(kr,{cardId:"pending",attachments:ve.map((O,ce)=>({id:`pending-${ce}`,cardId:"pending",name:O.name,size:O.size,type:O.type,url:URL.createObjectURL(O),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:O=>Be(ce=>[...ce,...O]),onDelete:O=>{let ce=parseInt(O.replace("pending-",""),10);Be(we=>we.filter(($e,Ke)=>Ke!==ce));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(kr,{cardId:a?.id||"new",attachments:g,onUpload:y&&a?.id?O=>y(a.id,O):void 0,onDelete:w,maxSizeMB:10,maxFiles:20}),m==="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:Z.isMilestone,onChange:O=>Qe("isMilestone",O.target.checked),className:"w-4 h-4 rounded",style:{accentColor:h.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:h.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",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"]}),Z.dependencies&&Z.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:Z.dependencies.map(O=>{let ce=r.find(we=>we.id===O);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${h.accent}20`,color:h.accent},children:[ce?.name||O.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let we=(Z.dependencies||[]).filter($e=>$e!==O);Qe("dependencies",we);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},O)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{$(!L),R("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:h.bgSecondary,color:h.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{$(false),R("");}}),jsxRuntime.jsxs(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 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${h.border}`},children:jsxRuntime.jsx("input",{type:"text",value:S,onChange:O=>R(O.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:h.bgSecondary,color:h.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(O=>O.id!==a?.id).filter(O=>S===""||O.name.toLowerCase().includes(S.toLowerCase())).map(O=>{let ce=Z.dependencies?.includes(O.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let we=Z.dependencies||[],$e;ce?$e=we.filter(Ke=>Ke!==O.id):$e=[...we,O.id],Qe("dependencies",$e);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:ce?`${h.accent}10`:"transparent"},onMouseEnter:we=>{ce||(we.currentTarget.style.backgroundColor=h.hoverBg);},onMouseLeave:we=>{we.currentTarget.style.backgroundColor=ce?`${h.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:ce?h.accent:"transparent",borderColor:ce?h.accent:h.borderLight},children:ce&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:h.textPrimary},children:O.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:h.textTertiary},children:O.id.slice(0,8)})]})]},O.id)}),r.filter(O=>O.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:h.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),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:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:h.accent,color:"#FFF"},onMouseEnter:O=>!n&&(O.currentTarget.style.opacity="0.9"),onMouseLeave:O=>!n&&(O.currentTarget.style.opacity="1"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:m==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var wm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
345
345
 
346
346
  AVAILABLE COMMANDS:
347
347
  1. move_task - Move a task to a different date
@@ -382,39 +382,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
382
382
 
383
383
  Always try to match task names case-insensitively and handle partial matches.
384
384
  If you can't find a task by name, search through the provided task list.
385
- If ambiguous, ask for clarification in the message field.`;function ym(e){return `CURRENT TASKS:
386
- ${vm(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
385
+ If ambiguous, ask for clarification in the message field.`;function km(e){return `CURRENT TASKS:
386
+ ${Cm(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
387
387
  `)}
388
388
 
389
- Today's date: ${new Date().toISOString().split("T")[0]}`}function vm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Fr(e,t){let a=vm(e),r=t.toLowerCase().trim(),o=a.find(m=>m.name.toLowerCase()===r);if(o)return o;let s=a.find(m=>m.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(m=>{let u=m.name.toLowerCase();return n.every(i=>u.includes(i))})}function el(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 f=new Date(r);return f.setDate(f.getDate()+1),f}if(a==="yesterday"||a==="ayer"){let f=new Date(r);return f.setDate(f.getDate()-1),f}if(a==="next week"||a==="la pr\xF3xima semana"){let f=new Date(r);return f.setDate(f.getDate()+7),f}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 y={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(y!==void 0){let x=new Date(r),C=x.getDay(),h=y-C;return h<=0&&(h+=7),x.setDate(x.getDate()+h),x}}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 f=parseInt(s[1],10),y=s[2].toLowerCase(),x=new Date(r);return y==="day"||y==="d\xEDa"||y==="dias"?x.setDate(x.getDate()+f):y==="week"||y==="semana"||y==="semanas"?x.setDate(x.getDate()+f*7):(y==="month"||y==="mes"||y==="meses")&&x.setMonth(x.getMonth()+f),x}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let m=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(m&&m[1]&&m[2]&&m[3]){let f=parseInt(m[1],10),y=parseInt(m[2],10)-1,x=parseInt(m[3],10);return new Date(x,y,f)}let u={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let f=parseInt(i[1],10),y=u[i[2].toLowerCase()],x=i[3]?parseInt(i[3],10):r.getFullYear();if(y!==void 0)return new Date(x,y,f)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let f=p[l[1].toLowerCase()],y=parseInt(l[2],10),x=l[3]?parseInt(l[3],10):r.getFullYear();if(f!==void 0)return new Date(x,f,y)}return null}function tl(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 al(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 xm(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 km(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),p=r[2].trim(),l=Fr(t,i),f=el(p);if(!l)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!f)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let y=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,x=new Date(f);return x.setDate(x.getDate()+y),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:f,endDate:x},message:`Moved "${l.name}" to ${f.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),p=o[2].trim(),l=Fr(t,i),f=tl(p);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!f||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let y=new Date(l.endDate);return y.setDate(y.getDate()+f),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:y},message:`Extended "${l.name}" by ${f} days. New end date: ${y.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),p=s[2].trim(),l=Fr(t,i),f=al(p);return l?f===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:f},message:`Set "${l.name}" progress to ${f}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),p=n[2].trim(),l=Fr(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:p},message:`Renamed "${l.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let m=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]&&m[2]){let i=m[1].trim(),p=m[2].trim(),l=Fr(t,i),f=Fr(t,p);return l?f?{type:"link_tasks",taskId:f.id,taskName:f.name,dependencyFrom:l.id,dependencyTo:f.id,message:`Linked "${l.name}" \u2192 "${f.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let u=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(u&&u[1]){let i=u[1].trim(),p=Fr(t,i);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function wm(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 Nh(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 Dh(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function ss(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let l=a.find(f=>f.id===p);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>ss(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let n=p=>{if(p)return typeof p=="string"?new Date(p):p},m=n(e.startDate),u=n(e.endDate),i=e.metadata?.isMilestone===true||m&&u&&Math.abs(u.getTime()-m.getTime())<=864e5;return {id:e.id,name:e.title,startDate:m,endDate:u,progress:e.progress||0,status:Nh(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function Cm(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:Dh(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Tm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>ss(r,e,t))}var rl={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"}},ol={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"}},is={en:rl,es:ol};function nl(e){return is[e]||is.en}function ls(e,t){let a=nl(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var sl=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-blue-500"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-green-500"}];function Nm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let f=y=>{m.current&&!m.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]);let u=sl[0],i=sl.find(f=>f.value===e)??u,p=i.icon,l=f=>{switch(f){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(p,{className:d("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)})]}):jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),n(!s);},className:d("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(p,{className:d("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:d("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:sl.map(f=>{let y=f.icon;return jsxRuntime.jsxs("button",{onClick:x=>{x.stopPropagation(),t(f.value),n(false);},className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===f.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(y,{className:d("w-4 h-4",f.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:l(f.value)})]},f.value)})})]})}var il=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function Sm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let p=l=>{m.current&&!m.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let u=il.find(p=>p.value===e)??il[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:d("w-4 h-4",u.color)}),jsxRuntime.jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u.label[i]})]}):jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),n(!s);},className:d("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:d("w-4 h-4",u.color)}),jsxRuntime.jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:d("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:il.map(p=>jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),t(p.value),n(false);},className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===p.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:d("w-2 h-2 rounded-full",p.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[i]})]},p.value))})]})}function ms(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ps(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Pm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,m]=react.useState(false),[u,i]=react.useState(""),p=react.useRef(null);react.useEffect(()=>{let x=C=>{p.current&&!p.current.contains(C.target)&&(m(false),i(""));};return n&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]);let l=t.filter(x=>x.name.toLowerCase().includes(u.toLowerCase())||x.email?.toLowerCase().includes(u.toLowerCase())),f=x=>e.some(C=>C.name===x),y=x=>{if(a)if(f(x.name))a(e.filter(C=>C.name!==x.name));else {let C={name:x.name,initials:ms(x.name),color:x.color||ps(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl};a([...e,C]);}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:d("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,C)=>jsxRuntime.jsx("div",{className:d("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!x.avatar&&ps(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ms(x.name)},`${x.name}-${C}`)),e.length>3&&jsxRuntime.jsxs("div",{className:d("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:p,className:"relative",children:[jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),m(!n);},className:d("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:d("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:d("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,C)=>jsxRuntime.jsx("div",{className:d("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!x.avatar&&ps(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ms(x.name)},`${x.name}-${C}`)),e.length>2&&jsxRuntime.jsxs("span",{className:d("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:d("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-64",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsxRuntime.jsx("input",{type:"text",value:u,onChange:x=>i(x.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:d("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:x=>x.stopPropagation()})}),jsxRuntime.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:l.length===0?jsxRuntime.jsx("p",{className:d("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):l.map(x=>jsxRuntime.jsxs("button",{onClick:C=>{C.stopPropagation(),y(x);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:d("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!x.avatarUrl&&ps(x.name)),children:x.avatarUrl?jsxRuntime.jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):ms(x.name)}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:r?"text-white":"text-gray-900",children:x.name}),x.email&&jsxRuntime.jsx("div",{className:d("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:x.email})]}),f(x.name)&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},x.id))}),e.length>0&&jsxRuntime.jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((x,C)=>jsxRuntime.jsxs("span",{className:d("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[x.name,jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),a(e.filter(b=>b.name!==x.name));},className:"hover:text-red-500",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},`${x.name}-${C}`))})]})]})}var Xh={en:["January","February","March","April","May","June","July","August","September","October","November","December"],es:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},Jh={en:["Su","Mo","Tu","We","Th","Fr","Sa"],es:["Do","Lu","Ma","Mi","Ju","Vi","S\xE1"]};function us({value:e,onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),[m,u]=react.useState(()=>{if(e){let h=e instanceof Date?e:new Date(e);return new Date(h.getFullYear(),h.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),i=react.useRef(null),p=e?e instanceof Date?e:new Date(e):null,l=r==="es"?"es":"en";react.useEffect(()=>{let h=b=>{i.current&&!i.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]);let f=h=>h?h.toLocaleDateString(r==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-",y=(h,b)=>new Date(h,b+1,0).getDate(),x=(h,b)=>new Date(h,b,1).getDay(),C=()=>{let h=m.getFullYear(),b=m.getMonth(),g=y(h,b),k=x(h,b),c=new Date,T=[];for(let w=0;w<k;w++)T.push(jsxRuntime.jsx("div",{className:"w-8 h-8"},`empty-${w}`));for(let w=1;w<=g;w++){let R=new Date(h,b,w),v=p&&p.getDate()===w&&p.getMonth()===b&&p.getFullYear()===h,I=c.getDate()===w&&c.getMonth()===b&&c.getFullYear()===h;T.push(jsxRuntime.jsx("button",{onClick:F=>{F.stopPropagation(),t?.(R),n(false);},className:d("w-8 h-8 rounded-full text-sm transition-colors",v?"bg-[#3B82F6] text-white":I?a?"bg-white/10 text-white":"bg-gray-100 text-gray-900":a?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-900"),children:w},w));}return T};return o||!t?jsxRuntime.jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:f(p)}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),n(!s);},className:d("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:d("w-4 h-4",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:f(p)})]}),s&&jsxRuntime.jsxs("div",{className:d("absolute z-50 top-full left-0 mt-1 p-3 rounded-lg shadow-lg border",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),u(new Date(m.getFullYear(),m.getMonth()-1,1));},className:d("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:d("w-4 h-4",a?"text-white":"text-gray-600")})}),jsxRuntime.jsxs("span",{className:d("text-sm font-medium",a?"text-white":"text-gray-900"),children:[Xh[l][m.getMonth()]," ",m.getFullYear()]}),jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),u(new Date(m.getFullYear(),m.getMonth()+1,1));},className:d("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:d("w-4 h-4",a?"text-white":"text-gray-600")})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:Jh[l].map(h=>jsxRuntime.jsx("div",{className:d("w-8 h-6 text-xs flex items-center justify-center",a?"text-[#6B7280]":"text-gray-400"),children:h},h))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:C()}),jsxRuntime.jsxs("div",{className:"mt-3 pt-3 border-t flex gap-2",style:{borderColor:a?"rgba(255,255,255,0.1)":"#E5E7EB"},children:[jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),t?.(new Date),n(false);},className:d("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation();let b=new Date;b.setDate(b.getDate()+1),t?.(b),n(false);},className:d("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Ma\xF1ana":"Tomorrow"})]})]})]})}function Lm({value:e=0,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{onClick:s=>{if(r||!t)return;s.stopPropagation();let n=s.currentTarget.getBoundingClientRect(),m=s.clientX-n.left,u=Math.round(m/n.width*100),i=Math.max(0,Math.min(100,u));t(i);},className:d("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:d("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxRuntime.jsxs("span",{className:d("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function Rm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[m,u]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{u(e);},[e]);let p=()=>{m!==e&&t?.(m),n(false);},l=f=>{f.key==="Enter"?p():f.key==="Escape"&&(u(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:d("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:m,onChange:f=>u(f.target.value),onBlur:p,onKeyDown:l,onClick:f=>f.stopPropagation(),className:d("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),n(true);},className:d("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Um({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false}){let[m,u]=react.useState(false),[i,p]=react.useState(e?.toString()||""),l=react.useRef(null);react.useEffect(()=>{m&&l.current&&(l.current.focus(),l.current.select());},[m]),react.useEffect(()=>{p(e?.toString()||"");},[e]);let f=()=>{let x=parseFloat(i);if(!isNaN(x)){let C=x;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&t?.(C);}u(false);},y=x=>{x.key==="Enter"?f():x.key==="Escape"&&(p(e?.toString()||""),u(false));};return n||!t?jsxRuntime.jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:e!==void 0?e:r}):m?jsxRuntime.jsx("input",{ref:l,type:"number",value:i,onChange:x=>p(x.target.value),onBlur:f,onKeyDown:y,onClick:x=>x.stopPropagation(),min:o,max:s,className:d("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),u(true);},className:d("text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",e===void 0&&(a?"text-[#6B7280]":"text-gray-400")),children:e!==void 0?e:r})}function zm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,m]=react.useState(false),u=react.useRef(null);return react.useEffect(()=>{let i=p=>{u.current&&!u.current.contains(p.target)&&m(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:d("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),m(!n);},className:d("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:d("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:d("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:d("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),a(i),m(false);},className:d("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function Wm({value:e=false,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsx("button",{onClick:s=>{s.stopPropagation(),!r&&t&&t(!e);},disabled:r||!t,className:d("w-5 h-5 rounded border-2 flex items-center justify-center transition-colors",e?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed"),children:e&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})})}function Vm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:d("text-sm",t?"text-[#6B7280]":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:d("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function vy(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function xy(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function qm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:m,onColumnHide:u,onColumnSort:i,availableUsers:p=[]}){let l=react.useRef(null),f=r==="es"?Km.es:Km.en;if(react.useEffect(()=>{let b=k=>{l.current&&!l.current.contains(k.target)&&t();},g=k=>{k.key==="Escape"&&t();};return document.addEventListener("mousedown",b),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",g);}},[t]),!e.isOpen)return null;let y=()=>{if(!e.task)return [];let b=[];return o&&b.push({id:"edit",label:f.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),b.push({id:"sep1",label:"",icon:null,separator:true}),m&&(b.push({id:"status",label:f.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:f.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{m({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:f.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{m({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:f.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{m({...e.task,status:"completed",progress:100}),t();}}]}),b.push({id:"priority",label:f.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:f.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{m({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:f.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{m({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:f.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{m({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:f.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{m({...e.task,priority:"low"}),t();}}]}),p.length>0&&b.push({id:"assign",label:f.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:p.slice(0,5).map(g=>({id:`assign-${g.id}`,label:g.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:g.name.charAt(0).toUpperCase()}),onClick:()=>{let k=e.task.assignees||[],T=k.some(w=>w.name===g.name)?k.filter(w=>w.name!==g.name):[...k,{name:g.name,initials:vy(g.name),color:g.color||xy(g.name),avatar:g.avatarUrl}];m({...e.task,assignees:T}),t();}}))})),b.push({id:"sep2",label:"",icon:null,separator:true}),s&&b.push({id:"duplicate",label:f.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&b.push({id:"delete",label:f.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),b},x=()=>{if(!e.columnId)return [];let b=[];return i&&(b.push({id:"sort-asc",label:f.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),b.push({id:"sort-desc",label:f.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),u&&e.columnId!=="name"&&(b.push({id:"sep-hide",label:"",icon:null,separator:true}),b.push({id:"hide",label:f.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{u(e.columnId),t();}})),b},C=e.type==="task"?y():x(),h={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:l,style:h,className:d("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:C.map(b=>b.separator?jsxRuntime.jsx("div",{className:d("my-1 h-px",a?"bg-white/10":"bg-gray-200")},b.id):b.submenu?jsxRuntime.jsx(ky,{item:b,isDark:a},b.id):jsxRuntime.jsxs("button",{onClick:b.onClick,className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",b.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:d(b.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:b.icon}),b.label]},b.id))})}function ky({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:d("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:d("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(m=>jsxRuntime.jsxs("button",{onClick:m.onClick,className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:m.icon}),m.label]},m.id))})]})}var Km={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna"}};var Zm={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"})},Oy=["name","status","priority","assignees","startDate","endDate","progress","tags"];function ep({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:m}){let[u,i]=react.useState(""),p=react.useRef(null),l=m==="es"?Qm.es:Qm.en;if(react.useEffect(()=>{if(!e)return;let b=setTimeout(()=>{let g=c=>{p.current&&!p.current.contains(c.target)&&t();},k=c=>{c.key==="Escape"&&t();};document.addEventListener("mousedown",g),document.addEventListener("keydown",k),p._cleanup=()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",k);};},100);return ()=>{clearTimeout(b),p._cleanup&&p._cleanup();}},[e,t]),!e)return null;let f=b=>l.columns[b]||b,y=b=>{if(b==="name")return;let g=a.map(k=>k.id===b?{...k,visible:!k.visible}:k);o(g);},x=(b,g)=>{let k=a.find(T=>T.type===b&&(!g||T.customFieldId===g));if(k){y(k.id);return}let c={id:g||b,type:b,label:g?r.find(T=>T.id===g)?.name||b:f(b),width:120,visible:true,sortable:true,resizable:true,customFieldId:g};o([...a,c]);},C=Oy.filter(b=>f(b).toLowerCase().includes(u.toLowerCase())),h=r.filter(b=>b.name.toLowerCase().includes(u.toLowerCase()));return jsxRuntime.jsxs("div",{ref:p,className:d("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:d("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:d("font-medium",n?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:d("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:d("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:d("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:u,onChange:b=>i(b.target.value),placeholder:l.searchPlaceholder,className:d("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:d("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.standardFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:C.map(b=>{let g=a.find(T=>T.type===b&&!T.customFieldId),k=g?.visible??false,c=b==="name";return jsxRuntime.jsxs("button",{onClick:()=>{c||(g?y(g.id):x(b));},disabled:c,className:d("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",c&&"opacity-50 cursor-not-allowed"),children:[jsxRuntime.jsx("div",{className:d("w-5 h-5 rounded border flex items-center justify-center",k?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:k&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Zm[b]}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:f(b)})]},b)})})]}),h.length>0&&jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:d("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.customFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:h.map(b=>{let k=a.find(c=>c.customFieldId===b.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>x(b.type,b.id),className:d("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:d("w-5 h-5 rounded border flex items-center justify-center",k?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:k&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Zm[b.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:b.name})]},b.id)})})]}),s&&jsxRuntime.jsx("div",{className:d("p-3 border-t",n?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:s,className:d("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-colors",n?"bg-[#3B82F6]/20 text-[#3B82F6] hover:bg-[#3B82F6]/30":"bg-blue-50 text-blue-600 hover:bg-blue-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.createField]})})]})}var Qm={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",createField:"Create custom field",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",createField:"Crear campo personalizado",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var jy=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function rp({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[m,u]=react.useState("text"),[i,p]=react.useState([""]),l=o==="es"?ap.es:ap.en;react.useEffect(()=>{e&&(n(""),u("text"),p([""]));},[e]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let f=()=>{if(!s.trim())return;let h={name:s.trim(),type:m};m==="dropdown"&&(h.options=i.filter(b=>b.trim())),a(h),t();},y=()=>{p([...i,""]);},x=(h,b)=>{let g=[...i];g[h]=b,p(g);},C=h=>{i.length>1&&p(i.filter((b,g)=>g!==h));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:d("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:d("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:d("text-lg font-semibold",r?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:d("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:d("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:d("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>n(h.target.value),placeholder:l.fieldNamePlaceholder,className:d("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:d("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:jy.map(h=>jsxRuntime.jsxs("button",{onClick:()=>u(h.type),className:d("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",m===h.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:m===h.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:h.icon}),jsxRuntime.jsx("span",{className:d("text-xs",m===h.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:l.types[h.type]})]},h.type))})]}),m==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:d("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((h,b)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:h,onChange:g=>x(b,g.target.value),placeholder:`${l.option} ${b+1}`,className:d("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>C(b),className:d("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},b)),jsxRuntime.jsxs("button",{onClick:y,className:d("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:d("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:d("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:l.cancel}),jsxRuntime.jsx("button",{onClick:f,disabled:!s.trim(),className:d("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:l.create})]})]})]}):null}var ap={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var np={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function sp({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,m]=react.useState(false),u=react.useRef(null),i=s==="es"?np.es:np.en;react.useEffect(()=>{if(!n)return;let f=setTimeout(()=>{let y=C=>{u.current&&!u.current.contains(C.target)&&m(false);},x=C=>{C.key==="Escape"&&m(false);};document.addEventListener("mousedown",y),document.addEventListener("keydown",x),u._cleanup=()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",x);};},100);return ()=>{clearTimeout(f),u._cleanup&&u._cleanup();}},[n]);let p=[{value:"all",label:i.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:i.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:i.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:i.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],l=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),m(y=>!y);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",l&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),i.filters,l&&jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:d("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:d("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:d("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:i.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:p.map(f=>{let y=e===f.value&&!t,x=()=>f.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):f.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(f.value),r(false);},className:d("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",y&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d(y?f.color:"text-gray-400","flex-shrink-0"),children:x()}),jsxRuntime.jsx("span",{className:d("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:f.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:d("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},f.value)})}),jsxRuntime.jsx("div",{className:d("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{r(!t),t||a("all");},className:d("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:d("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:i.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:d("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var cv=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function mp(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(...mp(r.subtasks,t+1));return a}function mv({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 pp({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:m=[],customFields:u=[]}){let{theme:i="dark",locale:p="en",customTranslations:l,showSearch:f=true,showHierarchy:y=true,tableColumns:x,allowColumnCustomization:C=true,allowColumnResize:h=true,enableContextMenu:b=true,showCreateTaskButton:g=false,onCreateTask:k}=t,c=ls(p,l),T=i==="dark",[w,R]=react.useState("startDate"),[v,I]=react.useState("asc"),[F,N]=react.useState(""),[U,$]=react.useState("all"),[j,ne]=react.useState(false),[re,se]=react.useState(x||cv),[ye,be]=react.useState(false),[Be,A]=react.useState(false),[O,L]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[_,J]=react.useState(null),[ce,fe]=react.useState(0),[me,Le]=react.useState(0),te=react.useRef(null);react.useEffect(()=>{x&&se(x);},[x]);let Je=react.useMemo(()=>{let q=new Set;function Q(je){for(let Re of je)Re.subtasks?.length&&(Re.isExpanded!==false&&q.add(Re.id),Q(Re.subtasks));}return Q(e),q},[e]),ke=react.useMemo(()=>re.filter(q=>q.visible),[re]),Qe=react.useCallback(q=>{a.onTaskToggleExpand?.(q);},[a]),ct=react.useCallback(q=>{w===q?I(Q=>Q==="asc"?"desc":"asc"):(R(q),I("asc")),a.onSortChange?.({column:q,direction:v==="asc"?"desc":"asc"});},[w,v,a]),ft=react.useCallback(q=>{se(q),a.onColumnsChange?.(q);},[a]),et=react.useCallback(q=>{let Q=re.map(je=>je.id===q?{...je,visible:false}:je);ft(Q);},[re,ft]),wt=react.useCallback((q,Q)=>{R(q),I(Q);},[]),Mt=react.useCallback((q,Q,je)=>{b&&(q.preventDefault(),L({isOpen:true,x:q.clientX,y:q.clientY,type:Q?"task":"header",task:Q,columnId:je}));},[b]),Dt=react.useCallback(()=>{L(q=>({...q,isOpen:false}));},[]),Ye=react.useCallback((q,Q)=>{if(!h)return;q.preventDefault(),q.stopPropagation();let je=re.find(Re=>Re.id===Q);je&&(J(Q),fe(q.clientX),Le(je.width));},[re,h]);react.useEffect(()=>{if(!_)return;let q=je=>{let Re=je.clientX-ce,tt=Math.max(50,me+Re),lt=re.map(Ue=>Ue.id===_?{...Ue,width:tt}:Ue);se(lt);},Q=()=>{_&&a.onColumnsChange?.(re),J(null);};return document.addEventListener("mousemove",q),document.addEventListener("mouseup",Q),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",Q);}},[_,ce,me,re,a]);let B=react.useCallback(async q=>{if(a.onCreateCustomField){let Q={...q,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Q);}A(false);},[a]),ie=react.useCallback(q=>q.progress===100||q.status==="completed"?"completed":q.progress&&q.progress>0||q.status==="in-progress"?"in-progress":"todo",[]),Se=react.useMemo(()=>{let q=mp(e);if(F.trim()){let Q=F.toLowerCase();q=q.filter(je=>je.name.toLowerCase().includes(Q));}return U!=="all"&&(q=q.filter(Q=>ie(Q)===U)),j&&(q=q.filter(Q=>ie(Q)!=="completed")),q.sort((Q,je)=>{let Re,tt;switch(w){case "name":Re=Q.name.toLowerCase(),tt=je.name.toLowerCase();break;case "startDate":Re=Q.startDate?.getTime()||0,tt=je.startDate?.getTime()||0;break;case "endDate":Re=Q.endDate?.getTime()||0,tt=je.endDate?.getTime()||0;break;case "progress":Re=Q.progress||0,tt=je.progress||0;break;case "status":Re=Q.status||"todo",tt=je.status||"todo";break;case "priority":let lt={urgent:0,high:1,medium:2,low:3,none:4};Re=lt[Q.priority]??4,tt=lt[je.priority]??4;break;default:return 0}return Re<tt?v==="asc"?-1:1:Re>tt?v==="asc"?1:-1:0}),q},[e,F,U,j,w,v,ie]),He=react.useCallback((q,Q)=>{let je=lt=>{a.onTaskUpdate?.({...q,...lt});},Re=lt=>lt?q.customFields?.find(qe=>qe.fieldId===lt)?.value:void 0,tt=(lt,Ue)=>{if(!lt)return;let ae=[...q.customFields||[]],S=ae.findIndex(we=>we.fieldId===lt);S>=0?ae[S]={fieldId:lt,value:Ue}:ae.push({fieldId:lt,value:Ue}),je({customFields:ae});};switch(Q.type){case "name":return null;case "status":return jsxRuntime.jsx(Nm,{value:q.status||(q.progress===100?"completed":q.progress&&q.progress>0?"in-progress":"todo"),onChange:Ue=>{je({status:Ue,progress:Ue==="completed"?100:Ue==="in-progress"?50:0});},isDark:T,locale:p,translations:c.status});case "priority":return jsxRuntime.jsx(Sm,{value:q.priority,onChange:Ue=>je({priority:Ue}),isDark:T,locale:p});case "assignees":return jsxRuntime.jsx(Pm,{value:q.assignees||[],availableUsers:m,onChange:Ue=>je({assignees:Ue}),isDark:T,locale:p});case "startDate":return jsxRuntime.jsx(us,{value:q.startDate,onChange:Ue=>je({startDate:Ue}),isDark:T,locale:p});case "endDate":return jsxRuntime.jsx(us,{value:q.endDate,onChange:Ue=>je({endDate:Ue}),isDark:T,locale:p});case "progress":return jsxRuntime.jsx(Lm,{value:q.progress||0,onChange:Ue=>{let qe=Ue===100?"completed":Ue>0?"in-progress":"todo";je({progress:Ue,status:qe});},isDark:T});case "tags":return jsxRuntime.jsx(Vm,{value:q.tags||[],isDark:T});case "text":return jsxRuntime.jsx(Rm,{value:Re(Q.customFieldId)||"",onChange:Ue=>tt(Q.customFieldId,Ue),isDark:T});case "number":return jsxRuntime.jsx(Um,{value:Re(Q.customFieldId)||0,onChange:Ue=>tt(Q.customFieldId,Ue),isDark:T});case "date":let lt=Re(Q.customFieldId);return jsxRuntime.jsx(us,{value:lt?new Date(lt):void 0,onChange:Ue=>tt(Q.customFieldId,Ue),isDark:T,locale:p});case "dropdown":return jsxRuntime.jsx(zm,{value:Re(Q.customFieldId)||"",options:Q.options||[],onChange:Ue=>tt(Q.customFieldId,Ue),isDark:T});case "checkbox":return jsxRuntime.jsx(Wm,{value:Re(Q.customFieldId)||false,onChange:Ue=>tt(Q.customFieldId,Ue),isDark:T});default:return jsxRuntime.jsx("span",{className:d("text-sm",T?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,T,p,m,c]),Ze=react.useCallback(q=>({name:c.columns.name,status:c.columns.status,priority:c.columns.priority,assignees:c.columns.assignees,startDate:c.columns.startDate,endDate:c.columns.endDate,progress:c.columns.progress})[q.type]||q.label,[c]),bt=react.useMemo(()=>ke.reduce((q,Q)=>q+Q.width,0)+(C?48:0),[ke,C]);return r?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",T?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:d("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:[c.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",T?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:d("text-lg font-semibold mb-2",T?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:d("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",T?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:d("text-lg font-semibold mb-2",T?"text-white":"text-gray-900"),children:c.empty.noTasks}),jsxRuntime.jsx("p",{className:d("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:c.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:te,className:d("flex-1 flex flex-col w-full h-full overflow-hidden",T?"bg-[#0F1117]":"bg-white",_&&"select-none",s),style:n,children:[jsxRuntime.jsx("div",{className:d("flex-shrink-0 px-6 py-4 border-b",T?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(sp,{value:U,hideCompleted:j,onChange:$,onHideCompletedChange:ne,isDark:T,locale:p}),f&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:d("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",T?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:F,onChange:q=>N(q.target.value),placeholder:c.toolbar.searchPlaceholder,className:d("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",T?"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.jsx("div",{className:"flex-1"}),jsxRuntime.jsxs("div",{className:d("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:[Se.length," ",c.pagination.tasks]}),g&&k&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:k,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-4 h-4"}),jsxRuntime.jsx("span",{children:c.toolbar.newTask})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsxs("div",{style:{minWidth:bt},children:[jsxRuntime.jsxs("div",{className:d("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",T?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[ke.map(q=>jsxRuntime.jsxs("div",{className:d("relative flex items-center gap-2 px-4 py-3",T?"text-[#9CA3AF]":"text-gray-500"),style:{width:q.width,minWidth:q.minWidth},onContextMenu:Q=>Mt(Q,void 0,q.id),children:[q.sortable?jsxRuntime.jsxs("button",{onClick:()=>ct(q.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[Ze(q),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:d("w-3 h-3",w===q.id&&"text-[#3B82F6]")})]}):jsxRuntime.jsx("span",{children:Ze(q)}),h&&q.resizable&&jsxRuntime.jsx("div",{className:d("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",_===q.id&&"bg-[#3B82F6]"),onMouseDown:Q=>Ye(Q,q.id)})]},q.id)),C&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsxRuntime.jsx("button",{onClick:q=>{q.stopPropagation(),be(Q=>!Q);},className:d("p-1.5 rounded-lg transition-colors",T?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ye&&(T?"bg-white/10":"bg-gray-200")),title:p==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(ep,{isOpen:ye,onClose:()=>be(false),columns:re,customFields:u,onColumnsChange:ft,onCreateCustomField:()=>{be(false),A(true);},isDark:T,locale:p})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Se.map((q,Q)=>{let je=Je.has(q.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:Q*.02},className:d("flex items-center border-b transition-colors",T?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(q),onDoubleClick:()=>a.onTaskDoubleClick?.(q),onContextMenu:Re=>Mt(Re,q),children:[ke.map(Re=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Re.width,minWidth:Re.minWidth},children:Re.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&q.level>0&&jsxRuntime.jsx("div",{style:{width:`${q.level*24}px`},className:"flex-shrink-0"}),y&&q.hasChildren&&jsxRuntime.jsx("button",{onClick:tt=>{tt.stopPropagation(),Qe(q.id);},className:d("p-0.5 rounded flex-shrink-0",T?"hover:bg-white/10":"hover:bg-gray-200"),children:je?jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-4 h-4",T?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:d("w-4 h-4",T?"text-[#9CA3AF]":"text-gray-400")})}),y&&!q.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsx("button",{onClick:tt=>{tt.stopPropagation(),a.onTaskUpdate?.({...q,progress:q.progress===100?0:100,status:q.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(mv,{status:q.status,progress:q.progress})}),jsxRuntime.jsx("span",{className:d("truncate font-medium",T?"text-white":"text-gray-900",q.progress===100&&(T?"line-through text-[#6B7280]":"line-through text-gray-400")),children:q.name})]}):He(q,Re)},Re.id)),C&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},q.id)})}),Se.length===0&&F&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:d("w-12 h-12 mx-auto mb-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:d(T?"text-[#9CA3AF]":"text-gray-600"),children:c.empty.noResults})]})})]})}),jsxRuntime.jsx(qm,{state:O,onClose:Dt,isDark:T,locale:p,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:et,onColumnSort:wt,availableUsers:m}),jsxRuntime.jsx(rp,{isOpen:Be,onClose:()=>A(false),onSave:B,isDark:T,locale:p})]})}var up=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true}],gp=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"}],fp=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var ul={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"},gl={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"},fl={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"},bs={dark:ul,light:gl,neutral:fl};function bp(e){return bs[e]||bs.dark}var bl={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"}},hl={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"}},hs={en:bl,es:hl};function ln(e){return hs[e]||hs.en}function ys(e,t){let a=ln(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 hp(e){let t=ln(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 yp(e,t=0,a=true){let r=ln(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 Mv(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 Cl(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 Cp({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 Np({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:m,availableTags:u=[],onCreateTag:i,attachmentsByTask:p,comments:l,onAddComment:f,currentUser:y,mentionableUsers:x,onTaskOpen:C}){let{theme:h="dark",locale:b="en",customTranslations:g}=t,k=ys(b,g),c=h==="dark",T={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)"},[w,R]=react.useState(r||new Date),[v,I]=react.useState(null),[F,N]=react.useState(null),[U,$]=react.useState(null),[j,ne]=react.useState(new Date),[re,se]=react.useState({}),ye=4,be=3,[Be,A]=react.useState(false),[O,L]=react.useState(false),[_,J]=react.useState(false),[ce,fe]=react.useState(false),[me,Le]=react.useState(null),[te,Je]=react.useState(""),[ke,Qe]=react.useState(void 0),[ct,ft]=react.useState(null),[et,wt]=react.useState(false),[Mt,Dt]=react.useState(false),[Ye,B]=react.useState(null),[ie,Se]=react.useState(false),[He,Ze]=react.useState(new Date),[bt,q]=react.useState(false),[Q,je]=react.useState(false),[Re,tt]=react.useState(false),[lt,Ue]=react.useState(""),[qe,ae]=react.useState(false),[S,we]=react.useState(""),[X,Te]=react.useState(false),Ce=react.useCallback(()=>{R(new Date(w.getFullYear(),w.getMonth()-1,1));},[w]),We=react.useCallback(()=>{R(new Date(w.getFullYear(),w.getMonth()+1,1));},[w]),Oe=react.useCallback(()=>{R(new Date);},[]),at=react.useMemo(()=>{let M=w.getFullYear(),H=w.getMonth(),Pe=new Date(M,H,1),Me=new Date(M,H+1,0),Ut=Pe.getDay(),pe=Me.getDate(),_e=Mv(e),xt=new Date;xt.setHours(0,0,0,0);let ze=[],gt=Ut,va=new Date(M,H,0).getDate();for(let Ft=gt-1;Ft>=0;Ft--){let Xe=new Date(M,H-1,va-Ft);ze.push({date:Xe,isCurrentMonth:false,isToday:false,isWeekend:Xe.getDay()===0||Xe.getDay()===6,events:_e.filter(Yt=>Cl(Xe,Yt)).map(Yt=>({id:Yt.id,title:Yt.name,start:Yt.startDate,end:Yt.endDate,task:Yt}))});}for(let Ft=1;Ft<=pe;Ft++){let Xe=new Date(M,H,Ft),Yt=Xe.getTime()===xt.getTime();ze.push({date:Xe,isCurrentMonth:true,isToday:Yt,isWeekend:Xe.getDay()===0||Xe.getDay()===6,events:_e.filter(ua=>Cl(Xe,ua)).map(ua=>({id:ua.id,title:ua.name,start:ua.startDate,end:ua.endDate,task:ua}))});}let ka=42-ze.length;for(let Ft=1;Ft<=ka;Ft++){let Xe=new Date(M,H+1,Ft);ze.push({date:Xe,isCurrentMonth:false,isToday:false,isWeekend:Xe.getDay()===0||Xe.getDay()===6,events:_e.filter(Yt=>Cl(Xe,Yt)).map(Yt=>({id:Yt.id,title:Yt.name,start:Yt.startDate,end:Yt.endDate,task:Yt}))});}return ze},[w,e]),G=b==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],K=w.toLocaleDateString(b==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),he=react.useCallback((M,H)=>{if(!v)return;let Pe={...v,[M]:H};I(Pe),a.onTaskUpdate?.(Pe);},[v,a]),Ke=react.useCallback(M=>{if(!v)return;let H=v.progress||0;M==="completed"?H=100:M==="todo"&&(H=0);let Pe={...v,status:M,progress:H};I(Pe),a.onTaskUpdate?.(Pe),A(false);},[v,a]),Ie=react.useCallback((M,H)=>{if(!v)return;let Pe={...v,startDate:M,endDate:H};I(Pe),a.onTaskUpdate?.(Pe);},[v,a]),z=react.useCallback(()=>{A(false),L(false),J(false),$(null),tt(false),Ue(""),ae(false);},[]),de=react.useCallback(async M=>{if(M.preventDefault(),M.stopPropagation(),q(false),!v||!a.onUploadAttachments)return;let H=Array.from(M.dataTransfer.files);if(H.length!==0){je(true);try{await a.onUploadAttachments(v.id,H);}finally{je(false);}}},[v,a]),Ge=react.useCallback(async M=>{if(!v||!a.onUploadAttachments||!M.target.files)return;let H=Array.from(M.target.files);if(H.length!==0){je(true);try{await a.onUploadAttachments(v.id,H);}finally{je(false);}M.target.value="";}},[v,a]),St=react.useCallback(M=>{M.preventDefault(),M.stopPropagation(),q(true);},[]),mt=react.useCallback(M=>{M.preventDefault(),M.stopPropagation(),q(false);},[]),Dr=react.useCallback(M=>M<1024?`${M} B`:M<1024*1024?`${(M/1024).toFixed(1)} KB`:`${(M/(1024*1024)).toFixed(1)} MB`,[]),fr=react.useCallback(M=>M.startsWith("image/")?lucideReact.Image:M.includes("pdf")||M.includes("document")?lucideReact.FileText:lucideReact.File,[]),Ua=react.useMemo(()=>!v||!p?[]:p.get(v.id)||[],[v,p]);return o?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",n),style:m,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:d("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:[k.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",n),style:m,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:d("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:d("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",n),style:m,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:d("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:k.labels.noEvents}),jsxRuntime.jsx("p",{className:d("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:k.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:d("flex-1 flex flex-col w-full h-full overflow-auto",c?"bg-[#0F1117]":"bg-white",n),style:m,children:[jsxRuntime.jsx("div",{className:d("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:d("text-xl font-semibold capitalize",c?"text-white":"text-gray-900"),children:K}),jsxRuntime.jsx("button",{onClick:Oe,className:d("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:k.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Ce,className:d("p-2 rounded-lg transition-colors",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:d("w-5 h-5",c?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:We,className:d("p-2 rounded-lg transition-colors",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:d("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:G.map(M=>jsxRuntime.jsx("div",{className:d("py-2 text-center text-xs font-medium uppercase",c?"text-[#9CA3AF]":"text-gray-500"),children:M},M))}),jsxRuntime.jsx("div",{className:d("grid grid-cols-7 auto-rows-min gap-px rounded-lg",c?"bg-[#2D2D2D]":"bg-gray-300"),children:at.map((M,H)=>{let Pe=M.date.getDay()===0||M.date.getDay()===6;return jsxRuntime.jsxs("div",{className:d("min-h-[120px] p-2 transition-colors flex flex-col relative group",c?Pe?"bg-[#1C1F26]":M.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Pe?"bg-gray-100":M.isCurrentMonth?"bg-white":"bg-gray-50",M.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Me=re[H]||ye,Ut=M.events.slice(0,Me),pe=M.events.length-Me;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[Ut.map(_e=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{I(_e.task),a.onEventClick?.(_e),C?.(_e.task.id);},whileHover:{scale:1.02},className:d("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",_e.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(Cp,{task:_e.task}),jsxRuntime.jsx("span",{className:"truncate",children:_e.title})]})},_e.id)),pe>0&&jsxRuntime.jsxs("button",{onClick:_e=>{_e.stopPropagation(),se(xt=>({...xt,[H]:Me+be}));},className:d("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:["+",pe," ",b==="es"?"M\xC1S":"MORE"]}),Me>ye&&M.events.length>ye&&jsxRuntime.jsx("button",{onClick:_e=>{_e.stopPropagation(),se(xt=>({...xt,[H]:ye}));},className:d("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:b==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Me=H>=28,Ut=H%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:pe=>{pe.stopPropagation(),me===H?Le(null):(Le(H),Je(""),Qe(void 0),ft(null),B(null),wt(false),Dt(false),Se(false),Ze(M.date));},className:d("w-5 h-5 rounded flex items-center justify-center transition-all",me===H?"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:d("w-3.5 h-3.5 transition-transform",me===H&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:me===H&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Le(null),Je(""),Qe(void 0),ft(null),B(null),wt(false),Dt(false),Se(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Me?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Me?-5:5,scale:.95},transition:{duration:.12},className:d("absolute w-[320px] rounded-lg shadow-2xl z-50",Me?"bottom-full mb-1":"top-full mt-1",Ut?"right-0":"left-0",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:pe=>{pe.stopPropagation(),wt(false),Dt(false),Se(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:te,onChange:pe=>Je(pe.target.value),placeholder:b==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:d("w-full bg-transparent text-sm outline-none placeholder:opacity-40",c?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:pe=>{if(pe.key==="Enter"&&te.trim()){let _e=t.availableUsers?.find(ze=>ze.id===ct),xt=Ye||M.date;a.onTaskCreate?.({name:te.trim(),startDate:xt,endDate:xt,priority:ke,assignees:_e?[_e]:void 0}),Je(""),Qe(void 0),ft(null),B(null),Le(null);}pe.key==="Escape"&&(Le(null),Je(""),Qe(void 0),ft(null),B(null));}})}),jsxRuntime.jsxs("div",{className:d("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:pe=>{pe.stopPropagation(),wt(!et),Dt(false);},className:d("p-1 rounded transition-colors",ke?ke==="urgent"||ke==="high"?"text-red-400 bg-red-500/20":ke==="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:et&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:pe=>pe.stopPropagation(),children:[{id:"urgent",label:b==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:b==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:b==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:b==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:b==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(pe=>jsxRuntime.jsxs("button",{onClick:()=>{Qe(pe.id),wt(false);},className:d("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",ke===pe.id&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",pe.color)}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:pe.label})]},pe.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:pe=>{pe.stopPropagation(),Se(!ie),wt(false),Dt(false),Ze(Ye||M.date);},className:d("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Ye?"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"}),(Ye||M.date).toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ie&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:pe=>pe.stopPropagation(),children:[jsxRuntime.jsx("div",{className:d("w-40 py-2 border-r",c?"border-white/10":"border-gray-200"),children:(()=>{let pe=new Date,_e=new Date(pe);_e.setDate(pe.getDate()+1);let xt=new Date(pe);xt.setDate(pe.getDate()+((6-pe.getDay()+7)%7||7));let ze=new Date(pe);ze.setDate(pe.getDate()+((1-pe.getDay()+7)%7||7));let gt=new Date(pe);gt.setDate(pe.getDate()+14);let va=new Date(pe);return va.setDate(pe.getDate()+28),[{label:b==="es"?"Hoy":"Today",date:pe,display:pe.toLocaleDateString(b==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:b==="es"?"Ma\xF1ana":"Tomorrow",date:_e,display:_e.toLocaleDateString(b==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:b==="es"?"Este fin de semana":"This weekend",date:xt,display:b==="es"?"s\xE1b.":"sat."},{label:b==="es"?"Pr\xF3xima semana":"Next week",date:ze,display:b==="es"?"lun.":"mon."},{label:b==="es"?"2 semanas":"2 weeks",date:gt,display:gt.toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:b==="es"?"4 semanas":"4 weeks",date:va,display:va.toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ft,Xe)=>jsxRuntime.jsxs("button",{className:d("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:()=>{B(Ft.date),Se(false);},children:[jsxRuntime.jsx("span",{children:Ft.label}),jsxRuntime.jsx("span",{className:d("text-[10px]",c?"text-[#6B7280]":"text-gray-400"),children:Ft.display})]},Xe))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:d("text-xs font-medium",c?"text-white":"text-gray-900"),children:He.toLocaleDateString(b==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Ze(new Date),className:d("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:b==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Ze(new Date(He.getFullYear(),He.getMonth()-1)),className:d("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:()=>Ze(new Date(He.getFullYear(),He.getMonth()+1)),className:d("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:(b==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(pe=>jsxRuntime.jsx("div",{className:d("w-6 h-6 flex items-center justify-center text-[10px]",c?"text-[#6B7280]":"text-gray-400"),children:pe},pe))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let pe=He.getFullYear(),_e=He.getMonth(),xt=new Date(pe,_e,1).getDay(),ze=new Date(pe,_e+1,0).getDate(),gt=new Date(pe,_e,0).getDate(),va=new Date,ka=[];for(let Xe=xt-1;Xe>=0;Xe--)ka.push({dayNum:gt-Xe,isCurrentMonth:false,date:new Date(pe,_e-1,gt-Xe)});for(let Xe=1;Xe<=ze;Xe++)ka.push({dayNum:Xe,isCurrentMonth:true,date:new Date(pe,_e,Xe)});let Ft=42-ka.length;for(let Xe=1;Xe<=Ft;Xe++)ka.push({dayNum:Xe,isCurrentMonth:false,date:new Date(pe,_e+1,Xe)});return ka.map((Xe,Yt)=>{let ua=Xe.date.toDateString()===va.toDateString(),Lr=(Ye||M.date).toDateString()===Xe.date.toDateString();return jsxRuntime.jsx("button",{className:d("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!Xe.isCurrentMonth&&(c?"text-[#4B5563]":"text-gray-300"),Xe.isCurrentMonth&&(c?"text-white":"text-gray-900"),ua&&"ring-1 ring-[#3B82F6]",Lr&&"bg-[#7C3AED] text-white",!Lr&&(c?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{B(Xe.date),Se(false);},children:Xe.dayNum},Yt)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:pe=>{pe.stopPropagation(),Dt(!Mt),wt(false);},className:d("p-1 rounded transition-colors",ct?"text-[#7C3AED] bg-[#7C3AED]/20":c?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:ct?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(pe=>pe.id===ct)?.color||"#7C3AED"},children:t.availableUsers?.find(pe=>pe.id===ct)?.initials||t.availableUsers?.find(pe=>pe.id===ct)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Mt&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:pe=>pe.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{ft(null),Dt(false);},className:d("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",!ct&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:d("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:b==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(pe=>jsxRuntime.jsxs("button",{onClick:()=>{ft(pe.id),Dt(false);},className:d("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",ct===pe.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:pe.color||"#7C3AED"},children:pe.initials||pe.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:pe.name})]},pe.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:d("px-3 py-2 text-xs",c?"text-[#6B7280]":"text-gray-400"),children:b==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(te.trim()){let pe=t.availableUsers?.find(xt=>xt.id===ct),_e=Ye||M.date;a.onTaskCreate?.({name:te.trim(),startDate:_e,endDate:_e,priority:ke,assignees:pe?[pe]:void 0}),Je(""),Qe(void 0),ft(null),B(null),Le(null);}},disabled:!te.trim(),className:d("px-2.5 py-1 rounded text-xs font-medium transition-colors",te.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":c?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:b==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:d("text-sm font-medium",M.isToday?"text-[#3B82F6]":M.isCurrentMonth?c?"text-white":"text-gray-900":c?"text-[#6B7280]":"text-gray-400"),children:M.date.getDate()})]})]},H)})})]})}),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:()=>{I(null),we("");},className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:d("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",c?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:d("px-6 py-3 border-b flex items-center gap-3",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:d("w-4 h-4",c?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:d("text-xs px-2 py-0.5 rounded",c?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[b==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:d("text-xs font-mono",c?"text-[#6B7280]":"text-gray-400"),children:v.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:d("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",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:d("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:d("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:()=>{I(null),we("");},className:d("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 M=v.progress===100?0:100,Pe={...v,progress:M,status:M===100?"completed":"todo"};I(Pe),a.onTaskUpdate?.(Pe);},className:d("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",v.progress===100?"bg-green-500 border-green-500":c?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:v.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:d("text-xl font-semibold flex-1",v.progress===100?"line-through text-[#6B7280]":c?"text-white":"text-gray-900"),children:v.name})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{z(),A(!Be);},className:d("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",v.progress===100||v.status==="completed"?"bg-green-500/20 text-green-400":v.progress&&v.progress>0||v.status==="in-progress"?"bg-blue-500/20 text-blue-400":c?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:v.progress===100||v.status==="completed"?b==="es"?"COMPLETADO":"DONE":v.progress&&v.progress>0||v.status==="in-progress"?b==="es"?"EN PROGRESO":"IN PROGRESS":b==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Be&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>A(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:b==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:b==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:b==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(M=>jsxRuntime.jsxs("button",{onClick:()=>Ke(M.id),className:d("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",(v.status===M.id||M.id==="completed"&&v.progress===100||M.id==="in-progress"&&v.progress&&v.progress>0&&v.progress<100||M.id==="todo"&&(!v.progress||v.progress===0)&&v.status!=="in-progress"&&v.status!=="completed")&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",M.id==="completed"?"bg-green-500":M.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:M.label})]},M.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{A(false),L(false),$(null),J(!_);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",c?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[v.assignees&&v.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[v.assignees.slice(0,3).map((M,H)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:M.color||"#8B5CF6"},title:M.name,children:M.initials||M.name.slice(0,2).toUpperCase()},H)),v.assignees.length>3&&jsxRuntime.jsxs("span",{className:d("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:["+",v.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:d("text-sm",c?"text-[#6B7280]":"text-gray-400"),children:b==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",c?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>J(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(M=>{let H=v.assignees?.some(Pe=>Pe.name===M.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Pe=v.assignees||[],Me;H?Me=Pe.filter(Ut=>Ut.name!==M.name):Me=[...Pe,{name:M.name,avatar:M.avatar,initials:M.initials||M.name.slice(0,2).toUpperCase(),color:M.color||"#8B5CF6"}],he("assignees",Me);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",c?"hover:bg-white/5":"hover:bg-gray-50",H&&(c?"bg-white/5":"bg-gray-50")),children:[M.avatar?jsxRuntime.jsx("img",{src:M.avatar,alt:M.name,className:"w-6 h-6 rounded-full object-cover"}):jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:M.color||"#8B5CF6"},children:M.initials||M.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:d("flex-1 text-left",c?"text-white":"text-gray-900"),children:M.name}),H&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},M.id||M.name)}):jsxRuntime.jsx("div",{className:d("px-3 py-4 text-sm text-center",c?"text-[#6B7280]":"text-gray-400"),children:b==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{$(U?null:"start"),ne(v.startDate||new Date);},className:d("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:[v.startDate?.toLocaleDateString(b==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(b==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:d("mx-1",c?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),v.endDate?.toLocaleDateString(b==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(b==="es"?"Fin":"End"),(v.startDate||v.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:M=>{M.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>$(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:d("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:M=>M.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:d("w-44 py-2 border-r",c?"border-white/10":"border-gray-200"),children:[(()=>{let M=new Date,H=new Date(M);H.setDate(M.getDate()+1);let Pe=new Date(M);Pe.setDate(M.getDate()+((6-M.getDay()+7)%7||7));let Me=new Date(M);Me.setDate(M.getDate()+((1-M.getDay()+7)%7||7));let Ut=new Date(M);Ut.setDate(M.getDate()+(6-M.getDay()+7)%7+7);let pe=new Date(M);pe.setDate(M.getDate()+14);let _e=new Date(M);return _e.setDate(M.getDate()+28),[{label:b==="es"?"Hoy":"Today",date:M,display:M.toLocaleDateString(b==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:b==="es"?"Ma\xF1ana":"Tomorrow",date:H,display:H.toLocaleDateString(b==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:b==="es"?"Este fin de semana":"This weekend",date:Pe,display:b==="es"?"s\xE1b.":"sat."},{label:b==="es"?"Pr\xF3xima semana":"Next week",date:Me,display:b==="es"?"lun.":"mon."},{label:b==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Ut,display:Ut.toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:b==="es"?"2 semanas":"2 weeks",date:pe,display:pe.toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:b==="es"?"4 semanas":"4 weeks",date:_e,display:_e.toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ze,gt)=>jsxRuntime.jsxs("button",{className:d("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(U==="start"){let va=v.endDate&&ze.date>v.endDate?ze.date:v.endDate;Ie(ze.date,va),$("end");}else {let va=v.startDate&&ze.date<v.startDate?ze.date:v.startDate;Ie(va,ze.date),$(null);}},children:[jsxRuntime.jsx("span",{children:ze.label}),jsxRuntime.jsx("span",{className:d("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:ze.display})]},gt))})(),jsxRuntime.jsx("div",{className:d("border-t mt-2 pt-2",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Ie(void 0,void 0),$(null);},className:d("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:b==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:d("text-xs mb-3 px-2 py-1 rounded",c?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:U==="start"?b==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":b==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:d("font-medium",c?"text-white":"text-gray-900"),children:j.toLocaleDateString(b==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>ne(new Date),className:d("p-1 rounded text-sm transition-colors",c?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:b==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>ne(new Date(j.getFullYear(),j.getMonth()-1)),className:d("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:()=>ne(new Date(j.getFullYear(),j.getMonth()+1)),className:d("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:(b==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(M=>jsxRuntime.jsx("div",{className:d("w-8 h-8 flex items-center justify-center text-xs",c?"text-[#6B7280]":"text-gray-400"),children:M},M))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let M=j.getFullYear(),H=j.getMonth(),Pe=new Date(M,H,1).getDay(),Me=new Date(M,H+1,0).getDate(),Ut=new Date(M,H,0).getDate(),pe=new Date,_e=[];for(let ze=Pe-1;ze>=0;ze--)_e.push({day:Ut-ze,isCurrentMonth:false,date:new Date(M,H-1,Ut-ze)});for(let ze=1;ze<=Me;ze++)_e.push({day:ze,isCurrentMonth:true,date:new Date(M,H,ze)});let xt=42-_e.length;for(let ze=1;ze<=xt;ze++)_e.push({day:ze,isCurrentMonth:false,date:new Date(M,H+1,ze)});return _e.map((ze,gt)=>{let va=ze.date.toDateString()===pe.toDateString(),ka=v.startDate?.toDateString()===ze.date.toDateString(),Ft=v.endDate?.toDateString()===ze.date.toDateString(),Xe=ka||Ft,Yt=v.startDate&&v.endDate&&ze.date>=v.startDate&&ze.date<=v.endDate;return jsxRuntime.jsx("button",{className:d("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!ze.isCurrentMonth&&(c?"text-[#4B5563]":"text-gray-300"),ze.isCurrentMonth&&(c?"text-white":"text-gray-900"),va&&"ring-2 ring-[#3B82F6]",ka&&"bg-[#3B82F6] text-white",Ft&&!ka&&"bg-[#7C3AED] text-white",Yt&&!Xe&&(c?"bg-[#7C3AED]/20":"bg-purple-100"),!Xe&&(c?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let ua=new Date(ze.date);if(U==="start"){let Lr=v.endDate&&ua>v.endDate?ua:v.endDate;Ie(ua,Lr),$("end");}else {let Lr=v.startDate&&ua<v.startDate?ua:v.startDate;Ie(Lr,ua),$(null);}},children:ze.day},gt)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{z(),L(!O);},className:d("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",v.priority==="high"||v.priority==="urgent"?"bg-red-500/20 text-red-400":v.priority==="medium"?"bg-yellow-500/20 text-yellow-400":v.priority==="low"?"bg-green-500/20 text-green-400":c?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:v.priority?v.priority==="high"||v.priority==="urgent"?b==="es"?"Urgente":"Urgent":v.priority==="medium"?b==="es"?"Media":"Medium":b==="es"?"Baja":"Low":b==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:O&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>L(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("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:b==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:b==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:b==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:b==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:b==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(M=>jsxRuntime.jsxs("button",{onClick:()=>{he("priority",M.id),L(false);},className:d("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",v.priority===M.id&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",M.color)}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:M.label})]},M.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:d("text-sm",c?"text-white":"text-gray-900"),children:v.startDate&&v.endDate?`${Math.ceil((v.endDate.getTime()-v.startDate.getTime())/(1e3*60*60*24))} ${b==="es"?"d\xEDas":"days"}`:b==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:d("w-4 h-4 rounded-full border-2",c?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ce?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:v.progress||0,onChange:M=>{let H=parseInt(M.target.value),Pe=v.status;H===100?Pe="completed":H>0?Pe="in-progress":Pe="todo";let Me={...v,progress:H,status:Pe};I(Me),a.onTaskUpdate?.(Me);},onBlur:()=>fe(false),className:d("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",c?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>fe(true),className:d("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:d("h-full rounded-full transition-all",v.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${v.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:d("text-sm font-medium min-w-[40px]",c?"text-white":"text-gray-900"),children:[v.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(hr,{selectedTags:v.tags||[],availableTags:u,onChange:M=>{he("tags",M);},onCreateTag:i,theme:T})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:d("w-4 h-4 mt-1.5",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24 mt-1",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[v.dependencies&&v.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:v.dependencies.map(M=>{let H=e.find(Pe=>Pe.id===M);return jsxRuntime.jsxs("span",{className:d("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",c?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[H?.name||M.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let Pe=(v.dependencies||[]).filter(Me=>Me!==M);he("dependencies",Pe);},className:d("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},M)})}),jsxRuntime.jsxs("button",{onClick:()=>{z(),tt(!Re);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",c?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:d("text-sm",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Re&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{tt(false),Ue("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:d("p-2 border-b",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:lt,onChange:M=>Ue(M.target.value),placeholder:b==="es"?"Buscar tarea...":"Search task...",className:d("w-full px-3 py-2 rounded-md text-sm outline-none",c?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:e.length>0?e.filter(M=>M.id!==v.id).filter(M=>lt===""||M.name.toLowerCase().includes(lt.toLowerCase())).map(M=>{let H=v.dependencies?.includes(M.id);return jsxRuntime.jsxs("button",{onClick:()=>{let Pe=v.dependencies||[],Me;H?Me=Pe.filter(Ut=>Ut!==M.id):Me=[...Pe,M.id],he("dependencies",Me);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",H&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:d("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",H?"bg-blue-500 border-blue-500":c?"border-white/30":"border-gray-300"),children:H&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:d("block truncate",c?"text-white":"text-gray-900"),children:M.name}),jsxRuntime.jsx("span",{className:d("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:M.id.slice(0,8)})]})]},M.id)}):jsxRuntime.jsx("div",{className:d("px-3 py-4 text-sm text-center",c?"text-[#6B7280]":"text-gray-500"),children:b==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{z(),ae(!qe);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",c?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:v.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:d("text-sm",c?"text-white":"text-gray-900"),children:yr.find(M=>M.value===v.color)?.name||(b==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",c?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:qe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ae(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:yr.map(M=>{let H=v.color===M.value;return jsxRuntime.jsx("button",{onClick:()=>{he("color",M.value),ae(false);},className:d("w-7 h-7 rounded-full flex items-center justify-center transition-all",H&&"ring-2 ring-offset-2",c?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:M.value,outlineColor:H?M.value:void 0},title:M.name,children:H&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},M.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:v.isMilestone||false,onChange:M=>he("isMilestone",M.target.checked),className:d("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",v.isMilestone?"bg-purple-500 border-purple-500":c?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:d("text-sm",c?"text-white":"text-gray-900"),children:b==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:d("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:d("text-sm font-semibold",c?"text-white":"text-gray-900"),children:b==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:v.description||"",onChange:M=>he("description",M.target.value),placeholder:b==="es"?"Agregar descripci\xF3n...":"Add description...",className:d("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",c?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:d("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"}),b==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:d("text-sm font-semibold mb-3",c?"text-white":"text-gray-900"),children:b==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",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"}),b==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:d("text-sm font-semibold mb-3",c?"text-white":"text-gray-900"),children:b==="es"?"Agregar subtarea":"Add subtask"}),v.subtasks&&v.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:v.subtasks.map(M=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:d("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",M.progress===100?"bg-green-500 border-green-500":c?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:M.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:d("text-sm",M.progress===100?"line-through text-[#6B7280]":c?"text-white":"text-gray-900"),children:M.name})]},M.id))}),jsxRuntime.jsxs("button",{className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",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"}),b==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:d("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:d("text-sm font-semibold",c?"text-white":"text-gray-900"),children:b==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:d("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:d("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"}),b==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:d("text-sm font-semibold mb-3",c?"text-white":"text-gray-900"),children:[b==="es"?"Adjuntos":"Attachments",Ua.length>0&&jsxRuntime.jsxs("span",{className:d("ml-2 text-xs font-normal",c?"text-[#6B7280]":"text-gray-400"),children:["(",Ua.length,")"]})]}),Ua.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:Ua.map(M=>{let H=fr(M.type),Pe=M.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:d("flex items-center gap-3 p-2 rounded-lg group transition-colors",c?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Pe&&M.thumbnailUrl?jsxRuntime.jsx("img",{src:M.thumbnailUrl,alt:M.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:d("w-10 h-10 rounded flex items-center justify-center",c?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(H,{className:d("w-5 h-5",c?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:M.url,target:"_blank",rel:"noopener noreferrer",className:d("text-sm font-medium truncate block hover:underline",c?"text-white":"text-gray-900"),children:M.name}),jsxRuntime.jsx("p",{className:d("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:Dr(M.size)})]}),a.onDeleteAttachment&&jsxRuntime.jsx("button",{onClick:()=>a.onDeleteAttachment?.(M.id),className:d("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",c?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:b==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},M.id)})}),jsxRuntime.jsxs("div",{onDragOver:St,onDragLeave:mt,onDrop:de,className:d("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",bt?c?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":c?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",Q&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Ge,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||Q}),Q?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:d("text-sm",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:d("w-6 h-6 mx-auto mb-2",bt?"text-blue-500":c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:d("text-sm",c?"text-[#9CA3AF]":"text-gray-500"),children:bt?b==="es"?"Suelta los archivos aqu\xED":"Drop files here":b==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!a.onUploadAttachments&&jsxRuntime.jsx("p",{className:d("text-xs mt-1",c?"text-[#6B7280]":"text-gray-400"),children:b==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:d("w-80 border-l flex flex-col",c?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:d("px-4 py-3 border-b",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:d("text-sm font-semibold",c?"text-white":"text-gray-900"),children:[b==="es"?"Actividad":"Activity",l&&l.length>0&&jsxRuntime.jsxs("span",{className:d("ml-2 text-xs font-normal",c?"text-[#6B7280]":"text-gray-400"),children:["(",l.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:l&&l.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:l.map(M=>{let H=(()=>{let Pe=new Date,Me=new Date(M.createdAt),Ut=Pe.getTime()-Me.getTime(),pe=Math.floor(Ut/6e4),_e=Math.floor(pe/60),xt=Math.floor(_e/24);return pe<1?b==="es"?"ahora":"now":pe<60?b==="es"?`hace ${pe}m`:`${pe}m ago`:_e<24?b==="es"?`hace ${_e}h`:`${_e}h ago`:b==="es"?`hace ${xt}d`:`${xt}d ago`})();return jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:"#8B5CF6"},children:M.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:d("text-sm font-medium",c?"text-white":"text-gray-900"),children:M.user?.name||(b==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:d("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:H})]}),jsxRuntime.jsx("p",{className:d("text-sm break-words",c?"text-[#9CA3AF]":"text-gray-600"),children:M.content})]})]},M.id)})}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:d("w-10 h-10 mb-3",c?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:d("text-sm",c?"text-[#6B7280]":"text-gray-500"),children:b==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:d("p-4 border-t",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[y&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:y.color||"#8B5CF6"},children:y.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:d("flex-1 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",value:S,onChange:M=>we(M.target.value),onKeyDown:async M=>{if(M.key==="Enter"&&!M.shiftKey&&v&&S.trim()&&f){M.preventDefault(),Te(true);try{await f(v.id,S.trim()),we("");}finally{Te(false);}}},placeholder:b==="es"?"Escribe un comentario...":"Write a comment...",disabled:X||!f,className:d("flex-1 bg-transparent text-sm outline-none",c?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(X||!f)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:async()=>{if(v&&S.trim()&&f){Te(true);try{await f(v.id,S.trim()),we("");}finally{Te(false);}}},disabled:X||!S.trim()||!f,className:d("p-1.5 rounded transition-colors",S.trim()&&f?"bg-blue-500 text-white hover:bg-blue-600":c?"text-[#6B7280]":"text-gray-400",X&&"opacity-50 cursor-not-allowed"),children:X?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]})]})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>N(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:d("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",c?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:d("px-4 py-3 border-b flex items-center justify-between",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:d("font-medium",c?"text-white":"text-gray-900"),children:F.date.toLocaleDateString(b==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>N(null),className:d("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:F.events.map(M=>jsxRuntime.jsxs("button",{onClick:()=>{N(null),I(M.task),C?.(M.task.id);},className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",c?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Cp,{task:M.task}),jsxRuntime.jsx("span",{className:d("text-sm truncate flex-1",c?"text-white":"text-gray-900"),children:M.title}),M.task.priority==="high"||M.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},M.id))})]})]})})]})}var Tl={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"},Nl={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"},Dl={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"},xs={dark:Tl,light:Nl,neutral:Dl};function Dp(e){return xs[e]||xs.dark}function Fv({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:m}){let[u,i]=react.useState(false),p=react.useMemo(()=>t.filter(y=>e.cardIds.includes(y.id)),[t,e.cardIds]),l=react.useMemo(()=>{let y=p.length,x=new Set(p.flatMap(b=>b.assignedUserIds||[])).size,C=p.map(b=>b.priority).filter(Boolean),h=new Set(p.flatMap(b=>b.labels||[])).size;return {totalCards:y,uniqueAssignees:x,priorities:C,labels:h}},[p]),f=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:d("card-stack",!e.isExpanded&&"card-stack-collapsed",m),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:f,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:d("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:l.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),u&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:y=>{y.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(y=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(y),children:a(y)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(y),children:[jsxRuntime.jsx("h4",{children:y.title}),y.description&&jsxRuntime.jsxs("p",{children:[y.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:x=>{x.stopPropagation(),s?.(e.id,y.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"})]})})]},y.id))})})]})}var Ep={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function mn(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 pn(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 Pp(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 Mp({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:m}){let u=react.useMemo(()=>({...Ep,...n}),[n]),[i,p]=react.useState(new Set),l=react.useRef(null),f=react.useMemo(()=>{if(!u.groupByDay)return [{date:null,events:e}];let g=new Map;return e.forEach(k=>{let c=k.timestamp.toISOString().split("T")[0],T=g.get(c);T?T.push(k):g.set(c,[k]);}),Array.from(g.entries()).sort((k,c)=>c[0].localeCompare(k[0])).map(([k,c])=>({date:new Date(k),events:c.sort((T,w)=>w.timestamp.getTime()-T.timestamp.getTime())}))},[e,u.groupByDay]),{uniqueUsers:y,uniqueTypes:x}=react.useMemo(()=>{let g=new Set,k=new Set;return e.forEach(c=>{g.add(c.userId),k.add(c.type);}),{uniqueUsers:Array.from(g),uniqueTypes:Array.from(k)}},[e]),C=g=>{p(k=>{let c=new Set(k);return c.has(g)?c.delete(g):c.add(g),c});},h=g=>{let c=new Date().getTime()-g.getTime(),T=Math.floor(c/6e4),w=Math.floor(c/36e5),R=Math.floor(c/864e5);return T<1?"just now":T<60?`${T}m ago`:w<24?`${w}h ago`:R<7?`${R}d ago`:g.toLocaleDateString()},b=react.useMemo(()=>{let g=0;return t.types&&t.types.length>0&&g++,t.users&&t.users.length>0&&g++,t.dateRange&&g++,t.searchTerm&&g++,g},[t]);return react.useEffect(()=>{if(s&&l.current){let g=l.current.querySelector(`[data-event-id="${s}"]`);g&&g.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:d("history-timeline-empty",m),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:d("history-timeline",u.compact&&"compact",m),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:g=>{let k=g.target.value;a({...t,types:k?[k]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),x.map(g=>jsxRuntime.jsxs("option",{value:g,children:[pn(g)," ",g.replace("_"," ")]},g))]}),y.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:g=>{let k=g.target.value;a({...t,users:k?[k]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),y.map(g=>jsxRuntime.jsx("option",{value:g,children:g},g))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:g=>a({...t,searchTerm:g.target.value})})]}),b>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:l,children:f.map(g=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[u.groupByDay&&g.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:g.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[g.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:g.events.map((k,c)=>{let T=i.has(k.id),w=s===k.id,R=Pp(k.type);return jsxRuntime.jsxs("div",{"data-event-id":k.id,className:d("history-timeline-event",T&&"expanded",w&&"selected"),onClick:()=>o?.(k),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:R},children:u.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:pn(k.type)})}),c<g.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:R}})]}),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:[u.showAvatars&&k.userAvatar&&jsxRuntime.jsx("img",{src:k.userAvatar,alt:k.userName||k.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:k.userName||k.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:mn(k)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:u.useRelativeTime?h(k.timestamp):k.timestamp.toLocaleString()})]}),Object.keys(k.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:v=>{v.stopPropagation(),C(k.id);},children:[T?"\u25BC":"\u25B6"," Show changes"]}),T&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(k.changes).map(([v,I])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[v,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(I.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(I.to)})]})]},v)),k.metadata&&Object.keys(k.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(k.metadata).map(([v,I])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[v,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(I)})]},v))]})]})]})]},k.id)})})]},g.date?.toISOString()||"all"))})]})}function Fp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:m,onSpeedChange:u,className:i}){let p=[.5,1,1.5,2,3],l=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),f=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:d("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:d("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:l&&pn(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&mn(l)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:y=>m(parseInt(y.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${f}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((y,x)=>jsxRuntime.jsx("div",{className:d("history-replay-progress-marker",x===e.currentIndex&&"active"),style:{left:`${x/(e.totalEvents-1)*100}%`},onClick:()=>m(x),title:mn(y)},y.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:p.map(y=>jsxRuntime.jsxs("button",{className:d("history-replay-speed-btn",e.speed===y&&"active"),onClick:()=>u(y),children:[y,"x"]},y))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(y=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:y},y))})]})]})]})]}):jsxRuntime.jsxs("div",{className:d("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Sl(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 El(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 Lp(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 Ip(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function $v(e,t,a,r,o,s=100){let n=e.map(u=>({...u,x:u.x??a/2+Math.random()*100-50,y:u.y??r/2+Math.random()*100-50,vx:0,vy:0})),m=new Map(n.map(u=>[u.id,u]));for(let u=0;u<s;u++){let i=1-u/s;n.forEach(p=>{let l=a/2,f=r/2;p.vx+=(l-p.x)*o.centerForce*i,p.vy+=(f-p.y)*o.centerForce*i,n.forEach(y=>{if(p.id===y.id)return;let x=p.x-y.x,C=p.y-y.y,h=Math.sqrt(x*x+C*C)||1,b=o.chargeStrength*i/(h*h);p.vx+=x/h*b,p.vy+=C/h*b;});}),t.forEach(p=>{let l=m.get(typeof p.source=="string"?p.source:p.source.id),f=m.get(typeof p.target=="string"?p.target:p.target.id);if(!l||!f)return;let y=f.x-l.x,x=f.y-l.y,C=Math.sqrt(y*y+x*x)||1,h=(C-o.linkDistance)/C*o.forceStrength*i;l.vx+=y*h,l.vy+=x*h,f.vx-=y*h,f.vy-=x*h;}),n.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return n}function Bp({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:m,className:u}){let i=react.useRef(null),[p,l]=react.useState([]),[f,y]=react.useState(null),[x,C]=react.useState(null),[h,b]=react.useState(null),[g,k]=react.useState(1),[c,T]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let $=$v(e,t,a.width,a.height,a,150);l($);},[e,t,a]);let w=react.useCallback(($,j)=>{a.enableDragging&&(j.stopPropagation(),y($));},[a.enableDragging]),R=react.useCallback($=>{if(!f||!i.current)return;let ne=i.current.getBoundingClientRect(),re=($.clientX-ne.left-c.x)/g,se=($.clientY-ne.top-c.y)/g;l(ye=>ye.map(be=>be.id===f?{...be,x:re,y:se,fx:re,fy:se}:be));},[f,g,c]),v=react.useCallback(()=>{y(null);},[]),I=react.useCallback(($,j)=>{j.stopPropagation(),m?.({type:"node-click",node:$,position:{x:j.clientX,y:j.clientY}});},[m]),F=react.useCallback(($,j)=>{j.stopPropagation(),m?.({type:"edge-click",edge:$,position:{x:j.clientX,y:j.clientY}});},[m]),N=react.useCallback($=>{let j=p.find(ne=>ne.id===$);return j?{x:j.x,y:j.y}:{x:0,y:0}},[p]),U=react.useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let j=$.card.priority;return j==="URGENT"?"#ef4444":j==="HIGH"?"#f59e0b":j==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:d("relationships-graph-empty",u),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:d("relationships-graph",u),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>k($=>Math.min($+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(g*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>k($=>Math.max($-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{k(1),T({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Sl($)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Lp($)," ",El($)]})]},$))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:R,onMouseUp:v,onMouseLeave:v,children:[jsxRuntime.jsxs("g",{transform:`translate(${c.x}, ${c.y}) scale(${g})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let j=N(typeof $.source=="string"?$.source:$.source.id),ne=N(typeof $.target=="string"?$.target:$.target.id),re=Ip($.type),se=h===$.id,ye=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:d("relationships-graph-edge",se&&"hovered",ye&&"critical"),onMouseEnter:()=>b($.id),onMouseLeave:()=>b(null),onClick:be=>F($,be),children:[jsxRuntime.jsx("line",{x1:j.x,y1:j.y,x2:ne.x,y2:ne.y,stroke:Sl($.type),strokeWidth:ye?a.edgeWidth*2:a.edgeWidth,strokeOpacity:se?1:.6,markerEnd:re?"url(#arrowhead)":void 0}),a.showEdgeLabels&&se&&jsxRuntime.jsx("text",{x:(j.x+ne.x)/2,y:(j.y+ne.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:El($.type)})]},$.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map($=>{let j=x===$.id,ne=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:d("relationships-graph-node",j&&"hovered",ne&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:re=>w($.id,re),onMouseEnter:()=>C($.id),onMouseLeave:()=>C(null),onClick:re=>I($,re),children:[jsxRuntime.jsx("circle",{r:ne?a.nodeSize*1.2:a.nodeSize,fill:U($),stroke:ne?"#fbbf24":"#ffffff",strokeWidth:ne?3:2,opacity:j?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:$.card.title.length>20?$.card.title.substring(0,20)+"...":$.card.title})]},$.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function $p({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[m,u]=react.useState(false),[i,p]=react.useState(null),[l,f]=react.useState(null),y=react.useRef(null),x=m||o;react.useEffect(()=>{e&&y.current&&y.current.focus();},[e]),react.useEffect(()=>{let g=k=>{k.key==="Escape"&&!x&&C();};if(e)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,x]);let C=()=>{x||(n(""),p(null),f(null),t());},h=async()=>{if(!(!s.trim()||x)){u(true),p(null),f(null);try{let g=await r(s.trim());f(g);}catch(g){p(g instanceof Error?g.message:"Failed to generate plan");}finally{u(false);}}},b=()=>{l&&(a(l),C());};return e?jsxRuntime.jsxs(ht,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:g=>g.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:C,disabled:x,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((g,k)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:g.title},k))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((g,k)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:g.title}),g.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:g.description})]}),g.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${g.priority==="URGENT"?"bg-red-500/20 text-red-400":g.priority==="HIGH"?"bg-orange-500/20 text-orange-400":g.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:g.priority})]})},k)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:y,value:s,onChange:g=>n(g.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:x}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((g,k)=>jsxRuntime.jsx("button",{onClick:()=>n(g),disabled:x,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:g},k))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:C,disabled:x,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),l?jsxRuntime.jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,disabled:!s.trim()||x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Pl={"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 zv={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Hv={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 Wv(e,t,a){let r=Pl[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function un(e){return `$${e.toFixed(4)}`}var Ml=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Wv(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,f)=>l+f.cost,0),s=a.reduce((l,f)=>l+f.inputTokens,0),n=a.reduce((l,f)=>l+f.outputTokens,0),m=a.filter(l=>l.success),u=a.reduce((l,f)=>l+f.duration,0),i={},p={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,p[l.feature]=(p[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:p,averageDuration:r>0?u/r:0,successRate:r>0?m.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let m=this.operations.filter(p=>p.timestamp>=n).length,u=Math.max(0,o-m),i=m/o*100;return {used:m,limit:o,remaining:u,percentUsed:i,isExceeded:m>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},bo=new Ml;function Hp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(bo.getStats()),[s,n]=react.useState(bo.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let u=setInterval(()=>{o(bo.getStats()),n(bo.checkLimit(a));},1e3);return ()=>clearInterval(u)},[e,a]),react.useEffect(()=>{let u=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,t]),!e)return null;let m=bo.getRecentOperations(5);return jsxRuntime.jsxs(ht,{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: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.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:un(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(([u,i])=>{let p=r.costsByFeature[u]||0,l=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:u.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:un(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},u)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),m.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:m.map(u=>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:u.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(u.timestamp).toLocaleTimeString()," \u2022"," ",u.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[u.inputTokens+u.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:un(u.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${u.success?"bg-green-400":"bg-red-400"}`})]})]},u.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 _p({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,m]=react.useState(""),[u,i]=react.useState(""),[p,l]=react.useState(""),[f,y]=react.useState(false),[x,C]=react.useState(null),[h,b]=react.useState(null),[g,k]=react.useState(null),c=react.useRef(null),T=f||o;react.useEffect(()=>{e&&c.current&&c.current.focus();},[e]),react.useEffect(()=>{let F=N=>{N.key==="Escape"&&!T&&w();};if(e)return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[e,T]);let w=()=>{T||(m(""),i(""),l(""),C(null),b(null),k(null),t());},R=async()=>{if(!(!n.trim()||T)){y(true),C(null),b(null),k(null);try{let F=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:u||void 0,endDate:p||void 0});b(F.tasks.tasks),k({from_cache:F.from_cache,tokens_used:F.tokens_used,mock_mode:F.mock_mode,similarity:F.similarity,tokens_saved:F.tokens_saved});}catch(F){C(F instanceof Error?F.message:"Failed to generate tasks");}finally{y(false);}}},v=()=>{h&&(a(h),w());};if(!e)return null;let I=g?.similarity?((g.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(ht,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:w}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:F=>F.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:w,disabled:T,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[g?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),g?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",I,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[g?.tokens_used||0," tokens"]}),g?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[g.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((F,N)=>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:["#",N+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:F.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"})]}),F.start," \u2192 ",F.end]}),jsxRuntime.jsxs("span",{children:[F.duration," days"]}),F.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",F.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${F.priority==="high"?"bg-red-500/20 text-red-400":F.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:F.priority})]})},F.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:c,value:n,onChange:F=>m(F.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled: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:u,onChange:F=>i(F.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:T})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:F=>l(F.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})]})]}),x&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:x}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((F,N)=>jsxRuntime.jsx("button",{onClick:()=>m(F),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:F},N))})]})]})}),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:w,disabled:T,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:R,disabled:!n.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 Cs({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&Cn(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,g,k)=>{console.warn(`Retry attempt ${g} after ${k}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=react.useCallback(async(h,b,g)=>{r(k=>{let c=k.cards.find(F=>F.id===h);if(!c)return k;let T=c.columnId,w={...c,columnId:b,position:g},R=k.cards.map(F=>F.id===h?w:F),v=k.columns.map(F=>{if(F.id===T)return {...F,cardIds:F.cardIds.filter(N=>N!==h)};if(F.id===b){let N=R.filter(U=>U.columnId===b).sort((U,$)=>U.position-$.position);return {...F,cardIds:N.map(U=>U.id)}}return F}),I={...k,cards:R,columns:v};return o(I),I});},[o]),n=react.useCallback(async(h,b)=>{r(g=>{let k=g.cards.map(T=>T.id===h?{...T,...b}:T),c={...g,cards:k};return o(c),c});},[o]),m=react.useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(g=>{let k={...h,id:b},c=g.columns.map(w=>w.id===h.columnId?{...w,cardIds:[...w.cardIds,b]}:w),T={...g,cards:[...g.cards,k],columns:c};return o(T),T});},[o]),u=react.useCallback(async h=>{r(b=>{let g=b.cards.find(w=>w.id===h);if(!g)return b;let k=b.cards.filter(w=>w.id!==h),c=b.columns.map(w=>w.id===g.columnId?{...w,cardIds:w.cardIds.filter(R=>R!==h)}:w),T={...b,cards:k,columns:c};return o(T),T});},[o]),i=react.useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(g=>{let k={...h,id:b,cardIds:[]},c={...g,columns:[...g.columns,k]};return o(c),c});},[o]),p=react.useCallback(async(h,b)=>{r(g=>{let k=g.columns.map(T=>T.id===h?{...T,...b}:T),c={...g,columns:k};return o(c),c});},[o]),l=react.useCallback(async h=>{r(b=>{let g=b.cards.filter(T=>T.columnId!==h),k=b.columns.filter(T=>T.id!==h),c={...b,cards:g,columns:k};return o(c),c});},[o]),f=react.useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return m(h),b},[m]),y=react.useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),x=react.useCallback(()=>{r(h=>{let b={...h,cards:[],columns:[]};return o(b),b});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:m,onCardDelete:u,onColumnCreate:i,onColumnUpdate:p,onColumnDelete:l},setBoard:r,helpers:{addCard:f,addColumn:y,deleteCard:u,deleteColumn:l,clearBoard:x}}}function jp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Cs({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(u,i,p={})=>{s.addCard({title:i,columnId:u,position:r.cards.filter(l=>l.columnId===u).length,...p});},addColumn:(u,i)=>{let p=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:u,position:i??p+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var gn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Yp={by:"none",order:"asc"};function qp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...gn,...e}),[s,n]=react.useState({...Yp,...t}),m=react.useCallback(C=>{o(h=>({...h,...C}));},[]),u=react.useCallback(C=>{n(h=>({...h,...C}));},[]),i=react.useCallback(()=>{o(gn),n(Yp);},[]),p=react.useCallback(()=>{a&&o({...gn,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...gn,dateFilter:"overdue"});},[]),f=react.useCallback(()=>{o({...gn,priorities:["HIGH","URGENT"]});},[]),y=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]),x=react.useCallback(C=>{let h=[...C];if(r.search){let b=r.search.toLowerCase();h=h.filter(g=>g.title.toLowerCase().includes(b)||g.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,g=b.getFullYear(),k=String(b.getMonth()+1).padStart(2,"0"),c=String(b.getDate()).padStart(2,"0"),T=`${g}-${k}-${c}`;h=h.filter(w=>{if(!w.endDate&&!w.dueDate)return false;let R=w.endDate||w.dueDate;if(!R)return false;let v;if(typeof R=="string")v=R.split("T")[0]||R;else {let I=R.getUTCFullYear(),F=String(R.getUTCMonth()+1).padStart(2,"0"),N=String(R.getUTCDate()).padStart(2,"0");v=`${I}-${F}-${N}`;}switch(r.dateFilter){case "overdue":return v<T;case "today":return v===T;case "this-week":let I=new Date(T+"T00:00:00"),F=new Date(v+"T00:00:00"),N=new Date(I);return N.setDate(N.getDate()+7),F>=I&&F<=N;case "custom":if(r.dateRange){let U=typeof R=="string"?new Date(R):R;return U>=r.dateRange.start&&U<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(h=h.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(k=>r.assignees.includes(k)))),r.labels.length>0&&(h=h.filter(b=>b.labels&&b.labels.some(g=>r.labels.includes(g)))),r.columns.length>0&&(h=h.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&h.sort((b,g)=>{let k=0;switch(s.by){case "created":let c=b.createdAt?new Date(b.createdAt).getTime():0,T=g.createdAt?new Date(g.createdAt).getTime():0;k=c-T;break;case "priority":let w={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},R=w[b.priority||"LOW"],v=w[g.priority||"LOW"];k=R-v;break;case "dueDate":let I=b.endDate||b.dueDate,F=g.endDate||g.dueDate;if(!I)return 1;if(!F)return -1;let N=typeof I=="string"?new Date(I).getTime():I.getTime(),U=typeof F=="string"?new Date(F).getTime():F.getTime();k=N-U;break;case "title":k=b.title.localeCompare(g.title);break;case "estimate":let $=b.estimatedTime||0,j=g.estimatedTime||0;k=$-j;break;default:k=0;}return s.order==="asc"?k:-k}),h},[r,s]);return {filters:r,sort:s,setFilters:m,setSort:u,resetFilters:i,filterMyTasks:p,filterOverdue:l,filterHighPriority:f,applyFilters:x,hasActiveFilters:y}}var Jp,Zp;if(typeof window<"u")try{let e=xn("ai");Jp=e.generateObject,Zp=e.generateText;}catch{}function Qp(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Jp&&Zp&&e.apiKey),n=react.useCallback(async l=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",l),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(f){let y=f instanceof Error?f:new Error("Failed to generate plan");throw o(y),y}finally{a(false);}},[s]),m=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(f){let y=f instanceof Error?f:new Error("Failed to suggest assignee");throw o(y),y}finally{a(false);}},[s]),u=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("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(f){let y=f instanceof Error?f:new Error("Failed to predict risks");throw o(y),y}finally{a(false);}},[s]),i=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(f){let y=f instanceof Error?f:new Error("Failed to generate subtasks");throw o(y),y}finally{a(false);}},[s]),p=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(f){let y=f instanceof Error?f:new Error("Failed to estimate effort");throw o(y),y}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:m,onPredictRisks:u,onGenerateSubtasks:i,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function Fl(){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 eu(e){let{cards:t}=e,[a,r]=Fl(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,f)=>{if(!f){r({selectedCardIds:[l],lastSelectedCardId:l});return}let y=f.ctrlKey||f.metaKey,x=f.shiftKey;if(y)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(C=>C!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(x&&a.lastSelectedCardId){let C=t.find(b=>b.id===l),h=t.find(b=>b.id===a.lastSelectedCardId);if(C&&h&&C.columnId===h.columnId){let b=t.filter(v=>v.columnId===C.columnId).sort((v,I)=>v.position-I.position),g=b.findIndex(v=>v.id===a.lastSelectedCardId),k=b.findIndex(v=>v.id===l),[c,T]=g<k?[g,k]:[k,g],w=b.slice(c,T+1).map(v=>v.id),R=Array.from(new Set([...a.selectedCardIds,...w]));r({selectedCardIds:R,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(f=>f!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),m=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),u=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),p=react.useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:m,selectAll:u,toggleCard:i,getSelectedCards:p}}var tu={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function au(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...tu,...a}),[a]),[s,n]=react.useState([]),m=react.useCallback((C,h,b,g,k)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let c={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:C,cardIds:h,columnId:b,strategy:g,color:k,isExpanded:true,position:s.filter(T=>T.columnId===b).length,createdAt:new Date};n(T=>[...T,c]);},[o.minCardsPerStack,s]),u=react.useCallback(C=>{n(h=>h.filter(b=>b.id!==C));},[]),i=react.useCallback(C=>{n(h=>h.map(b=>b.id===C?{...b,isExpanded:!b.isExpanded}:b));},[]),p=react.useCallback((C,h)=>{n(b=>b.map(g=>g.id===C&&!g.cardIds.includes(h)?{...g,cardIds:[...g.cardIds,h]}:g));},[]),l=react.useCallback((C,h)=>{n(b=>b.map(g=>{if(g.id===C){let k=g.cardIds.filter(c=>c!==h);return k.length<o.minCardsPerStack?null:{...g,cardIds:k}}return g}).filter(g=>g!==null));},[o.minCardsPerStack]),f=react.useCallback(C=>s.filter(h=>h.columnId===C).sort((h,b)=>h.position-b.position),[s]),y=react.useCallback(async C=>{let h=t.filter(T=>T.columnId===C);if(h.length<o.minCardsPerStack*2)return [];let b=[],g=new Map;h.forEach(T=>{T.labels&&T.labels.length>0&&T.labels.forEach(w=>{g.has(w)||g.set(w,[]),g.get(w).push(T);});}),g.forEach((T,w)=>{T.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${w}`,cardIds:T.map(R=>R.id),columnId:C,strategy:"labels",color:"#3b82f6"},reason:`${T.length} cards with label "${w}"`,confidence:.85});});let k=new Map;h.forEach(T=>{T.assignedUserIds&&T.assignedUserIds.length>0&&T.assignedUserIds.forEach(w=>{k.has(w)||k.set(w,[]),k.get(w).push(T);});}),k.forEach((T,w)=>{T.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${w.slice(-4)}`,cardIds:T.map(R=>R.id),columnId:C,strategy:"assignee",color:"#8b5cf6"},reason:`${T.length} cards assigned to the same user`,confidence:.8});});let c=new Map;if(h.forEach(T=>{T.priority&&(c.has(T.priority)||c.set(T.priority,[]),c.get(T.priority).push(T));}),c.forEach((T,w)=>{if(T.length>=o.minCardsPerStack){let R={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[w.toLowerCase()]||"\u26AA";b.push({stack:{title:`${R} ${w} Priority`,cardIds:T.map(v=>v.id),columnId:C,strategy:"priority",color:w==="high"||w==="urgent"?"#ef4444":"#10b981"},reason:`${T.length} cards with ${w} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let T of h){let R=(await r.findSimilar(T,h)).filter(v=>v.similarity>=o.autoStackConfidenceThreshold);if(R.length>=o.minCardsPerStack-1){let v=[T.id,...R.map(F=>F.card.id)],I=R.reduce((F,N)=>F+N.similarity,0)/R.length;b.push({stack:{title:`\u2728 Similar to "${T.title.substring(0,30)}${T.title.length>30?"...":""}"`,cardIds:v,columnId:C,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${R.length+1} similar tasks`,confidence:I});}}return b.filter(T=>T.confidence>=o.autoStackConfidenceThreshold).sort((T,w)=>w.confidence-T.confidence).slice(0,5)},[t,o,r]),x=react.useCallback(C=>{m(C.stack.title,C.stack.cardIds,C.stack.columnId,C.stack.strategy,C.stack.color);},[m]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await y(h),g=b[0];b.length>0&&g&&g.confidence>=.9&&x(g);});},[]),{stacks:s,createStack:m,deleteStack:u,toggleStack:i,addToStack:p,removeFromStack:l,getStacksForColumn:f,getSuggestions:y,applySuggestion:x,config:o}}var ru=react.createContext(null);function ou({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(u=>{let{Column:i}=xn("@libxai/core");s.set(u.id,new i(u));}),t?.cards?.forEach(u=>{let{Card:i}=xn("@libxai/core");n.set(u.id,new i(u));});let m=null;if(t?.board){let{Board:u}=xn("@libxai/core");m=new u(t.board);}r.current=new core.BoardStore({board:m,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(ru.Provider,{value:{store:o},children:e})}function Ts(){let e=react.useContext(ru);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function bn(){let e=Ts(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let m=react.useCallback(g=>{e.updateBoard(g);},[e]),u=react.useCallback(g=>{e.addColumn(g);},[e]),i=react.useCallback((g,k)=>{e.updateColumn(g,k);},[e]),p=react.useCallback(g=>{e.deleteColumn(g);},[e]),l=react.useCallback(g=>e.getColumn(g),[e]),f=react.useCallback(g=>{e.addCard(g);},[e]),y=react.useCallback((g,k)=>{e.updateCard(g,k);},[e]),x=react.useCallback(g=>{e.deleteCard(g);},[e]),C=react.useCallback((g,k,c)=>{e.moveCard(g,k,c);},[e]),h=react.useCallback(g=>e.getCard(g),[e]),b=react.useCallback(g=>e.getCardsByColumn(g),[e]);return {board:t,columns:r,cards:s,updateBoard:m,addColumn:u,updateColumn:i,deleteColumn:p,getColumn:l,addCard:f,updateCard:y,deleteCard:x,moveCard:C,getCard:h,getCardsByColumn:b}}function su(e){let{cards:t}=bn();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 iu(e="position",t="asc"){let{cards:a}=bn();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let m={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},u=o.priority?m[o.priority]:0,i=s.priority?m[s.priority]:0;n=u-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var Ns=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=md.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let m=await Promise.resolve(n.apply(s,a));m!==void 0&&(o=m,a[0]=m);}catch(m){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,m,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},nx=new Ns;function du({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:m=0,getItemKey:u}){let i=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:m}),l=p.getVirtualItems(),f={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},y=n?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:f,className:o,children:jsxRuntime.jsx("div",{style:y,children:l.map(x=>{let C=e[x.index];if(!C)return null;let h=u?u(C,x.index):x.index,b={position:"absolute",top:n?0:x.start,left:n?x.start:0,width:n?x.size:"100%",height:n?"100%":x.size};return jsxRuntime.jsx("div",{style:b,"data-index":x.index,children:r(C,x.index)},h)})})})}function cu(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 pu({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:m=16,getItemKey:u,horizontal:i=true}){let p=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:n,gap:m}),f=l.getVirtualItems(),y={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},x={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:y,className:s,children:jsxRuntime.jsx("div",{style:x,children:f.map(C=>{let h=e[C.index];if(!h)return null;let b=u?u(h,C.index):C.index,g={position:"absolute",top:0,left:C.start,width:C.size,height:"100%"};return jsxRuntime.jsx("div",{style:g,"data-index":C.index,children:o(h,C.index)},b)})})})}function uu(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 gu(e,t=10){return e>t}var Rl={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Ol={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},$l={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Ul={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},zl={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Hl={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Wl={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Gl={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)"},_l={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)"},Vl={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},jl={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}},Kl={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}},Ds={spacing:Rl,borderRadius:Ol,fontSize:$l,fontWeight:Ul,lineHeight:zl,zIndex:Hl,duration:Wl,easing:Gl,shadows:_l,opacity:Vl,kanban:jl,gantt:Kl};function fu(e,t,a){return e[t]??a}function Yl(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?Yl(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function lx(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function ql(e="asakaa"){let t=Yl(Ds),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=lx(o);a.push(` ${s}: ${n};`);}return `:root {
389
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function Cm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Lr(e,t){let a=Cm(e),r=t.toLowerCase().trim(),o=a.find(m=>m.name.toLowerCase()===r);if(o)return o;let s=a.find(m=>m.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(m=>{let u=m.name.toLowerCase();return n.every(i=>u.includes(i))})}function al(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 y={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(y!==void 0){let w=new Date(r),k=w.getDay(),h=y-k;return h<=0&&(h+=7),w.setDate(w.getDate()+h),w}}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),y=s[2].toLowerCase(),w=new Date(r);return y==="day"||y==="d\xEDa"||y==="dias"?w.setDate(w.getDate()+g):y==="week"||y==="semana"||y==="semanas"?w.setDate(w.getDate()+g*7):(y==="month"||y==="mes"||y==="meses")&&w.setMonth(w.getMonth()+g),w}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let m=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(m&&m[1]&&m[2]&&m[3]){let g=parseInt(m[1],10),y=parseInt(m[2],10)-1,w=parseInt(m[3],10);return new Date(w,y,g)}let u={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let g=parseInt(i[1],10),y=u[i[2].toLowerCase()],w=i[3]?parseInt(i[3],10):r.getFullYear();if(y!==void 0)return new Date(w,y,g)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let g=p[d[1].toLowerCase()],y=parseInt(d[2],10),w=d[3]?parseInt(d[3],10):r.getFullYear();if(g!==void 0)return new Date(w,g,y)}return null}function rl(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 ol(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 Tm(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 Nm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),p=r[2].trim(),d=Lr(t,i),g=al(p);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!g)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let y=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,w=new Date(g);return w.setDate(w.getDate()+y),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:g,endDate:w},message:`Moved "${d.name}" to ${g.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),p=o[2].trim(),d=Lr(t,i),g=rl(p);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!g||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let y=new Date(d.endDate);return y.setDate(y.getDate()+g),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:y},message:`Extended "${d.name}" by ${g} days. New end date: ${y.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),p=s[2].trim(),d=Lr(t,i),g=ol(p);return d?g===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:g},message:`Set "${d.name}" progress to ${g}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),p=n[2].trim(),d=Lr(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:p},message:`Renamed "${d.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let m=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]&&m[2]){let i=m[1].trim(),p=m[2].trim(),d=Lr(t,i),g=Lr(t,p);return d?g?{type:"link_tasks",taskId:g.id,taskName:g.name,dependencyFrom:d.id,dependencyTo:g.id,message:`Linked "${d.name}" \u2192 "${g.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let u=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(u&&u[1]){let i=u[1].trim(),p=Lr(t,i);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Dm(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 Ih(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 Bh(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function ls(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let d=a.find(g=>g.id===p);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>ls(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let n=p=>{if(p)return typeof p=="string"?new Date(p):p},m=n(e.startDate),u=n(e.endDate),i=e.metadata?.isMilestone===true||m&&u&&Math.abs(u.getTime()-m.getTime())<=864e5;return {id:e.id,name:e.title,startDate:m,endDate:u,progress:e.progress||0,status:Ih(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function Sm(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:Bh(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Em(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>ls(r,e,t))}var nl={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"}},sl={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"}},ds={en:nl,es:sl};function il(e){return ds[e]||ds.en}function cs(e,t){let a=il(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var ll=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-blue-500"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-green-500"}];function Pm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let g=y=>{m.current&&!m.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let u=ll[0],i=ll.find(g=>g.value===e)??u,p=i.icon,d=g=>{switch(g){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(p,{className:l("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:l("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:d(e)})]}):jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:l("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(p,{className:l("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:l("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:d(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:l("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:l("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:ll.map(g=>{let y=g.icon;return jsxRuntime.jsxs("button",{onClick:w=>{w.stopPropagation(),t(g.value),n(false);},className:l("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===g.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(y,{className:l("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:d(g.value)})]},g.value)})})]})}var dl=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function Am({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let p=d=>{m.current&&!m.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let u=dl.find(p=>p.value===e)??dl[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:l("w-4 h-4",u.color)}),jsxRuntime.jsx("span",{className:l("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u.label[i]})]}):jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),n(!s);},className:l("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:l("w-4 h-4",u.color)}),jsxRuntime.jsx("span",{className:l("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:l("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:l("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:dl.map(p=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(p.value),n(false);},className:l("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===p.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:l("w-2 h-2 rounded-full",p.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[i]})]},p.value))})]})}function us(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function gs(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Lm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,m]=react.useState(false),[u,i]=react.useState(""),p=react.useRef(null);react.useEffect(()=>{let w=k=>{p.current&&!p.current.contains(k.target)&&(m(false),i(""));};return n&&document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[n]);let d=t.filter(w=>w.name.toLowerCase().includes(u.toLowerCase())||w.email?.toLowerCase().includes(u.toLowerCase())),g=w=>e.some(k=>k.name===w),y=w=>{if(a)if(g(w.name))a(e.filter(k=>k.name!==w.name));else {let k={name:w.name,initials:us(w.name),color:w.color||gs(w.name).replace("bg-","").replace("-500",""),avatar:w.avatarUrl};a([...e,k]);}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:l("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((w,k)=>jsxRuntime.jsx("div",{className:l("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!w.avatar&&gs(w.name)),style:w.color&&!w.avatar?{backgroundColor:w.color}:void 0,title:w.name,children:w.avatar?jsxRuntime.jsx("img",{src:w.avatar,alt:w.name,className:"w-full h-full rounded-full object-cover"}):w.initials||us(w.name)},`${w.name}-${k}`)),e.length>3&&jsxRuntime.jsxs("div",{className:l("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:p,className:"relative",children:[jsxRuntime.jsx("button",{onClick:w=>{w.stopPropagation(),m(!n);},className:l("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:l("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:l("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((w,k)=>jsxRuntime.jsx("div",{className:l("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!w.avatar&&gs(w.name)),style:w.color&&!w.avatar?{backgroundColor:w.color}:void 0,children:w.avatar?jsxRuntime.jsx("img",{src:w.avatar,alt:w.name,className:"w-full h-full rounded-full object-cover"}):w.initials||us(w.name)},`${w.name}-${k}`)),e.length>2&&jsxRuntime.jsxs("span",{className:l("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:l("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-64",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsxRuntime.jsx("input",{type:"text",value:u,onChange:w=>i(w.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:l("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:w=>w.stopPropagation()})}),jsxRuntime.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:d.length===0?jsxRuntime.jsx("p",{className:l("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):d.map(w=>jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),y(w);},className:l("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:l("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!w.avatarUrl&&gs(w.name)),children:w.avatarUrl?jsxRuntime.jsx("img",{src:w.avatarUrl,alt:w.name,className:"w-full h-full rounded-full object-cover"}):us(w.name)}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:r?"text-white":"text-gray-900",children:w.name}),w.email&&jsxRuntime.jsx("div",{className:l("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:w.email})]}),g(w.name)&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},w.id))}),e.length>0&&jsxRuntime.jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((w,k)=>jsxRuntime.jsxs("span",{className:l("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[w.name,jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),a(e.filter(b=>b.name!==w.name));},className:"hover:text-red-500",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},`${w.name}-${k}`))})]})]})}var ny={en:["January","February","March","April","May","June","July","August","September","October","November","December"],es:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},sy={en:["Su","Mo","Tu","We","Th","Fr","Sa"],es:["Do","Lu","Ma","Mi","Ju","Vi","S\xE1"]};function fs({value:e,onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),[m,u]=react.useState(()=>{if(e){let h=e instanceof Date?e:new Date(e);return new Date(h.getFullYear(),h.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),i=react.useRef(null),p=e?e instanceof Date?e:new Date(e):null,d=r==="es"?"es":"en";react.useEffect(()=>{let h=b=>{i.current&&!i.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]);let g=h=>h?h.toLocaleDateString(r==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-",y=(h,b)=>new Date(h,b+1,0).getDate(),w=(h,b)=>new Date(h,b,1).getDay(),k=()=>{let h=m.getFullYear(),b=m.getMonth(),x=y(h,b),f=w(h,b),c=new Date,C=[];for(let D=0;D<f;D++)C.push(jsxRuntime.jsx("div",{className:"w-8 h-8"},`empty-${D}`));for(let D=1;D<=x;D++){let T=new Date(h,b,D),v=p&&p.getDate()===D&&p.getMonth()===b&&p.getFullYear()===h,I=c.getDate()===D&&c.getMonth()===b&&c.getFullYear()===h;C.push(jsxRuntime.jsx("button",{onClick:B=>{B.stopPropagation(),t?.(T),n(false);},className:l("w-8 h-8 rounded-full text-sm transition-colors",v?"bg-[#3B82F6] text-white":I?a?"bg-white/10 text-white":"bg-gray-100 text-gray-900":a?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-900"),children:D},D));}return C};return o||!t?jsxRuntime.jsx("span",{className:l("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:g(p)}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),n(!s);},className:l("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:l("w-4 h-4",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:g(p)})]}),s&&jsxRuntime.jsxs("div",{className:l("absolute z-50 top-full left-0 mt-1 p-3 rounded-lg shadow-lg border",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),u(new Date(m.getFullYear(),m.getMonth()-1,1));},className:l("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:l("w-4 h-4",a?"text-white":"text-gray-600")})}),jsxRuntime.jsxs("span",{className:l("text-sm font-medium",a?"text-white":"text-gray-900"),children:[ny[d][m.getMonth()]," ",m.getFullYear()]}),jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),u(new Date(m.getFullYear(),m.getMonth()+1,1));},className:l("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:l("w-4 h-4",a?"text-white":"text-gray-600")})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:sy[d].map(h=>jsxRuntime.jsx("div",{className:l("w-8 h-6 text-xs flex items-center justify-center",a?"text-[#6B7280]":"text-gray-400"),children:h},h))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:k()}),jsxRuntime.jsxs("div",{className:"mt-3 pt-3 border-t flex gap-2",style:{borderColor:a?"rgba(255,255,255,0.1)":"#E5E7EB"},children:[jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),t?.(new Date),n(false);},className:l("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation();let b=new Date;b.setDate(b.getDate()+1),t?.(b),n(false);},className:l("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Ma\xF1ana":"Tomorrow"})]})]})]})}function Om({value:e=0,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{onClick:s=>{if(r||!t)return;s.stopPropagation();let n=s.currentTarget.getBoundingClientRect(),m=s.clientX-n.left,u=Math.round(m/n.width*100),i=Math.max(0,Math.min(100,u));t(i);},className:l("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:l("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxRuntime.jsxs("span",{className:l("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function zm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[m,u]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{u(e);},[e]);let p=()=>{m!==e&&t?.(m),n(false);},d=g=>{g.key==="Enter"?p():g.key==="Escape"&&(u(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:l("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:m,onChange:g=>u(g.target.value),onBlur:p,onKeyDown:d,onClick:g=>g.stopPropagation(),className:l("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),n(true);},className:l("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Gm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false}){let[m,u]=react.useState(false),[i,p]=react.useState(e?.toString()||""),d=react.useRef(null);react.useEffect(()=>{m&&d.current&&(d.current.focus(),d.current.select());},[m]),react.useEffect(()=>{p(e?.toString()||"");},[e]);let g=()=>{let w=parseFloat(i);if(!isNaN(w)){let k=w;o!==void 0&&(k=Math.max(o,k)),s!==void 0&&(k=Math.min(s,k)),k!==e&&t?.(k);}u(false);},y=w=>{w.key==="Enter"?g():w.key==="Escape"&&(p(e?.toString()||""),u(false));};return n||!t?jsxRuntime.jsx("span",{className:l("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:e!==void 0?e:r}):m?jsxRuntime.jsx("input",{ref:d,type:"number",value:i,onChange:w=>p(w.target.value),onBlur:g,onKeyDown:y,onClick:w=>w.stopPropagation(),min:o,max:s,className:l("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:w=>{w.stopPropagation(),u(true);},className:l("text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",e===void 0&&(a?"text-[#6B7280]":"text-gray-400")),children:e!==void 0?e:r})}function _m({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,m]=react.useState(false),u=react.useRef(null);return react.useEffect(()=>{let i=p=>{u.current&&!u.current.contains(p.target)&&m(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:l("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),m(!n);},className:l("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:l("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:l("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:l("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:l("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),a(i),m(false);},className:l("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function jm({value:e=false,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsx("button",{onClick:s=>{s.stopPropagation(),!r&&t&&t(!e);},disabled:r||!t,className:l("w-5 h-5 rounded border-2 flex items-center justify-center transition-colors",e?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed"),children:e&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})})}function qm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:l("text-sm",t?"text-[#6B7280]":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:l("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function Ey(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Py(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function Qm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:m,onColumnHide:u,onColumnSort:i,availableUsers:p=[]}){let d=react.useRef(null),g=r==="es"?Jm.es:Jm.en;if(react.useEffect(()=>{let b=f=>{d.current&&!d.current.contains(f.target)&&t();},x=f=>{f.key==="Escape"&&t();};return document.addEventListener("mousedown",b),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",x);}},[t]),!e.isOpen)return null;let y=()=>{if(!e.task)return [];let b=[];return o&&b.push({id:"edit",label:g.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),b.push({id:"sep1",label:"",icon:null,separator:true}),m&&(b.push({id:"status",label:g.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:g.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{m({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:g.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{m({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:g.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{m({...e.task,status:"completed",progress:100}),t();}}]}),b.push({id:"priority",label:g.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:g.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{m({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:g.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{m({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:g.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{m({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:g.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{m({...e.task,priority:"low"}),t();}}]}),p.length>0&&b.push({id:"assign",label:g.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:p.slice(0,5).map(x=>({id:`assign-${x.id}`,label:x.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:x.name.charAt(0).toUpperCase()}),onClick:()=>{let f=e.task.assignees||[],C=f.some(D=>D.name===x.name)?f.filter(D=>D.name!==x.name):[...f,{name:x.name,initials:Ey(x.name),color:x.color||Py(x.name),avatar:x.avatarUrl}];m({...e.task,assignees:C}),t();}}))})),b.push({id:"sep2",label:"",icon:null,separator:true}),s&&b.push({id:"duplicate",label:g.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&b.push({id:"delete",label:g.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),b},w=()=>{if(!e.columnId)return [];let b=[];return i&&(b.push({id:"sort-asc",label:g.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),b.push({id:"sort-desc",label:g.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),u&&e.columnId!=="name"&&(b.push({id:"sep-hide",label:"",icon:null,separator:true}),b.push({id:"hide",label:g.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{u(e.columnId),t();}})),b},k=e.type==="task"?y():w(),h={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:d,style:h,className:l("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:k.map(b=>b.separator?jsxRuntime.jsx("div",{className:l("my-1 h-px",a?"bg-white/10":"bg-gray-200")},b.id):b.submenu?jsxRuntime.jsx(My,{item:b,isDark:a},b.id):jsxRuntime.jsxs("button",{onClick:b.onClick,className:l("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",b.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:l(b.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:b.icon}),b.label]},b.id))})}function My({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:l("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:l("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:l("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(m=>jsxRuntime.jsxs("button",{onClick:m.onClick,className:l("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:m.icon}),m.label]},m.id))})]})}var Jm={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna"}};var ap={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"})},jy=["name","status","priority","assignees","startDate","endDate","progress","tags"];function op({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:m}){let[u,i]=react.useState(""),p=react.useRef(null),d=m==="es"?rp.es:rp.en;if(react.useEffect(()=>{if(!e)return;let b=setTimeout(()=>{let x=c=>{p.current&&!p.current.contains(c.target)&&t();},f=c=>{c.key==="Escape"&&t();};document.addEventListener("mousedown",x),document.addEventListener("keydown",f),p._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",f);};},100);return ()=>{clearTimeout(b),p._cleanup&&p._cleanup();}},[e,t]),!e)return null;let g=b=>d.columns[b]||b,y=b=>{if(b==="name")return;let x=a.map(f=>f.id===b?{...f,visible:!f.visible}:f);o(x);},w=(b,x)=>{let f=a.find(C=>C.type===b&&(!x||C.customFieldId===x));if(f){y(f.id);return}let c={id:x||b,type:b,label:x?r.find(C=>C.id===x)?.name||b:g(b),width:120,visible:true,sortable:true,resizable:true,customFieldId:x};o([...a,c]);},k=jy.filter(b=>g(b).toLowerCase().includes(u.toLowerCase())),h=r.filter(b=>b.name.toLowerCase().includes(u.toLowerCase()));return jsxRuntime.jsxs("div",{ref:p,className:l("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:l("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:l("font-medium",n?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:l("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:l("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:l("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:u,onChange:b=>i(b.target.value),placeholder:d.searchPlaceholder,className:l("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:l("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:d.standardFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:k.map(b=>{let x=a.find(C=>C.type===b&&!C.customFieldId),f=x?.visible??false,c=b==="name";return jsxRuntime.jsxs("button",{onClick:()=>{c||(x?y(x.id):w(b));},disabled:c,className:l("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",c&&"opacity-50 cursor-not-allowed"),children:[jsxRuntime.jsx("div",{className:l("w-5 h-5 rounded border flex items-center justify-center",f?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:f&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:ap[b]}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:g(b)})]},b)})})]}),h.length>0&&jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:l("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:d.customFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:h.map(b=>{let f=a.find(c=>c.customFieldId===b.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>w(b.type,b.id),className:l("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:l("w-5 h-5 rounded border flex items-center justify-center",f?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:f&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:ap[b.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:b.name})]},b.id)})})]}),s&&jsxRuntime.jsx("div",{className:l("p-3 border-t",n?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:s,className:l("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-colors",n?"bg-[#3B82F6]/20 text-[#3B82F6] hover:bg-[#3B82F6]/30":"bg-blue-50 text-blue-600 hover:bg-blue-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.createField]})})]})}var rp={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",createField:"Create custom field",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",createField:"Crear campo personalizado",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var tv=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function ip({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[m,u]=react.useState("text"),[i,p]=react.useState([""]),d=o==="es"?sp.es:sp.en;react.useEffect(()=>{e&&(n(""),u("text"),p([""]));},[e]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let g=()=>{if(!s.trim())return;let h={name:s.trim(),type:m};m==="dropdown"&&(h.options=i.filter(b=>b.trim())),a(h),t();},y=()=>{p([...i,""]);},w=(h,b)=>{let x=[...i];x[h]=b,p(x);},k=h=>{i.length>1&&p(i.filter((b,x)=>x!==h));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:l("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:l("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:l("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:l("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:l("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:l("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>n(h.target.value),placeholder:d.fieldNamePlaceholder,className:l("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:l("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:tv.map(h=>jsxRuntime.jsxs("button",{onClick:()=>u(h.type),className:l("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",m===h.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:m===h.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:h.icon}),jsxRuntime.jsx("span",{className:l("text-xs",m===h.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:d.types[h.type]})]},h.type))})]}),m==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:l("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((h,b)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:h,onChange:x=>w(b,x.target.value),placeholder:`${d.option} ${b+1}`,className:l("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>k(b),className:l("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},b)),jsxRuntime.jsxs("button",{onClick:y,className:l("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:l("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:l("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsxRuntime.jsx("button",{onClick:g,disabled:!s.trim(),className:l("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var sp={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var dp={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function cp({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,m]=react.useState(false),u=react.useRef(null),i=s==="es"?dp.es:dp.en;react.useEffect(()=>{if(!n)return;let g=setTimeout(()=>{let y=k=>{u.current&&!u.current.contains(k.target)&&m(false);},w=k=>{k.key==="Escape"&&m(false);};document.addEventListener("mousedown",y),document.addEventListener("keydown",w),u._cleanup=()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",w);};},100);return ()=>{clearTimeout(g),u._cleanup&&u._cleanup();}},[n]);let p=[{value:"all",label:i.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:i.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:i.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:i.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],d=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),m(y=>!y);},className:l("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",d&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),i.filters,d&&jsxRuntime.jsx("span",{className:l("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:l("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:l("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:l("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:i.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:p.map(g=>{let y=e===g.value&&!t,w=()=>g.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(g.value),r(false);},className:l("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",y&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:l(y?g.color:"text-gray-400","flex-shrink-0"),children:w()}),jsxRuntime.jsx("span",{className:l("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:l("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:l("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{r(!t),t||a("all");},className:l("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:l("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:i.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:l("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var vv=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function fp(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(...fp(r.subtasks,t+1));return a}function xv({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 bp({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:m=[],customFields:u=[]}){let{theme:i="dark",locale:p="en",customTranslations:d,showSearch:g=true,showHierarchy:y=true,tableColumns:w,allowColumnCustomization:k=true,allowColumnResize:h=true,enableContextMenu:b=true,showCreateTaskButton:x=false,onCreateTask:f}=t,c=cs(p,d),C=i==="dark",[D,T]=react.useState("startDate"),[v,I]=react.useState("asc"),[B,N]=react.useState(""),[G,H]=react.useState("all"),[Y,le]=react.useState(false),[re,oe]=react.useState(w||vv),[be,ve]=react.useState(false),[Be,L]=react.useState(false),[$,S]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[R,K]=react.useState(null),[se,pe]=react.useState(0),[me,Le]=react.useState(0),Z=react.useRef(null);react.useEffect(()=>{w&&oe(w);},[w]);let Ze=react.useMemo(()=>{let X=new Set;function te(Ye){for(let ze of Ye)ze.subtasks?.length&&(ze.isExpanded!==false&&X.add(ze.id),te(ze.subtasks));}return te(e),X},[e]),Ne=react.useMemo(()=>re.filter(X=>X.visible),[re]),Xe=react.useCallback(X=>{a.onTaskToggleExpand?.(X);},[a]),pt=react.useCallback(X=>{D===X?I(te=>te==="asc"?"desc":"asc"):(T(X),I("asc")),a.onSortChange?.({column:X,direction:v==="asc"?"desc":"asc"});},[D,v,a]),wt=react.useCallback(X=>{oe(X),a.onColumnsChange?.(X);},[a]),Qe=react.useCallback(X=>{let te=re.map(Ye=>Ye.id===X?{...Ye,visible:false}:Ye);wt(te);},[re,wt]),gt=react.useCallback((X,te)=>{T(X),I(te);},[]),Nt=react.useCallback((X,te,Ye)=>{b&&(X.preventDefault(),S({isOpen:true,x:X.clientX,y:X.clientY,type:te?"task":"header",task:te,columnId:Ye}));},[b]),Pt=react.useCallback(()=>{S(X=>({...X,isOpen:false}));},[]),it=react.useCallback((X,te)=>{if(!h)return;X.preventDefault(),X.stopPropagation();let Ye=re.find(ze=>ze.id===te);Ye&&(K(te),pe(X.clientX),Le(Ye.width));},[re,h]);react.useEffect(()=>{if(!R)return;let X=Ye=>{let ze=Ye.clientX-se,et=Math.max(50,me+ze),st=re.map(Re=>Re.id===R?{...Re,width:et}:Re);oe(st);},te=()=>{R&&a.onColumnsChange?.(re),K(null);};return document.addEventListener("mousemove",X),document.addEventListener("mouseup",te),()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mouseup",te);}},[R,se,me,re,a]);let O=react.useCallback(async X=>{if(a.onCreateCustomField){let te={...X,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(te);}L(false);},[a]),ce=react.useCallback(X=>X.progress===100||X.status==="completed"?"completed":X.progress&&X.progress>0||X.status==="in-progress"?"in-progress":"todo",[]),we=react.useMemo(()=>{let X=fp(e);if(B.trim()){let te=B.toLowerCase();X=X.filter(Ye=>Ye.name.toLowerCase().includes(te));}return G!=="all"&&(X=X.filter(te=>ce(te)===G)),Y&&(X=X.filter(te=>ce(te)!=="completed")),X.sort((te,Ye)=>{let ze,et;switch(D){case "name":ze=te.name.toLowerCase(),et=Ye.name.toLowerCase();break;case "startDate":ze=te.startDate?.getTime()||0,et=Ye.startDate?.getTime()||0;break;case "endDate":ze=te.endDate?.getTime()||0,et=Ye.endDate?.getTime()||0;break;case "progress":ze=te.progress||0,et=Ye.progress||0;break;case "status":ze=te.status||"todo",et=Ye.status||"todo";break;case "priority":let st={urgent:0,high:1,medium:2,low:3,none:4};ze=st[te.priority]??4,et=st[Ye.priority]??4;break;default:return 0}return ze<et?v==="asc"?-1:1:ze>et?v==="asc"?1:-1:0}),X},[e,B,G,Y,D,v,ce]),$e=react.useCallback((X,te)=>{let Ye=st=>{a.onTaskUpdate?.({...X,...st});},ze=st=>st?X.customFields?.find(qe=>qe.fieldId===st)?.value:void 0,et=(st,Re)=>{if(!st)return;let ne=[...X.customFields||[]],Ge=ne.findIndex(ca=>ca.fieldId===st);Ge>=0?ne[Ge]={fieldId:st,value:Re}:ne.push({fieldId:st,value:Re}),Ye({customFields:ne});};switch(te.type){case "name":return null;case "status":return jsxRuntime.jsx(Pm,{value:X.status||(X.progress===100?"completed":X.progress&&X.progress>0?"in-progress":"todo"),onChange:Re=>{Ye({status:Re,progress:Re==="completed"?100:Re==="in-progress"?50:0});},isDark:C,locale:p,translations:c.status});case "priority":return jsxRuntime.jsx(Am,{value:X.priority,onChange:Re=>Ye({priority:Re}),isDark:C,locale:p});case "assignees":return jsxRuntime.jsx(Lm,{value:X.assignees||[],availableUsers:m,onChange:Re=>Ye({assignees:Re}),isDark:C,locale:p});case "startDate":return jsxRuntime.jsx(fs,{value:X.startDate,onChange:Re=>Ye({startDate:Re}),isDark:C,locale:p});case "endDate":return jsxRuntime.jsx(fs,{value:X.endDate,onChange:Re=>Ye({endDate:Re}),isDark:C,locale:p});case "progress":return jsxRuntime.jsx(Om,{value:X.progress||0,onChange:Re=>{let qe=Re===100?"completed":Re>0?"in-progress":"todo";Ye({progress:Re,status:qe});},isDark:C});case "tags":return jsxRuntime.jsx(qm,{value:X.tags||[],isDark:C});case "text":return jsxRuntime.jsx(zm,{value:ze(te.customFieldId)||"",onChange:Re=>et(te.customFieldId,Re),isDark:C});case "number":return jsxRuntime.jsx(Gm,{value:ze(te.customFieldId)||0,onChange:Re=>et(te.customFieldId,Re),isDark:C});case "date":let st=ze(te.customFieldId);return jsxRuntime.jsx(fs,{value:st?new Date(st):void 0,onChange:Re=>et(te.customFieldId,Re),isDark:C,locale:p});case "dropdown":return jsxRuntime.jsx(_m,{value:ze(te.customFieldId)||"",options:te.options||[],onChange:Re=>et(te.customFieldId,Re),isDark:C});case "checkbox":return jsxRuntime.jsx(jm,{value:ze(te.customFieldId)||false,onChange:Re=>et(te.customFieldId,Re),isDark:C});default:return jsxRuntime.jsx("span",{className:l("text-sm",C?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,C,p,m,c]),Ke=react.useCallback(X=>({name:c.columns.name,status:c.columns.status,priority:c.columns.priority,assignees:c.columns.assignees,startDate:c.columns.startDate,endDate:c.columns.endDate,progress:c.columns.progress})[X.type]||X.label,[c]),ft=react.useMemo(()=>Ne.reduce((X,te)=>X+te.width,0)+(k?48:0),[Ne,k]);return r?jsxRuntime.jsx("div",{className:l("flex-1 flex items-center justify-center",C?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:l("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:[c.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:l("flex-1 flex items-center justify-center",C?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:l("text-lg font-semibold mb-2",C?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:l("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:l("flex-1 flex items-center justify-center",C?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:l("text-lg font-semibold mb-2",C?"text-white":"text-gray-900"),children:c.empty.noTasks}),jsxRuntime.jsx("p",{className:l("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:c.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Z,className:l("flex-1 flex flex-col w-full h-full overflow-hidden",C?"bg-[#0F1117]":"bg-white",R&&"select-none",s),style:n,children:[jsxRuntime.jsx("div",{className:l("flex-shrink-0 px-6 py-4 border-b",C?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(cp,{value:G,hideCompleted:Y,onChange:H,onHideCompletedChange:le,isDark:C,locale:p}),jsxRuntime.jsxs("div",{className:l("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:[we.length," ",c.pagination.tasks]}),g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:l("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",C?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:B,onChange:X=>N(X.target.value),placeholder:c.toolbar.searchPlaceholder,className:l("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",C?"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.jsx("div",{className:"flex-1"}),x&&f&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:f,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-4 h-4"}),jsxRuntime.jsx("span",{children:c.toolbar.newTask})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsxs("div",{style:{minWidth:ft},children:[jsxRuntime.jsxs("div",{className:l("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",C?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[Ne.map(X=>jsxRuntime.jsxs("div",{className:l("relative flex items-center gap-2 px-4 py-3",C?"text-[#9CA3AF]":"text-gray-500"),style:{width:X.width,minWidth:X.minWidth},onContextMenu:te=>Nt(te,void 0,X.id),children:[X.sortable?jsxRuntime.jsxs("button",{onClick:()=>pt(X.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[Ke(X),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:l("w-3 h-3",D===X.id&&"text-[#3B82F6]")})]}):jsxRuntime.jsx("span",{children:Ke(X)}),h&&X.resizable&&jsxRuntime.jsx("div",{className:l("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",R===X.id&&"bg-[#3B82F6]"),onMouseDown:te=>it(te,X.id)})]},X.id)),k&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),ve(te=>!te);},className:l("p-1.5 rounded-lg transition-colors",C?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",be&&(C?"bg-white/10":"bg-gray-200")),title:p==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(op,{isOpen:be,onClose:()=>ve(false),columns:re,customFields:u,onColumnsChange:wt,onCreateCustomField:()=>{ve(false),L(true);},isDark:C,locale:p})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:we.map((X,te)=>{let Ye=Ze.has(X.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:te*.02},className:l("flex items-center border-b transition-colors",C?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(X),onDoubleClick:()=>a.onTaskDoubleClick?.(X),onContextMenu:ze=>Nt(ze,X),children:[Ne.map(ze=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:ze.width,minWidth:ze.minWidth},children:ze.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&X.level>0&&jsxRuntime.jsx("div",{style:{width:`${X.level*24}px`},className:"flex-shrink-0"}),y&&X.hasChildren&&jsxRuntime.jsx("button",{onClick:et=>{et.stopPropagation(),Xe(X.id);},className:l("p-0.5 rounded flex-shrink-0",C?"hover:bg-white/10":"hover:bg-gray-200"),children:Ye?jsxRuntime.jsx(lucideReact.ChevronDown,{className:l("w-4 h-4",C?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:l("w-4 h-4",C?"text-[#9CA3AF]":"text-gray-400")})}),y&&!X.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsx("button",{onClick:et=>{et.stopPropagation(),a.onTaskUpdate?.({...X,progress:X.progress===100?0:100,status:X.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(xv,{status:X.status,progress:X.progress})}),jsxRuntime.jsx("span",{className:l("truncate font-medium",C?"text-white":"text-gray-900",X.progress===100&&(C?"line-through text-[#6B7280]":"line-through text-gray-400")),children:X.name})]}):$e(X,ze)},ze.id)),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},X.id)})}),we.length===0&&B&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:l("w-12 h-12 mx-auto mb-4",C?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:l(C?"text-[#9CA3AF]":"text-gray-600"),children:c.empty.noResults})]})})]})}),jsxRuntime.jsx(Qm,{state:$,onClose:Pt,isDark:C,locale:p,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Qe,onColumnSort:gt,availableUsers:m}),jsxRuntime.jsx(ip,{isOpen:Be,onClose:()=>L(false),onSave:O,isDark:C,locale:p})]})}var hp=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true}],yp=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"}],vp=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var fl={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"},bl={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"},hl={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"},ys={dark:fl,light:bl,neutral:hl};function xp(e){return ys[e]||ys.dark}var yl={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"}},vl={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"}},vs={en:yl,es:vl};function cn(e){return vs[e]||vs.en}function xs(e,t){let a=cn(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 wp(e){let t=cn(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 kp(e,t=0,a=true){let r=cn(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 Uv(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 Nl(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 Sp({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 Pp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:m,availableTags:u=[],onCreateTag:i,attachmentsByTask:p,comments:d,onAddComment:g,currentUser:y,mentionableUsers:w,onTaskOpen:k}){let{theme:h="dark",locale:b="en",customTranslations:x}=t,f=xs(b,x),c=h==="dark",C={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)"},[D,T]=react.useState(r||new Date),[v,I]=react.useState(null),[B,N]=react.useState(null),[G,H]=react.useState(null),[Y,le]=react.useState(new Date),[re,oe]=react.useState({}),be=4,ve=3,[Be,L]=react.useState(false),[$,S]=react.useState(false),[R,K]=react.useState(false),[se,pe]=react.useState(false),[me,Le]=react.useState(null),[Z,Ze]=react.useState(""),[Ne,Xe]=react.useState(void 0),[pt,wt]=react.useState(null),[Qe,gt]=react.useState(false),[Nt,Pt]=react.useState(false),[it,O]=react.useState(null),[ce,we]=react.useState(false),[$e,Ke]=react.useState(new Date),[ft,X]=react.useState(false),[te,Ye]=react.useState(false),[ze,et]=react.useState(false),[st,Re]=react.useState(""),[qe,ne]=react.useState(false),[Ge,ca]=react.useState(""),[ue,Ve]=react.useState(false),Oe=react.useCallback(()=>{T(new Date(D.getFullYear(),D.getMonth()-1,1));},[D]),P=react.useCallback(()=>{T(new Date(D.getFullYear(),D.getMonth()+1,1));},[D]),ee=react.useCallback(()=>{T(new Date);},[]),xe=react.useMemo(()=>{let F=D.getFullYear(),_=D.getMonth(),Pe=new Date(F,_,1),Me=new Date(F,_+1,0),Ut=Pe.getDay(),fe=Me.getDate(),_e=Uv(e),vt=new Date;vt.setHours(0,0,0,0);let We=[],ut=Ut,wa=new Date(F,_,0).getDate();for(let Ft=ut-1;Ft>=0;Ft--){let Je=new Date(F,_-1,wa-Ft);We.push({date:Je,isCurrentMonth:false,isToday:false,isWeekend:Je.getDay()===0||Je.getDay()===6,events:_e.filter(Yt=>Nl(Je,Yt)).map(Yt=>({id:Yt.id,title:Yt.name,start:Yt.startDate,end:Yt.endDate,task:Yt}))});}for(let Ft=1;Ft<=fe;Ft++){let Je=new Date(F,_,Ft),Yt=Je.getTime()===vt.getTime();We.push({date:Je,isCurrentMonth:true,isToday:Yt,isWeekend:Je.getDay()===0||Je.getDay()===6,events:_e.filter(ga=>Nl(Je,ga)).map(ga=>({id:ga.id,title:ga.name,start:ga.startDate,end:ga.endDate,task:ga}))});}let Ta=42-We.length;for(let Ft=1;Ft<=Ta;Ft++){let Je=new Date(F,_+1,Ft);We.push({date:Je,isCurrentMonth:false,isToday:false,isWeekend:Je.getDay()===0||Je.getDay()===6,events:_e.filter(Yt=>Nl(Je,Yt)).map(Yt=>({id:Yt.id,title:Yt.name,start:Yt.startDate,end:Yt.endDate,task:Yt}))});}return We},[D,e]),z=b==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],j=D.toLocaleDateString(b==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),ge=react.useCallback((F,_)=>{if(!v)return;let Pe={...v,[F]:_};I(Pe),a.onTaskUpdate?.(Pe);},[v,a]),Ie=react.useCallback(F=>{if(!v)return;let _=v.progress||0;F==="completed"?_=100:F==="todo"&&(_=0);let Pe={...v,status:F,progress:_};I(Pe),a.onTaskUpdate?.(Pe),L(false);},[v,a]),Te=react.useCallback((F,_)=>{if(!v)return;let Pe={...v,startDate:F,endDate:_};I(Pe),a.onTaskUpdate?.(Pe);},[v,a]),U=react.useCallback(()=>{L(false),S(false),K(false),H(null),et(false),Re(""),ne(false);},[]),ae=react.useCallback(async F=>{if(F.preventDefault(),F.stopPropagation(),X(false),!v||!a.onUploadAttachments)return;let _=Array.from(F.dataTransfer.files);if(_.length!==0){Ye(true);try{await a.onUploadAttachments(v.id,_);}finally{Ye(false);}}},[v,a]),Ue=react.useCallback(async F=>{if(!v||!a.onUploadAttachments||!F.target.files)return;let _=Array.from(F.target.files);if(_.length!==0){Ye(true);try{await a.onUploadAttachments(v.id,_);}finally{Ye(false);}F.target.value="";}},[v,a]),Dt=react.useCallback(F=>{F.preventDefault(),F.stopPropagation(),X(true);},[]),dt=react.useCallback(F=>{F.preventDefault(),F.stopPropagation(),X(false);},[]),Sr=react.useCallback(F=>F<1024?`${F} B`:F<1024*1024?`${(F/1024).toFixed(1)} KB`:`${(F/(1024*1024)).toFixed(1)} MB`,[]),fr=react.useCallback(F=>F.startsWith("image/")?lucideReact.Image:F.includes("pdf")||F.includes("document")?lucideReact.FileText:lucideReact.File,[]),za=react.useMemo(()=>!v||!p?[]:p.get(v.id)||[],[v,p]);return o?jsxRuntime.jsx("div",{className:l("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",n),style:m,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:l("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:[f.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:l("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",n),style:m,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:l("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:l("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:l("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",n),style:m,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:l("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:f.labels.noEvents}),jsxRuntime.jsx("p",{className:l("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:f.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:l("flex-1 flex flex-col w-full h-full overflow-auto",c?"bg-[#0F1117]":"bg-white",n),style:m,children:[jsxRuntime.jsx("div",{className:l("flex-shrink-0 px-6 py-4 border-b",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:l("text-xl font-semibold capitalize",c?"text-white":"text-gray-900"),children:j}),jsxRuntime.jsx("button",{onClick:ee,className:l("px-3 py-1.5 text-sm rounded-lg transition-colors",c?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:f.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Oe,className:l("p-2 rounded-lg transition-colors",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:l("w-5 h-5",c?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:P,className:l("p-2 rounded-lg transition-colors",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:l("w-5 h-5",c?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 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:z.map(F=>jsxRuntime.jsx("div",{className:l("py-2 text-center text-xs font-medium uppercase",c?"text-[#9CA3AF]":"text-gray-500"),children:F},F))}),jsxRuntime.jsx("div",{className:l("grid grid-cols-7 auto-rows-min gap-px rounded-lg",c?"bg-[#2D2D2D]":"bg-gray-300"),children:xe.map((F,_)=>{let Pe=F.date.getDay()===0||F.date.getDay()===6;return jsxRuntime.jsxs("div",{className:l("min-h-[120px] p-2 transition-colors flex flex-col relative group",c?Pe?"bg-[#1C1F26]":F.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Pe?"bg-gray-100":F.isCurrentMonth?"bg-white":"bg-gray-50",F.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Me=re[_]||be,Ut=F.events.slice(0,Me),fe=F.events.length-Me;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[Ut.map(_e=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{I(_e.task),a.onEventClick?.(_e),k?.(_e.task.id);},whileHover:{scale:1.02},className:l("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",_e.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(Sp,{task:_e.task}),jsxRuntime.jsx("span",{className:"truncate",children:_e.title})]})},_e.id)),fe>0&&jsxRuntime.jsxs("button",{onClick:_e=>{_e.stopPropagation(),oe(vt=>({...vt,[_]:Me+ve}));},className:l("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:["+",fe," ",b==="es"?"M\xC1S":"MORE"]}),Me>be&&F.events.length>be&&jsxRuntime.jsx("button",{onClick:_e=>{_e.stopPropagation(),oe(vt=>({...vt,[_]:be}));},className:l("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:b==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Me=_>=28,Ut=_%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:fe=>{fe.stopPropagation(),me===_?Le(null):(Le(_),Ze(""),Xe(void 0),wt(null),O(null),gt(false),Pt(false),we(false),Ke(F.date));},className:l("w-5 h-5 rounded flex items-center justify-center transition-all",me===_?"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:l("w-3.5 h-3.5 transition-transform",me===_&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:me===_&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Le(null),Ze(""),Xe(void 0),wt(null),O(null),gt(false),Pt(false),we(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Me?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Me?-5:5,scale:.95},transition:{duration:.12},className:l("absolute w-[320px] rounded-lg shadow-2xl z-50",Me?"bottom-full mb-1":"top-full mt-1",Ut?"right-0":"left-0",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:fe=>{fe.stopPropagation(),gt(false),Pt(false),we(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Z,onChange:fe=>Ze(fe.target.value),placeholder:b==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:l("w-full bg-transparent text-sm outline-none placeholder:opacity-40",c?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:fe=>{if(fe.key==="Enter"&&Z.trim()){let _e=t.availableUsers?.find(We=>We.id===pt),vt=it||F.date;a.onTaskCreate?.({name:Z.trim(),startDate:vt,endDate:vt,priority:Ne,assignees:_e?[_e]:void 0}),Ze(""),Xe(void 0),wt(null),O(null),Le(null);}fe.key==="Escape"&&(Le(null),Ze(""),Xe(void 0),wt(null),O(null));}})}),jsxRuntime.jsxs("div",{className:l("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:fe=>{fe.stopPropagation(),gt(!Qe),Pt(false);},className:l("p-1 rounded transition-colors",Ne?Ne==="urgent"||Ne==="high"?"text-red-400 bg-red-500/20":Ne==="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:Qe&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("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:fe=>fe.stopPropagation(),children:[{id:"urgent",label:b==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:b==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:b==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:b==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:b==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(fe=>jsxRuntime.jsxs("button",{onClick:()=>{Xe(fe.id),gt(false);},className:l("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",Ne===fe.id&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:l("w-2 h-2 rounded-full",fe.color)}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:fe.label})]},fe.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:fe=>{fe.stopPropagation(),we(!ce),gt(false),Pt(false),Ke(it||F.date);},className:l("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",it?"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"}),(it||F.date).toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ce&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("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:fe=>fe.stopPropagation(),children:[jsxRuntime.jsx("div",{className:l("w-40 py-2 border-r",c?"border-white/10":"border-gray-200"),children:(()=>{let fe=new Date,_e=new Date(fe);_e.setDate(fe.getDate()+1);let vt=new Date(fe);vt.setDate(fe.getDate()+((6-fe.getDay()+7)%7||7));let We=new Date(fe);We.setDate(fe.getDate()+((1-fe.getDay()+7)%7||7));let ut=new Date(fe);ut.setDate(fe.getDate()+14);let wa=new Date(fe);return wa.setDate(fe.getDate()+28),[{label:b==="es"?"Hoy":"Today",date:fe,display:fe.toLocaleDateString(b==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:b==="es"?"Ma\xF1ana":"Tomorrow",date:_e,display:_e.toLocaleDateString(b==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:b==="es"?"Este fin de semana":"This weekend",date:vt,display:b==="es"?"s\xE1b.":"sat."},{label:b==="es"?"Pr\xF3xima semana":"Next week",date:We,display:b==="es"?"lun.":"mon."},{label:b==="es"?"2 semanas":"2 weeks",date:ut,display:ut.toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:b==="es"?"4 semanas":"4 weeks",date:wa,display:wa.toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ft,Je)=>jsxRuntime.jsxs("button",{className:l("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:()=>{O(Ft.date),we(false);},children:[jsxRuntime.jsx("span",{children:Ft.label}),jsxRuntime.jsx("span",{className:l("text-[10px]",c?"text-[#6B7280]":"text-gray-400"),children:Ft.display})]},Je))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:l("text-xs font-medium",c?"text-white":"text-gray-900"),children:$e.toLocaleDateString(b==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Ke(new Date),className:l("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:b==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Ke(new Date($e.getFullYear(),$e.getMonth()-1)),className:l("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:()=>Ke(new Date($e.getFullYear(),$e.getMonth()+1)),className:l("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:(b==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(fe=>jsxRuntime.jsx("div",{className:l("w-6 h-6 flex items-center justify-center text-[10px]",c?"text-[#6B7280]":"text-gray-400"),children:fe},fe))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let fe=$e.getFullYear(),_e=$e.getMonth(),vt=new Date(fe,_e,1).getDay(),We=new Date(fe,_e+1,0).getDate(),ut=new Date(fe,_e,0).getDate(),wa=new Date,Ta=[];for(let Je=vt-1;Je>=0;Je--)Ta.push({dayNum:ut-Je,isCurrentMonth:false,date:new Date(fe,_e-1,ut-Je)});for(let Je=1;Je<=We;Je++)Ta.push({dayNum:Je,isCurrentMonth:true,date:new Date(fe,_e,Je)});let Ft=42-Ta.length;for(let Je=1;Je<=Ft;Je++)Ta.push({dayNum:Je,isCurrentMonth:false,date:new Date(fe,_e+1,Je)});return Ta.map((Je,Yt)=>{let ga=Je.date.toDateString()===wa.toDateString(),Ir=(it||F.date).toDateString()===Je.date.toDateString();return jsxRuntime.jsx("button",{className:l("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!Je.isCurrentMonth&&(c?"text-[#4B5563]":"text-gray-300"),Je.isCurrentMonth&&(c?"text-white":"text-gray-900"),ga&&"ring-1 ring-[#3B82F6]",Ir&&"bg-[#7C3AED] text-white",!Ir&&(c?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{O(Je.date),we(false);},children:Je.dayNum},Yt)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:fe=>{fe.stopPropagation(),Pt(!Nt),gt(false);},className:l("p-1 rounded transition-colors",pt?"text-[#7C3AED] bg-[#7C3AED]/20":c?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:pt?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(fe=>fe.id===pt)?.color||"#7C3AED"},children:t.availableUsers?.find(fe=>fe.id===pt)?.initials||t.availableUsers?.find(fe=>fe.id===pt)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Nt&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("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:fe=>fe.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{wt(null),Pt(false);},className:l("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",!pt&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:l("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:b==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(fe=>jsxRuntime.jsxs("button",{onClick:()=>{wt(fe.id),Pt(false);},className:l("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",pt===fe.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:fe.color||"#7C3AED"},children:fe.initials||fe.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:fe.name})]},fe.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:l("px-3 py-2 text-xs",c?"text-[#6B7280]":"text-gray-400"),children:b==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Z.trim()){let fe=t.availableUsers?.find(vt=>vt.id===pt),_e=it||F.date;a.onTaskCreate?.({name:Z.trim(),startDate:_e,endDate:_e,priority:Ne,assignees:fe?[fe]:void 0}),Ze(""),Xe(void 0),wt(null),O(null),Le(null);}},disabled:!Z.trim(),className:l("px-2.5 py-1 rounded text-xs font-medium transition-colors",Z.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":c?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:b==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:l("text-sm font-medium",F.isToday?"text-[#3B82F6]":F.isCurrentMonth?c?"text-white":"text-gray-900":c?"text-[#6B7280]":"text-gray-400"),children:F.date.getDate()})]})]},_)})})]})}),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:()=>{I(null),ca("");},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:l("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:l("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:l("w-4 h-4",c?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:l("text-xs px-2 py-0.5 rounded",c?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[b==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:l("text-xs font-mono",c?"text-[#6B7280]":"text-gray-400"),children:v.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:l("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:l("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:l("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:()=>{I(null),ca("");},className:l("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 F=v.progress===100?0:100,Pe={...v,progress:F,status:F===100?"completed":"todo"};I(Pe),a.onTaskUpdate?.(Pe);},className:l("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",v.progress===100?"bg-green-500 border-green-500":c?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:v.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:l("text-xl font-semibold flex-1",v.progress===100?"line-through text-[#6B7280]":c?"text-white":"text-gray-900"),children:v.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:l("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{U(),L(!Be);},className:l("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",v.progress===100||v.status==="completed"?"bg-green-500/20 text-green-400":v.progress&&v.progress>0||v.status==="in-progress"?"bg-blue-500/20 text-blue-400":c?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:v.progress===100||v.status==="completed"?b==="es"?"COMPLETADO":"DONE":v.progress&&v.progress>0||v.status==="in-progress"?b==="es"?"EN PROGRESO":"IN PROGRESS":b==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Be&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>L(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("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:b==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:b==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:b==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(F=>jsxRuntime.jsxs("button",{onClick:()=>Ie(F.id),className:l("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",(v.status===F.id||F.id==="completed"&&v.progress===100||F.id==="in-progress"&&v.progress&&v.progress>0&&v.progress<100||F.id==="todo"&&(!v.progress||v.progress===0)&&v.status!=="in-progress"&&v.status!=="completed")&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:l("w-2 h-2 rounded-full",F.id==="completed"?"bg-green-500":F.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:F.label})]},F.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:l("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{L(false),S(false),H(null),K(!R);},className:l("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",c?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[v.assignees&&v.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[v.assignees.slice(0,3).map((F,_)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:F.color||"#8B5CF6"},title:F.name,children:F.initials||F.name.slice(0,2).toUpperCase()},_)),v.assignees.length>3&&jsxRuntime.jsxs("span",{className:l("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:["+",v.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:l("text-sm",c?"text-[#6B7280]":"text-gray-400"),children:b==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:l("w-3 h-3",c?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>K(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(F=>{let _=v.assignees?.some(Pe=>Pe.name===F.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Pe=v.assignees||[],Me;_?Me=Pe.filter(Ut=>Ut.name!==F.name):Me=[...Pe,{name:F.name,avatar:F.avatar,initials:F.initials||F.name.slice(0,2).toUpperCase(),color:F.color||"#8B5CF6"}],ge("assignees",Me);},className:l("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",c?"hover:bg-white/5":"hover:bg-gray-50",_&&(c?"bg-white/5":"bg-gray-50")),children:[F.avatar?jsxRuntime.jsx("img",{src:F.avatar,alt:F.name,className:"w-6 h-6 rounded-full object-cover"}):jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:F.color||"#8B5CF6"},children:F.initials||F.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:l("flex-1 text-left",c?"text-white":"text-gray-900"),children:F.name}),_&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},F.id||F.name)}):jsxRuntime.jsx("div",{className:l("px-3 py-4 text-sm text-center",c?"text-[#6B7280]":"text-gray-400"),children:b==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:l("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{H(G?null:"start"),le(v.startDate||new Date);},className:l("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:[v.startDate?.toLocaleDateString(b==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(b==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:l("mx-1",c?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),v.endDate?.toLocaleDateString(b==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(b==="es"?"Fin":"End"),(v.startDate||v.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:F=>{F.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:G&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>H(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:l("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:F=>F.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:l("w-44 py-2 border-r",c?"border-white/10":"border-gray-200"),children:[(()=>{let F=new Date,_=new Date(F);_.setDate(F.getDate()+1);let Pe=new Date(F);Pe.setDate(F.getDate()+((6-F.getDay()+7)%7||7));let Me=new Date(F);Me.setDate(F.getDate()+((1-F.getDay()+7)%7||7));let Ut=new Date(F);Ut.setDate(F.getDate()+(6-F.getDay()+7)%7+7);let fe=new Date(F);fe.setDate(F.getDate()+14);let _e=new Date(F);return _e.setDate(F.getDate()+28),[{label:b==="es"?"Hoy":"Today",date:F,display:F.toLocaleDateString(b==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:b==="es"?"Ma\xF1ana":"Tomorrow",date:_,display:_.toLocaleDateString(b==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:b==="es"?"Este fin de semana":"This weekend",date:Pe,display:b==="es"?"s\xE1b.":"sat."},{label:b==="es"?"Pr\xF3xima semana":"Next week",date:Me,display:b==="es"?"lun.":"mon."},{label:b==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Ut,display:Ut.toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:b==="es"?"2 semanas":"2 weeks",date:fe,display:fe.toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:b==="es"?"4 semanas":"4 weeks",date:_e,display:_e.toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((We,ut)=>jsxRuntime.jsxs("button",{className:l("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(G==="start"){let wa=v.endDate&&We.date>v.endDate?We.date:v.endDate;Te(We.date,wa),H("end");}else {let wa=v.startDate&&We.date<v.startDate?We.date:v.startDate;Te(wa,We.date),H(null);}},children:[jsxRuntime.jsx("span",{children:We.label}),jsxRuntime.jsx("span",{className:l("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:We.display})]},ut))})(),jsxRuntime.jsx("div",{className:l("border-t mt-2 pt-2",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Te(void 0,void 0),H(null);},className:l("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:b==="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:l("text-xs mb-3 px-2 py-1 rounded",c?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:G==="start"?b==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":b==="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:l("font-medium",c?"text-white":"text-gray-900"),children:Y.toLocaleDateString(b==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>le(new Date),className:l("p-1 rounded text-sm transition-colors",c?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:b==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>le(new Date(Y.getFullYear(),Y.getMonth()-1)),className:l("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:()=>le(new Date(Y.getFullYear(),Y.getMonth()+1)),className:l("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:(b==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(F=>jsxRuntime.jsx("div",{className:l("w-8 h-8 flex items-center justify-center text-xs",c?"text-[#6B7280]":"text-gray-400"),children:F},F))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let F=Y.getFullYear(),_=Y.getMonth(),Pe=new Date(F,_,1).getDay(),Me=new Date(F,_+1,0).getDate(),Ut=new Date(F,_,0).getDate(),fe=new Date,_e=[];for(let We=Pe-1;We>=0;We--)_e.push({day:Ut-We,isCurrentMonth:false,date:new Date(F,_-1,Ut-We)});for(let We=1;We<=Me;We++)_e.push({day:We,isCurrentMonth:true,date:new Date(F,_,We)});let vt=42-_e.length;for(let We=1;We<=vt;We++)_e.push({day:We,isCurrentMonth:false,date:new Date(F,_+1,We)});return _e.map((We,ut)=>{let wa=We.date.toDateString()===fe.toDateString(),Ta=v.startDate?.toDateString()===We.date.toDateString(),Ft=v.endDate?.toDateString()===We.date.toDateString(),Je=Ta||Ft,Yt=v.startDate&&v.endDate&&We.date>=v.startDate&&We.date<=v.endDate;return jsxRuntime.jsx("button",{className:l("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!We.isCurrentMonth&&(c?"text-[#4B5563]":"text-gray-300"),We.isCurrentMonth&&(c?"text-white":"text-gray-900"),wa&&"ring-2 ring-[#3B82F6]",Ta&&"bg-[#3B82F6] text-white",Ft&&!Ta&&"bg-[#7C3AED] text-white",Yt&&!Je&&(c?"bg-[#7C3AED]/20":"bg-purple-100"),!Je&&(c?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let ga=new Date(We.date);if(G==="start"){let Ir=v.endDate&&ga>v.endDate?ga:v.endDate;Te(ga,Ir),H("end");}else {let Ir=v.startDate&&ga<v.startDate?ga:v.startDate;Te(Ir,ga),H(null);}},children:We.day},ut)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:l("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{U(),S(!$);},className:l("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",v.priority==="high"||v.priority==="urgent"?"bg-red-500/20 text-red-400":v.priority==="medium"?"bg-yellow-500/20 text-yellow-400":v.priority==="low"?"bg-green-500/20 text-green-400":c?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:v.priority?v.priority==="high"||v.priority==="urgent"?b==="es"?"Urgente":"Urgent":v.priority==="medium"?b==="es"?"Media":"Medium":b==="es"?"Baja":"Low":b==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>S(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("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:b==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:b==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:b==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:b==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:b==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(F=>jsxRuntime.jsxs("button",{onClick:()=>{ge("priority",F.id),S(false);},className:l("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",v.priority===F.id&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:l("w-2 h-2 rounded-full",F.color)}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:F.label})]},F.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:l("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:l("text-sm",c?"text-white":"text-gray-900"),children:v.startDate&&v.endDate?`${Math.ceil((v.endDate.getTime()-v.startDate.getTime())/(1e3*60*60*24))} ${b==="es"?"d\xEDas":"days"}`:b==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:l("w-4 h-4 rounded-full border-2",c?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[se?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:v.progress||0,onChange:F=>{let _=parseInt(F.target.value),Pe=v.status;_===100?Pe="completed":_>0?Pe="in-progress":Pe="todo";let Me={...v,progress:_,status:Pe};I(Me),a.onTaskUpdate?.(Me);},onBlur:()=>pe(false),className:l("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:()=>pe(true),className:l("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:l("h-full rounded-full transition-all",v.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${v.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:l("text-sm font-medium min-w-[40px]",c?"text-white":"text-gray-900"),children:[v.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:l("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(yr,{selectedTags:v.tags||[],availableTags:u,onChange:F=>{ge("tags",F);},onCreateTag:i,theme:C})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:l("w-4 h-4 mt-1.5",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24 mt-1",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[v.dependencies&&v.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:v.dependencies.map(F=>{let _=e.find(Pe=>Pe.id===F);return jsxRuntime.jsxs("span",{className:l("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",c?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[_?.name||F.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let Pe=(v.dependencies||[]).filter(Me=>Me!==F);ge("dependencies",Pe);},className:l("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},F)})}),jsxRuntime.jsxs("button",{onClick:()=>{U(),et(!ze);},className:l("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",c?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:l("text-sm",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ze&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{et(false),Re("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:l("p-2 border-b",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:st,onChange:F=>Re(F.target.value),placeholder:b==="es"?"Buscar tarea...":"Search task...",className:l("w-full px-3 py-2 rounded-md text-sm outline-none",c?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:e.length>0?e.filter(F=>F.id!==v.id).filter(F=>st===""||F.name.toLowerCase().includes(st.toLowerCase())).map(F=>{let _=v.dependencies?.includes(F.id);return jsxRuntime.jsxs("button",{onClick:()=>{let Pe=v.dependencies||[],Me;_?Me=Pe.filter(Ut=>Ut!==F.id):Me=[...Pe,F.id],ge("dependencies",Me);},className:l("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",_&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:l("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",_?"bg-blue-500 border-blue-500":c?"border-white/30":"border-gray-300"),children:_&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:l("block truncate",c?"text-white":"text-gray-900"),children:F.name}),jsxRuntime.jsx("span",{className:l("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:F.id.slice(0,8)})]})]},F.id)}):jsxRuntime.jsx("div",{className:l("px-3 py-4 text-sm text-center",c?"text-[#6B7280]":"text-gray-500"),children:b==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:l("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{U(),ne(!qe);},className:l("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",c?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:v.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:l("text-sm",c?"text-white":"text-gray-900"),children:vr.find(F=>F.value===v.color)?.name||(b==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:l("w-3 h-3",c?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:qe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ne(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:l("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:vr.map(F=>{let _=v.color===F.value;return jsxRuntime.jsx("button",{onClick:()=>{ge("color",F.value),ne(false);},className:l("w-7 h-7 rounded-full flex items-center justify-center transition-all",_&&"ring-2 ring-offset-2",c?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:F.value,outlineColor:_?F.value:void 0},title:F.name,children:_&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},F.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:l("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:l("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:v.isMilestone||false,onChange:F=>ge("isMilestone",F.target.checked),className:l("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",v.isMilestone?"bg-purple-500 border-purple-500":c?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:l("text-sm",c?"text-white":"text-gray-900"),children:b==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:l("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:l("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:l("text-sm font-semibold",c?"text-white":"text-gray-900"),children:b==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:v.description||"",onChange:F=>ge("description",F.target.value),placeholder:b==="es"?"Agregar descripci\xF3n...":"Add description...",className:l("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",c?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:l("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"}),b==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:l("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:l("text-sm font-semibold mb-3",c?"text-white":"text-gray-900"),children:b==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:l("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"}),b==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:l("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:l("text-sm font-semibold mb-3",c?"text-white":"text-gray-900"),children:b==="es"?"Agregar subtarea":"Add subtask"}),v.subtasks&&v.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:v.subtasks.map(F=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:l("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",F.progress===100?"bg-green-500 border-green-500":c?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:F.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:l("text-sm",F.progress===100?"line-through text-[#6B7280]":c?"text-white":"text-gray-900"),children:F.name})]},F.id))}),jsxRuntime.jsxs("button",{className:l("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"}),b==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:l("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:l("text-sm font-semibold",c?"text-white":"text-gray-900"),children:b==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:l("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:l("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"}),b==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:l("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:l("text-sm font-semibold mb-3",c?"text-white":"text-gray-900"),children:[b==="es"?"Adjuntos":"Attachments",za.length>0&&jsxRuntime.jsxs("span",{className:l("ml-2 text-xs font-normal",c?"text-[#6B7280]":"text-gray-400"),children:["(",za.length,")"]})]}),za.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:za.map(F=>{let _=fr(F.type),Pe=F.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:l("flex items-center gap-3 p-2 rounded-lg group transition-colors",c?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Pe&&F.thumbnailUrl?jsxRuntime.jsx("img",{src:F.thumbnailUrl,alt:F.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:l("w-10 h-10 rounded flex items-center justify-center",c?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(_,{className:l("w-5 h-5",c?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:F.url,target:"_blank",rel:"noopener noreferrer",className:l("text-sm font-medium truncate block hover:underline",c?"text-white":"text-gray-900"),children:F.name}),jsxRuntime.jsx("p",{className:l("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:Sr(F.size)})]}),a.onDeleteAttachment&&jsxRuntime.jsx("button",{onClick:()=>a.onDeleteAttachment?.(F.id),className:l("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",c?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:b==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},F.id)})}),jsxRuntime.jsxs("div",{onDragOver:Dt,onDragLeave:dt,onDrop:ae,className:l("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",ft?c?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":c?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",te&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Ue,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||te}),te?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:l("text-sm",c?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:l("w-6 h-6 mx-auto mb-2",ft?"text-blue-500":c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:l("text-sm",c?"text-[#9CA3AF]":"text-gray-500"),children:ft?b==="es"?"Suelta los archivos aqu\xED":"Drop files here":b==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!a.onUploadAttachments&&jsxRuntime.jsx("p",{className:l("text-xs mt-1",c?"text-[#6B7280]":"text-gray-400"),children:b==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:l("w-80 border-l flex flex-col",c?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:l("px-4 py-3 border-b",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:l("text-sm font-semibold",c?"text-white":"text-gray-900"),children:[b==="es"?"Actividad":"Activity",d&&d.length>0&&jsxRuntime.jsxs("span",{className:l("ml-2 text-xs font-normal",c?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d&&d.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:d.map(F=>{let _=(()=>{let Pe=new Date,Me=new Date(F.createdAt),Ut=Pe.getTime()-Me.getTime(),fe=Math.floor(Ut/6e4),_e=Math.floor(fe/60),vt=Math.floor(_e/24);return fe<1?b==="es"?"ahora":"now":fe<60?b==="es"?`hace ${fe}m`:`${fe}m ago`:_e<24?b==="es"?`hace ${_e}h`:`${_e}h ago`:b==="es"?`hace ${vt}d`:`${vt}d ago`})();return jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:"#8B5CF6"},children:F.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:l("text-sm font-medium",c?"text-white":"text-gray-900"),children:F.user?.name||(b==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:l("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:_})]}),jsxRuntime.jsx("p",{className:l("text-sm break-words",c?"text-[#9CA3AF]":"text-gray-600"),children:F.content})]})]},F.id)})}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:l("w-10 h-10 mb-3",c?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:l("text-sm",c?"text-[#6B7280]":"text-gray-500"),children:b==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:l("p-4 border-t",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[y&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:y.color||"#8B5CF6"},children:y.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:l("flex-1 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",value:Ge,onChange:F=>ca(F.target.value),onKeyDown:async F=>{if(F.key==="Enter"&&!F.shiftKey&&v&&Ge.trim()&&g){F.preventDefault(),Ve(true);try{await g(v.id,Ge.trim()),ca("");}finally{Ve(false);}}},placeholder:b==="es"?"Escribe un comentario...":"Write a comment...",disabled:ue||!g,className:l("flex-1 bg-transparent text-sm outline-none",c?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(ue||!g)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:async()=>{if(v&&Ge.trim()&&g){Ve(true);try{await g(v.id,Ge.trim()),ca("");}finally{Ve(false);}}},disabled:ue||!Ge.trim()||!g,className:l("p-1.5 rounded transition-colors",Ge.trim()&&g?"bg-blue-500 text-white hover:bg-blue-600":c?"text-[#6B7280]":"text-gray-400",ue&&"opacity-50 cursor-not-allowed"),children:ue?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]})]})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>N(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:l("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:l("px-4 py-3 border-b flex items-center justify-between",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:l("font-medium",c?"text-white":"text-gray-900"),children:B.date.toLocaleDateString(b==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>N(null),className:l("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:B.events.map(F=>jsxRuntime.jsxs("button",{onClick:()=>{N(null),I(F.task),k?.(F.task.id);},className:l("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(Sp,{task:F.task}),jsxRuntime.jsx("span",{className:l("text-sm truncate flex-1",c?"text-white":"text-gray-900"),children:F.title}),F.task.priority==="high"||F.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},F.id))})]})]})})]})}var Dl={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"},Sl={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"},El={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"},ks={dark:Dl,light:Sl,neutral:El};function Mp(e){return ks[e]||ks.dark}function Hv({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:m}){let[u,i]=react.useState(false),p=react.useMemo(()=>t.filter(y=>e.cardIds.includes(y.id)),[t,e.cardIds]),d=react.useMemo(()=>{let y=p.length,w=new Set(p.flatMap(b=>b.assignedUserIds||[])).size,k=p.map(b=>b.priority).filter(Boolean),h=new Set(p.flatMap(b=>b.labels||[])).size;return {totalCards:y,uniqueAssignees:w,priorities:k,labels:h}},[p]),g=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:l("card-stack",!e.isExpanded&&"card-stack-collapsed",m),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick: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:l("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),u&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:y=>{y.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(y=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(y),children:a(y)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(y),children:[jsxRuntime.jsx("h4",{children:y.title}),y.description&&jsxRuntime.jsxs("p",{children:[y.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:w=>{w.stopPropagation(),s?.(e.id,y.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"})]})})]},y.id))})})]})}var Fp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function un(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 gn(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 Lp(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 Ip({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:m}){let u=react.useMemo(()=>({...Fp,...n}),[n]),[i,p]=react.useState(new Set),d=react.useRef(null),g=react.useMemo(()=>{if(!u.groupByDay)return [{date:null,events:e}];let x=new Map;return e.forEach(f=>{let c=f.timestamp.toISOString().split("T")[0],C=x.get(c);C?C.push(f):x.set(c,[f]);}),Array.from(x.entries()).sort((f,c)=>c[0].localeCompare(f[0])).map(([f,c])=>({date:new Date(f),events:c.sort((C,D)=>D.timestamp.getTime()-C.timestamp.getTime())}))},[e,u.groupByDay]),{uniqueUsers:y,uniqueTypes:w}=react.useMemo(()=>{let x=new Set,f=new Set;return e.forEach(c=>{x.add(c.userId),f.add(c.type);}),{uniqueUsers:Array.from(x),uniqueTypes:Array.from(f)}},[e]),k=x=>{p(f=>{let c=new Set(f);return c.has(x)?c.delete(x):c.add(x),c});},h=x=>{let c=new Date().getTime()-x.getTime(),C=Math.floor(c/6e4),D=Math.floor(c/36e5),T=Math.floor(c/864e5);return C<1?"just now":C<60?`${C}m ago`:D<24?`${D}h ago`:T<7?`${T}d ago`:x.toLocaleDateString()},b=react.useMemo(()=>{let x=0;return t.types&&t.types.length>0&&x++,t.users&&t.users.length>0&&x++,t.dateRange&&x++,t.searchTerm&&x++,x},[t]);return react.useEffect(()=>{if(s&&d.current){let x=d.current.querySelector(`[data-event-id="${s}"]`);x&&x.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:l("history-timeline-empty",m),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:l("history-timeline",u.compact&&"compact",m),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:x=>{let f=x.target.value;a({...t,types:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),w.map(x=>jsxRuntime.jsxs("option",{value:x,children:[gn(x)," ",x.replace("_"," ")]},x))]}),y.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:x=>{let f=x.target.value;a({...t,users:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),y.map(x=>jsxRuntime.jsx("option",{value:x,children:x},x))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:x=>a({...t,searchTerm:x.target.value})})]}),b>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:g.map(x=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[u.groupByDay&&x.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:x.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[x.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:x.events.map((f,c)=>{let C=i.has(f.id),D=s===f.id,T=Lp(f.type);return jsxRuntime.jsxs("div",{"data-event-id":f.id,className:l("history-timeline-event",C&&"expanded",D&&"selected"),onClick:()=>o?.(f),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:T},children:u.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:gn(f.type)})}),c<x.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:T}})]}),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:[u.showAvatars&&f.userAvatar&&jsxRuntime.jsx("img",{src:f.userAvatar,alt:f.userName||f.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:f.userName||f.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:un(f)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:u.useRelativeTime?h(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:v=>{v.stopPropagation(),k(f.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([v,I])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[v,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(I.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(I.to)})]})]},v)),f.metadata&&Object.keys(f.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(f.metadata).map(([v,I])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[v,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(I)})]},v))]})]})]})]},f.id)})})]},x.date?.toISOString()||"all"))})]})}function Rp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:m,onSpeedChange:u,className:i}){let p=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),g=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:l("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:l("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&gn(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&un(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:y=>m(parseInt(y.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${g}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((y,w)=>jsxRuntime.jsx("div",{className:l("history-replay-progress-marker",w===e.currentIndex&&"active"),style:{left:`${w/(e.totalEvents-1)*100}%`},onClick:()=>m(w),title:un(y)},y.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:p.map(y=>jsxRuntime.jsxs("button",{className:l("history-replay-speed-btn",e.speed===y&&"active"),onClick:()=>u(y),children:[y,"x"]},y))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(y=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:y},y))})]})]})]})]}):jsxRuntime.jsxs("div",{className:l("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Pl(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 Ml(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 Op(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 $p(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Kv(e,t,a,r,o,s=100){let n=e.map(u=>({...u,x:u.x??a/2+Math.random()*100-50,y:u.y??r/2+Math.random()*100-50,vx:0,vy:0})),m=new Map(n.map(u=>[u.id,u]));for(let u=0;u<s;u++){let i=1-u/s;n.forEach(p=>{let d=a/2,g=r/2;p.vx+=(d-p.x)*o.centerForce*i,p.vy+=(g-p.y)*o.centerForce*i,n.forEach(y=>{if(p.id===y.id)return;let w=p.x-y.x,k=p.y-y.y,h=Math.sqrt(w*w+k*k)||1,b=o.chargeStrength*i/(h*h);p.vx+=w/h*b,p.vy+=k/h*b;});}),t.forEach(p=>{let d=m.get(typeof p.source=="string"?p.source:p.source.id),g=m.get(typeof p.target=="string"?p.target:p.target.id);if(!d||!g)return;let y=g.x-d.x,w=g.y-d.y,k=Math.sqrt(y*y+w*w)||1,h=(k-o.linkDistance)/k*o.forceStrength*i;d.vx+=y*h,d.vy+=w*h,g.vx-=y*h,g.vy-=w*h;}),n.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return n}function Up({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:m,className:u}){let i=react.useRef(null),[p,d]=react.useState([]),[g,y]=react.useState(null),[w,k]=react.useState(null),[h,b]=react.useState(null),[x,f]=react.useState(1),[c,C]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let H=Kv(e,t,a.width,a.height,a,150);d(H);},[e,t,a]);let D=react.useCallback((H,Y)=>{a.enableDragging&&(Y.stopPropagation(),y(H));},[a.enableDragging]),T=react.useCallback(H=>{if(!g||!i.current)return;let le=i.current.getBoundingClientRect(),re=(H.clientX-le.left-c.x)/x,oe=(H.clientY-le.top-c.y)/x;d(be=>be.map(ve=>ve.id===g?{...ve,x:re,y:oe,fx:re,fy:oe}:ve));},[g,x,c]),v=react.useCallback(()=>{y(null);},[]),I=react.useCallback((H,Y)=>{Y.stopPropagation(),m?.({type:"node-click",node:H,position:{x:Y.clientX,y:Y.clientY}});},[m]),B=react.useCallback((H,Y)=>{Y.stopPropagation(),m?.({type:"edge-click",edge:H,position:{x:Y.clientX,y:Y.clientY}});},[m]),N=react.useCallback(H=>{let Y=p.find(le=>le.id===H);return Y?{x:Y.x,y:Y.y}:{x:0,y:0}},[p]),G=react.useCallback(H=>{if(H.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return H.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let Y=H.card.priority;return Y==="URGENT"?"#ef4444":Y==="HIGH"?"#f59e0b":Y==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return H.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:l("relationships-graph-empty",u),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:l("relationships-graph",u),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(H=>Math.min(H+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(x*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(H=>Math.max(H-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),C({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(H=>H.type))).map(H=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Pl(H)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Op(H)," ",Ml(H)]})]},H))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:T,onMouseUp:v,onMouseLeave:v,children:[jsxRuntime.jsxs("g",{transform:`translate(${c.x}, ${c.y}) scale(${x})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(H=>{let Y=N(typeof H.source=="string"?H.source:H.source.id),le=N(typeof H.target=="string"?H.target:H.target.id),re=$p(H.type),oe=h===H.id,be=H.onCriticalPath;return jsxRuntime.jsxs("g",{className:l("relationships-graph-edge",oe&&"hovered",be&&"critical"),onMouseEnter:()=>b(H.id),onMouseLeave:()=>b(null),onClick:ve=>B(H,ve),children:[jsxRuntime.jsx("line",{x1:Y.x,y1:Y.y,x2:le.x,y2:le.y,stroke:Pl(H.type),strokeWidth:be?a.edgeWidth*2:a.edgeWidth,strokeOpacity:oe?1:.6,markerEnd:re?"url(#arrowhead)":void 0}),a.showEdgeLabels&&oe&&jsxRuntime.jsx("text",{x:(Y.x+le.x)/2,y:(Y.y+le.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Ml(H.type)})]},H.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(H=>{let Y=w===H.id,le=H.onCriticalPath;return jsxRuntime.jsxs("g",{className:l("relationships-graph-node",Y&&"hovered",le&&"critical"),transform:`translate(${H.x}, ${H.y})`,onMouseDown:re=>D(H.id,re),onMouseEnter:()=>k(H.id),onMouseLeave:()=>k(null),onClick:re=>I(H,re),children:[jsxRuntime.jsx("circle",{r:le?a.nodeSize*1.2:a.nodeSize,fill:G(H),stroke:le?"#fbbf24":"#ffffff",strokeWidth:le?3:2,opacity:Y?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:H.card.title.length>20?H.card.title.substring(0,20)+"...":H.card.title})]},H.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 Wp({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[m,u]=react.useState(false),[i,p]=react.useState(null),[d,g]=react.useState(null),y=react.useRef(null),w=m||o;react.useEffect(()=>{e&&y.current&&y.current.focus();},[e]),react.useEffect(()=>{let x=f=>{f.key==="Escape"&&!w&&k();};if(e)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[e,w]);let k=()=>{w||(n(""),p(null),g(null),t());},h=async()=>{if(!(!s.trim()||w)){u(true),p(null),g(null);try{let x=await r(s.trim());g(x);}catch(x){p(x instanceof Error?x.message:"Failed to generate plan");}finally{u(false);}}},b=()=>{d&&(a(d),k());};return e?jsxRuntime.jsxs(bt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:k}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:x=>x.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:k,disabled:w,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((x,f)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:x.title},f))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((x,f)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:x.title}),x.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:x.description})]}),x.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${x.priority==="URGENT"?"bg-red-500/20 text-red-400":x.priority==="HIGH"?"bg-orange-500/20 text-orange-400":x.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:x.priority})]})},f)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:y,value:s,onChange:x=>n(x.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:w}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((x,f)=>jsxRuntime.jsx("button",{onClick:()=>n(x),disabled:w,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:x},f))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:w&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:k,disabled:w,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,disabled:!s.trim()||w,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:w?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Al={"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 qv={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Xv={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 Jv(e,t,a){let r=Al[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function fn(e){return `$${e.toFixed(4)}`}var Fl=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Jv(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,g)=>d+g.cost,0),s=a.reduce((d,g)=>d+g.inputTokens,0),n=a.reduce((d,g)=>d+g.outputTokens,0),m=a.filter(d=>d.success),u=a.reduce((d,g)=>d+g.duration,0),i={},p={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,p[d.feature]=(p[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:p,averageDuration:r>0?u/r:0,successRate:r>0?m.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let m=this.operations.filter(p=>p.timestamp>=n).length,u=Math.max(0,o-m),i=m/o*100;return {used:m,limit:o,remaining:u,percentUsed:i,isExceeded:m>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},ho=new Fl;function Vp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(ho.getStats()),[s,n]=react.useState(ho.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let u=setInterval(()=>{o(ho.getStats()),n(ho.checkLimit(a));},1e3);return ()=>clearInterval(u)},[e,a]),react.useEffect(()=>{let u=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,t]),!e)return null;let m=ho.getRecentOperations(5);return jsxRuntime.jsxs(bt,{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: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.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:fn(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(([u,i])=>{let p=r.costsByFeature[u]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:u.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:fn(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},u)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),m.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:m.map(u=>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:u.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(u.timestamp).toLocaleTimeString()," \u2022"," ",u.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[u.inputTokens+u.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:fn(u.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${u.success?"bg-green-400":"bg-red-400"}`})]})]},u.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 Yp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,m]=react.useState(""),[u,i]=react.useState(""),[p,d]=react.useState(""),[g,y]=react.useState(false),[w,k]=react.useState(null),[h,b]=react.useState(null),[x,f]=react.useState(null),c=react.useRef(null),C=g||o;react.useEffect(()=>{e&&c.current&&c.current.focus();},[e]),react.useEffect(()=>{let B=N=>{N.key==="Escape"&&!C&&D();};if(e)return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[e,C]);let D=()=>{C||(m(""),i(""),d(""),k(null),b(null),f(null),t());},T=async()=>{if(!(!n.trim()||C)){y(true),k(null),b(null),f(null);try{let B=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:u||void 0,endDate:p||void 0});b(B.tasks.tasks),f({from_cache:B.from_cache,tokens_used:B.tokens_used,mock_mode:B.mock_mode,similarity:B.similarity,tokens_saved:B.tokens_saved});}catch(B){k(B instanceof Error?B.message:"Failed to generate tasks");}finally{y(false);}}},v=()=>{h&&(a(h),D());};if(!e)return null;let I=x?.similarity?((x.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(bt,{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: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("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: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: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:[x?.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"}),x?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",I,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[x?.tokens_used||0," tokens"]}),x?.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:[x.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((B,N)=>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:["#",N+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:B.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"})]}),B.start," \u2192 ",B.end]}),jsxRuntime.jsxs("span",{children:[B.duration," days"]}),B.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",B.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${B.priority==="high"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:B.priority})]})},B.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:c,value:n,onChange:B=>m(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: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."})]}),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:u,onChange:B=>i(B.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:C})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:B=>d(B.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:C})]})]}),w&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:w}),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,N)=>jsxRuntime.jsx("button",{onClick:()=>m(B),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:B},N))})]})]})}),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:D,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"}),h?jsxRuntime.jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:T,disabled:!n.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 Tasks"})]})]})]})})]})}function Ns({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&Nn(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,x,f)=>{console.warn(`Retry attempt ${x} after ${f}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=react.useCallback(async(h,b,x)=>{r(f=>{let c=f.cards.find(B=>B.id===h);if(!c)return f;let C=c.columnId,D={...c,columnId:b,position:x},T=f.cards.map(B=>B.id===h?D:B),v=f.columns.map(B=>{if(B.id===C)return {...B,cardIds:B.cardIds.filter(N=>N!==h)};if(B.id===b){let N=T.filter(G=>G.columnId===b).sort((G,H)=>G.position-H.position);return {...B,cardIds:N.map(G=>G.id)}}return B}),I={...f,cards:T,columns:v};return o(I),I});},[o]),n=react.useCallback(async(h,b)=>{r(x=>{let f=x.cards.map(C=>C.id===h?{...C,...b}:C),c={...x,cards:f};return o(c),c});},[o]),m=react.useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let f={...h,id:b},c=x.columns.map(D=>D.id===h.columnId?{...D,cardIds:[...D.cardIds,b]}:D),C={...x,cards:[...x.cards,f],columns:c};return o(C),C});},[o]),u=react.useCallback(async h=>{r(b=>{let x=b.cards.find(D=>D.id===h);if(!x)return b;let f=b.cards.filter(D=>D.id!==h),c=b.columns.map(D=>D.id===x.columnId?{...D,cardIds:D.cardIds.filter(T=>T!==h)}:D),C={...b,cards:f,columns:c};return o(C),C});},[o]),i=react.useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let f={...h,id:b,cardIds:[]},c={...x,columns:[...x.columns,f]};return o(c),c});},[o]),p=react.useCallback(async(h,b)=>{r(x=>{let f=x.columns.map(C=>C.id===h?{...C,...b}:C),c={...x,columns:f};return o(c),c});},[o]),d=react.useCallback(async h=>{r(b=>{let x=b.cards.filter(C=>C.columnId!==h),f=b.columns.filter(C=>C.id!==h),c={...b,cards:x,columns:f};return o(c),c});},[o]),g=react.useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return m(h),b},[m]),y=react.useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),w=react.useCallback(()=>{r(h=>{let b={...h,cards:[],columns:[]};return o(b),b});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:m,onCardDelete:u,onColumnCreate:i,onColumnUpdate:p,onColumnDelete:d},setBoard:r,helpers:{addCard:g,addColumn:y,deleteCard:u,deleteColumn:d,clearBoard:w}}}function Xp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Ns({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(u,i,p={})=>{s.addCard({title:i,columnId:u,position:r.cards.filter(d=>d.columnId===u).length,...p});},addColumn:(u,i)=>{let p=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:u,position:i??p+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var bn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Zp={by:"none",order:"asc"};function Qp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...bn,...e}),[s,n]=react.useState({...Zp,...t}),m=react.useCallback(k=>{o(h=>({...h,...k}));},[]),u=react.useCallback(k=>{n(h=>({...h,...k}));},[]),i=react.useCallback(()=>{o(bn),n(Zp);},[]),p=react.useCallback(()=>{a&&o({...bn,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...bn,dateFilter:"overdue"});},[]),g=react.useCallback(()=>{o({...bn,priorities:["HIGH","URGENT"]});},[]),y=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]),w=react.useCallback(k=>{let h=[...k];if(r.search){let b=r.search.toLowerCase();h=h.filter(x=>x.title.toLowerCase().includes(b)||x.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,x=b.getFullYear(),f=String(b.getMonth()+1).padStart(2,"0"),c=String(b.getDate()).padStart(2,"0"),C=`${x}-${f}-${c}`;h=h.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let T=D.endDate||D.dueDate;if(!T)return false;let v;if(typeof T=="string")v=T.split("T")[0]||T;else {let I=T.getUTCFullYear(),B=String(T.getUTCMonth()+1).padStart(2,"0"),N=String(T.getUTCDate()).padStart(2,"0");v=`${I}-${B}-${N}`;}switch(r.dateFilter){case "overdue":return v<C;case "today":return v===C;case "this-week":let I=new Date(C+"T00:00:00"),B=new Date(v+"T00:00:00"),N=new Date(I);return N.setDate(N.getDate()+7),B>=I&&B<=N;case "custom":if(r.dateRange){let G=typeof T=="string"?new Date(T):T;return G>=r.dateRange.start&&G<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(h=h.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(f=>r.assignees.includes(f)))),r.labels.length>0&&(h=h.filter(b=>b.labels&&b.labels.some(x=>r.labels.includes(x)))),r.columns.length>0&&(h=h.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&h.sort((b,x)=>{let f=0;switch(s.by){case "created":let c=b.createdAt?new Date(b.createdAt).getTime():0,C=x.createdAt?new Date(x.createdAt).getTime():0;f=c-C;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},T=D[b.priority||"LOW"],v=D[x.priority||"LOW"];f=T-v;break;case "dueDate":let I=b.endDate||b.dueDate,B=x.endDate||x.dueDate;if(!I)return 1;if(!B)return -1;let N=typeof I=="string"?new Date(I).getTime():I.getTime(),G=typeof B=="string"?new Date(B).getTime():B.getTime();f=N-G;break;case "title":f=b.title.localeCompare(x.title);break;case "estimate":let H=b.estimatedTime||0,Y=x.estimatedTime||0;f=H-Y;break;default:f=0;}return s.order==="asc"?f:-f}),h},[r,s]);return {filters:r,sort:s,setFilters:m,setSort:u,resetFilters:i,filterMyTasks:p,filterOverdue:d,filterHighPriority:g,applyFilters:w,hasActiveFilters:y}}var tu,au;if(typeof window<"u")try{let e=kn("ai");tu=e.generateObject,au=e.generateText;}catch{}function ru(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(tu&&au&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(g){let y=g instanceof Error?g:new Error("Failed to generate plan");throw o(y),y}finally{a(false);}},[s]),m=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(g){let y=g instanceof Error?g:new Error("Failed to suggest assignee");throw o(y),y}finally{a(false);}},[s]),u=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("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 y=g instanceof Error?g:new Error("Failed to predict risks");throw o(y),y}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(g){let y=g instanceof Error?g:new Error("Failed to generate subtasks");throw o(y),y}finally{a(false);}},[s]),p=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(g){let y=g instanceof Error?g:new Error("Failed to estimate effort");throw o(y),y}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:m,onPredictRisks:u,onGenerateSubtasks:i,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function Il(){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 ou(e){let{cards:t}=e,[a,r]=Il(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,g)=>{if(!g){r({selectedCardIds:[d],lastSelectedCardId:d});return}let y=g.ctrlKey||g.metaKey,w=g.shiftKey;if(y)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(k=>k!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(w&&a.lastSelectedCardId){let k=t.find(b=>b.id===d),h=t.find(b=>b.id===a.lastSelectedCardId);if(k&&h&&k.columnId===h.columnId){let b=t.filter(v=>v.columnId===k.columnId).sort((v,I)=>v.position-I.position),x=b.findIndex(v=>v.id===a.lastSelectedCardId),f=b.findIndex(v=>v.id===d),[c,C]=x<f?[x,f]:[f,x],D=b.slice(c,C+1).map(v=>v.id),T=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:T,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(g=>g!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),m=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),u=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),p=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:m,selectAll:u,toggleCard:i,getSelectedCards:p}}var nu={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function su(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...nu,...a}),[a]),[s,n]=react.useState([]),m=react.useCallback((k,h,b,x,f)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let c={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:k,cardIds:h,columnId:b,strategy:x,color:f,isExpanded:true,position:s.filter(C=>C.columnId===b).length,createdAt:new Date};n(C=>[...C,c]);},[o.minCardsPerStack,s]),u=react.useCallback(k=>{n(h=>h.filter(b=>b.id!==k));},[]),i=react.useCallback(k=>{n(h=>h.map(b=>b.id===k?{...b,isExpanded:!b.isExpanded}:b));},[]),p=react.useCallback((k,h)=>{n(b=>b.map(x=>x.id===k&&!x.cardIds.includes(h)?{...x,cardIds:[...x.cardIds,h]}:x));},[]),d=react.useCallback((k,h)=>{n(b=>b.map(x=>{if(x.id===k){let f=x.cardIds.filter(c=>c!==h);return f.length<o.minCardsPerStack?null:{...x,cardIds:f}}return x}).filter(x=>x!==null));},[o.minCardsPerStack]),g=react.useCallback(k=>s.filter(h=>h.columnId===k).sort((h,b)=>h.position-b.position),[s]),y=react.useCallback(async k=>{let h=t.filter(C=>C.columnId===k);if(h.length<o.minCardsPerStack*2)return [];let b=[],x=new Map;h.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(D=>{x.has(D)||x.set(D,[]),x.get(D).push(C);});}),x.forEach((C,D)=>{C.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:C.map(T=>T.id),columnId:k,strategy:"labels",color:"#3b82f6"},reason:`${C.length} cards with label "${D}"`,confidence:.85});});let f=new Map;h.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(D=>{f.has(D)||f.set(D,[]),f.get(D).push(C);});}),f.forEach((C,D)=>{C.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:C.map(T=>T.id),columnId:k,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let c=new Map;if(h.forEach(C=>{C.priority&&(c.has(C.priority)||c.set(C.priority,[]),c.get(C.priority).push(C));}),c.forEach((C,D)=>{if(C.length>=o.minCardsPerStack){let T={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";b.push({stack:{title:`${T} ${D} Priority`,cardIds:C.map(v=>v.id),columnId:k,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let C of h){let T=(await r.findSimilar(C,h)).filter(v=>v.similarity>=o.autoStackConfidenceThreshold);if(T.length>=o.minCardsPerStack-1){let v=[C.id,...T.map(B=>B.card.id)],I=T.reduce((B,N)=>B+N.similarity,0)/T.length;b.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:v,columnId:k,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${T.length+1} similar tasks`,confidence:I});}}return b.filter(C=>C.confidence>=o.autoStackConfidenceThreshold).sort((C,D)=>D.confidence-C.confidence).slice(0,5)},[t,o,r]),w=react.useCallback(k=>{m(k.stack.title,k.stack.cardIds,k.stack.columnId,k.stack.strategy,k.stack.color);},[m]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await y(h),x=b[0];b.length>0&&x&&x.confidence>=.9&&w(x);});},[]),{stacks:s,createStack:m,deleteStack:u,toggleStack:i,addToStack:p,removeFromStack:d,getStacksForColumn:g,getSuggestions:y,applySuggestion:w,config:o}}var iu=react.createContext(null);function lu({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(u=>{let{Column:i}=kn("@libxai/core");s.set(u.id,new i(u));}),t?.cards?.forEach(u=>{let{Card:i}=kn("@libxai/core");n.set(u.id,new i(u));});let m=null;if(t?.board){let{Board:u}=kn("@libxai/core");m=new u(t.board);}r.current=new core.BoardStore({board:m,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(iu.Provider,{value:{store:o},children:e})}function Ds(){let e=react.useContext(iu);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function yn(){let e=Ds(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let m=react.useCallback(x=>{e.updateBoard(x);},[e]),u=react.useCallback(x=>{e.addColumn(x);},[e]),i=react.useCallback((x,f)=>{e.updateColumn(x,f);},[e]),p=react.useCallback(x=>{e.deleteColumn(x);},[e]),d=react.useCallback(x=>e.getColumn(x),[e]),g=react.useCallback(x=>{e.addCard(x);},[e]),y=react.useCallback((x,f)=>{e.updateCard(x,f);},[e]),w=react.useCallback(x=>{e.deleteCard(x);},[e]),k=react.useCallback((x,f,c)=>{e.moveCard(x,f,c);},[e]),h=react.useCallback(x=>e.getCard(x),[e]),b=react.useCallback(x=>e.getCardsByColumn(x),[e]);return {board:t,columns:r,cards:s,updateBoard:m,addColumn:u,updateColumn:i,deleteColumn:p,getColumn:d,addCard:g,updateCard:y,deleteCard:w,moveCard:k,getCard:h,getCardsByColumn:b}}function cu(e){let{cards:t}=yn();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 mu(e="position",t="asc"){let{cards:a}=yn();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let m={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},u=o.priority?m[o.priority]:0,i=s.priority?m[s.priority]:0;n=u-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var Ss=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=ud.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let m=await Promise.resolve(n.apply(s,a));m!==void 0&&(o=m,a[0]=m);}catch(m){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,m,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},gx=new Ss;function uu({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:m=0,getItemKey:u}){let i=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:m}),d=p.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},y=n?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:g,className:o,children:jsxRuntime.jsx("div",{style:y,children:d.map(w=>{let k=e[w.index];if(!k)return null;let h=u?u(k,w.index):w.index,b={position:"absolute",top:n?0:w.start,left:n?w.start:0,width:n?w.size:"100%",height:n?"100%":w.size};return jsxRuntime.jsx("div",{style:b,"data-index":w.index,children:r(k,w.index)},h)})})})}function gu(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 bu({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:m=16,getItemKey:u,horizontal:i=true}){let p=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:n,gap:m}),g=d.getVirtualItems(),y={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},w={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:y,className:s,children:jsxRuntime.jsx("div",{style:w,children:g.map(k=>{let h=e[k.index];if(!h)return null;let b=u?u(h,k.index):k.index,x={position:"absolute",top:0,left:k.start,width:k.size,height:"100%"};return jsxRuntime.jsx("div",{style:x,"data-index":k.index,children:o(h,k.index)},b)})})})}function hu(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 yu(e,t=10){return e>t}var $l={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Ul={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},zl={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Hl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Wl={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Gl={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},_l={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Vl={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)"},jl={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)"},Kl={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Yl={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}},ql={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}},Es={spacing:$l,borderRadius:Ul,fontSize:zl,fontWeight:Hl,lineHeight:Wl,zIndex:Gl,duration:_l,easing:Vl,shadows:jl,opacity:Kl,kanban:Yl,gantt:ql};function vu(e,t,a){return e[t]??a}function Xl(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)?Xl(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function hx(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Jl(e="asakaa"){let t=Xl(Es),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=hx(o);a.push(` ${s}: ${n};`);}return `:root {
390
390
  ${a.join(`
391
391
  `)}
392
- }`}function hn(e,t="asakaa"){let a=[],r=Yl(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
392
+ }`}function vn(e,t="asakaa"){let a=[],r=Xl(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
393
393
  ${a.join(`
394
394
  `)}
395
- }`}var Ss={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},Xl={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},Jl={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 Zl(e=Ss,t="asakaa"){let a=ql(t),r=hn(e,t);return `${a}
395
+ }`}var Ps={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"}},Zl={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"}},Ql={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 ed(e=Ps,t="asakaa"){let a=Jl(t),r=vn(e,t);return `${a}
396
396
 
397
- ${r}`}function bu(){return `/**
397
+ ${r}`}function xu(){return `/**
398
398
  * ASAKAA Design Tokens
399
399
  * Auto-generated from design-tokens.ts
400
400
  * Do not edit this file directly
401
401
  */
402
402
 
403
- ${Zl(Ss)}
403
+ ${ed(Ps)}
404
404
 
405
405
  /* Light theme */
406
406
  [data-theme="light"] {
407
- ${hn(Xl,"asakaa").split(`
407
+ ${vn(Zl,"asakaa").split(`
408
408
  `).slice(1,-1).join(`
409
409
  `)}
410
410
  }
411
411
 
412
412
  /* Neutral theme */
413
413
  [data-theme="neutral"] {
414
- ${hn(Jl,"asakaa").split(`
414
+ ${vn(Ql,"asakaa").split(`
415
415
  `).slice(1,-1).join(`
416
416
  `)}
417
417
  }
418
- `}var dx=({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 hu({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Ao();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,m])=>{let u=n,i=u===r;return jsxRuntime.jsxs("button",{onClick:()=>o(u),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${m.displayName} theme`,"aria-pressed":i,title:m.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(dx,{theme:u})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:m.displayName})]},u)})})}
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=Hp;exports.AI_FEATURES=Hv;exports.AI_MODELS=Pl;exports.AddCardButton=ri;exports.AddColumnButton=ai;exports.AttachmentUploader=kr;exports.BoardProvider=ou;exports.BulkOperationsToolbar=On;exports.BurnDownChart=fi;exports.CUSTOM_FIELD_TYPES=fp;exports.CalendarBoard=Np;exports.Card=Sr;exports.CardDetailModal=di;exports.CardDetailModalV2=pi;exports.CardHistoryReplay=Fp;exports.CardHistoryTimeline=Mp;exports.CardRelationshipsGraph=Bp;exports.CardStack=Fv;exports.CardTemplateSelector=wi;exports.CircuitBreaker=Os;exports.Column=No;exports.ColumnManager=_n;exports.CommandPalette=si;exports.ConfigMenu=Di;exports.ContextMenu=Io;exports.DEFAULT_SHORTCUTS=Qo;exports.DEFAULT_TABLE_COLUMNS=up;exports.DEFAULT_TEMPLATES=ki;exports.DateRangePicker=Go;exports.DependenciesSelector=Vo;exports.DependencyLine=Zn;exports.DistributionCharts=bi;exports.EditableColumnTitle=Vs;exports.ErrorBoundary=So;exports.ExportImportModal=Ti;exports.FilterBar=Ni;exports.GANTT_AI_SYSTEM_PROMPT=hm;exports.GanttAIAssistant=rs;exports.GanttBoard=pm;exports.GanttI18nContext=Lo;exports.GanttMilestone=es;exports.GanttToolbar=Gn;exports.GenerateGanttTasksDialog=_p;exports.GeneratePlanModal=$p;exports.GroupBySelector=vi;exports.KanbanBoard=Hr;exports.KanbanToolbar=ei;exports.KanbanViewAdapter=Xo;exports.KeyboardShortcutsHelp=xi;exports.ListView=pp;exports.MenuIcons=_t;exports.PluginManager=Ns;exports.PrioritySelector=ro;exports.RATE_LIMITS=zv;exports.STANDARD_FIELDS=gp;exports.SwimlaneBoardView=hi;exports.TagBadge=Ks;exports.TagList=Kd;exports.TagPicker=hr;exports.TaskBar=qn;exports.TaskDetailModal=lo;exports.TaskFormModal=bm;exports.TaskGrid=Kn;exports.ThemeModal=Mi;exports.ThemeProvider=Ac;exports.ThemeSwitcher=hu;exports.Timeline=as;exports.UserAssignmentSelector=no;exports.VelocityChart=gi;exports.VirtualGrid=pu;exports.VirtualList=du;exports.aiUsageTracker=bo;exports.borderRadius=Ol;exports.calculatePosition=wn;exports.calendarDarkTheme=Tl;exports.calendarEnTranslations=bl;exports.calendarEsTranslations=hl;exports.calendarLightTheme=Nl;exports.calendarNeutralTheme=Dl;exports.calendarThemes=xs;exports.calendarTranslations=hs;exports.cardToGanttTask=ss;exports.cardsToGanttTasks=Tm;exports.cn=d;exports.createKanbanView=cc;exports.createRetryWrapper=Hu;exports.darkTheme=Si;exports.darkTokenTheme=Ss;exports.defaultTheme=Un;exports.designTokens=Ds;exports.duration=Wl;exports.easing=Gl;exports.exportTokensToCSS=bu;exports.findTaskByName=Fr;exports.fontSize=$l;exports.fontWeight=Ul;exports.formatCost=un;exports.ganttEnTranslations=Hn;exports.ganttEsTranslations=Lc;exports.ganttTaskToCardUpdate=Cm;exports.ganttThemes=rt;exports.ganttTokens=Kl;exports.ganttTranslations=Ai;exports.ganttUtils=ve;exports.generateCSSVariables=ql;exports.generateCompleteCSS=Zl;exports.generateInitialPositions=Ou;exports.generateTasksContext=ym;exports.generateThemeVariables=hn;exports.getCalendarTheme=Dp;exports.getCalendarTranslations=ln;exports.getListViewTheme=bp;exports.getListViewTranslations=nl;exports.getMonthNames=hp;exports.getToken=fu;exports.getTranslations=Ic;exports.getWeekdayNames=yp;exports.kanbanTokens=jl;exports.lightTheme=Ei;exports.lightTokenTheme=Xl;exports.lineHeight=zl;exports.listViewDarkTheme=ul;exports.listViewEnTranslations=rl;exports.listViewEsTranslations=ol;exports.listViewLightTheme=gl;exports.listViewNeutralTheme=fl;exports.listViewThemes=bs;exports.listViewTranslations=is;exports.mergeCalendarTranslations=ys;exports.mergeListViewTranslations=ls;exports.mergeTranslations=Fi;exports.neutralTheme=Pi;exports.neutralTokenTheme=Jl;exports.opacity=Vl;exports.parseLocalCommand=km;exports.parseNaturalDate=el;exports.parseNaturalDuration=tl;exports.parseProgress=al;exports.parseStatus=xm;exports.pluginManager=nx;exports.retrySyncOperation=zu;exports.retryWithBackoff=Cn;exports.shadows=_l;exports.shouldVirtualizeGrid=gu;exports.spacing=Rl;exports.themes=po;exports.useAI=Qp;exports.useBoard=jp;exports.useBoardCore=bn;exports.useBoardStore=Ts;exports.useCardStacking=au;exports.useDragState=Zs;exports.useFilteredCards=su;exports.useFilters=qp;exports.useGanttI18n=jr;exports.useKanbanState=Cs;exports.useKeyboardShortcuts=Ec;exports.useMultiSelect=eu;exports.useSelectionState=Fl;exports.useSortedCards=iu;exports.useTheme=Ao;exports.useVirtualGrid=uu;exports.useVirtualList=cu;exports.validateAIResponse=wm;exports.withErrorBoundary=oi;exports.wouldCreateCircularDependency=Nn;exports.zIndex=Hl;//# sourceMappingURL=index.cjs.map
418
+ `}var yx=({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 wu({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Fo();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,m])=>{let u=n,i=u===r;return jsxRuntime.jsxs("button",{onClick:()=>o(u),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${m.displayName} theme`,"aria-pressed":i,title:m.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(yx,{theme:u})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:m.displayName})]},u)})})}
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=Vp;exports.AI_FEATURES=Xv;exports.AI_MODELS=Al;exports.AddCardButton=ni;exports.AddColumnButton=oi;exports.AttachmentUploader=kr;exports.BoardProvider=lu;exports.BulkOperationsToolbar=Un;exports.BurnDownChart=hi;exports.CUSTOM_FIELD_TYPES=vp;exports.CalendarBoard=Pp;exports.Card=Er;exports.CardDetailModal=mi;exports.CardDetailModalV2=gi;exports.CardHistoryReplay=Rp;exports.CardHistoryTimeline=Ip;exports.CardRelationshipsGraph=Up;exports.CardStack=Hv;exports.CardTemplateSelector=Ti;exports.CircuitBreaker=Us;exports.Column=Do;exports.ColumnManager=jn;exports.CommandPalette=li;exports.ConfigMenu=Ei;exports.ContextMenu=Bo;exports.DEFAULT_SHORTCUTS=tn;exports.DEFAULT_TABLE_COLUMNS=hp;exports.DEFAULT_TEMPLATES=Ci;exports.DateRangePicker=_o;exports.DependenciesSelector=jo;exports.DependencyLine=es;exports.DistributionCharts=yi;exports.EditableColumnTitle=Ks;exports.ErrorBoundary=Eo;exports.ExportImportModal=Di;exports.FilterBar=Si;exports.GANTT_AI_SYSTEM_PROMPT=wm;exports.GanttAIAssistant=ns;exports.GanttBoard=bm;exports.GanttI18nContext=Io;exports.GanttMilestone=as;exports.GanttToolbar=Vn;exports.GenerateGanttTasksDialog=Yp;exports.GeneratePlanModal=Wp;exports.GroupBySelector=wi;exports.KanbanBoard=Wr;exports.KanbanToolbar=ai;exports.KanbanViewAdapter=Zo;exports.KeyboardShortcutsHelp=ki;exports.ListView=bp;exports.MenuIcons=_t;exports.PluginManager=Ss;exports.PrioritySelector=oo;exports.RATE_LIMITS=qv;exports.STANDARD_FIELDS=yp;exports.SwimlaneBoardView=vi;exports.TagBadge=qs;exports.TagList=qd;exports.TagPicker=yr;exports.TaskBar=Jn;exports.TaskDetailModal=co;exports.TaskFormModal=xm;exports.TaskGrid=qn;exports.ThemeModal=Fi;exports.ThemeProvider=Bc;exports.ThemeSwitcher=wu;exports.Timeline=os;exports.UserAssignmentSelector=so;exports.VelocityChart=bi;exports.VirtualGrid=bu;exports.VirtualList=uu;exports.aiUsageTracker=ho;exports.borderRadius=Ul;exports.calculatePosition=Tn;exports.calendarDarkTheme=Dl;exports.calendarEnTranslations=yl;exports.calendarEsTranslations=vl;exports.calendarLightTheme=Sl;exports.calendarNeutralTheme=El;exports.calendarThemes=ks;exports.calendarTranslations=vs;exports.cardToGanttTask=ls;exports.cardsToGanttTasks=Em;exports.cn=l;exports.createKanbanView=gc;exports.createRetryWrapper=Vu;exports.darkTheme=Pi;exports.darkTokenTheme=Ps;exports.defaultTheme=Hn;exports.designTokens=Es;exports.duration=_l;exports.easing=Vl;exports.exportTokensToCSS=xu;exports.findTaskByName=Lr;exports.fontSize=zl;exports.fontWeight=Hl;exports.formatCost=fn;exports.ganttEnTranslations=Gn;exports.ganttEsTranslations=Oc;exports.ganttTaskToCardUpdate=Sm;exports.ganttThemes=tt;exports.ganttTokens=ql;exports.ganttTranslations=Li;exports.ganttUtils=ke;exports.generateCSSVariables=Jl;exports.generateCompleteCSS=ed;exports.generateInitialPositions=Hu;exports.generateTasksContext=km;exports.generateThemeVariables=vn;exports.getCalendarTheme=Mp;exports.getCalendarTranslations=cn;exports.getListViewTheme=xp;exports.getListViewTranslations=il;exports.getMonthNames=wp;exports.getToken=vu;exports.getTranslations=$c;exports.getWeekdayNames=kp;exports.kanbanTokens=Yl;exports.lightTheme=Mi;exports.lightTokenTheme=Zl;exports.lineHeight=Wl;exports.listViewDarkTheme=fl;exports.listViewEnTranslations=nl;exports.listViewEsTranslations=sl;exports.listViewLightTheme=bl;exports.listViewNeutralTheme=hl;exports.listViewThemes=ys;exports.listViewTranslations=ds;exports.mergeCalendarTranslations=xs;exports.mergeListViewTranslations=cs;exports.mergeTranslations=Ii;exports.neutralTheme=Ai;exports.neutralTokenTheme=Ql;exports.opacity=Kl;exports.parseLocalCommand=Nm;exports.parseNaturalDate=al;exports.parseNaturalDuration=rl;exports.parseProgress=ol;exports.parseStatus=Tm;exports.pluginManager=gx;exports.retrySyncOperation=_u;exports.retryWithBackoff=Nn;exports.shadows=jl;exports.shouldVirtualizeGrid=yu;exports.spacing=$l;exports.themes=uo;exports.useAI=ru;exports.useBoard=Xp;exports.useBoardCore=yn;exports.useBoardStore=Ds;exports.useCardStacking=su;exports.useDragState=ei;exports.useFilteredCards=cu;exports.useFilters=Qp;exports.useGanttI18n=Kr;exports.useKanbanState=Ns;exports.useKeyboardShortcuts=Fc;exports.useMultiSelect=ou;exports.useSelectionState=Il;exports.useSortedCards=mu;exports.useTheme=Fo;exports.useVirtualGrid=hu;exports.useVirtualList=gu;exports.validateAIResponse=Dm;exports.withErrorBoundary=si;exports.wouldCreateCircularDependency=Sn;exports.zIndex=Gl;//# sourceMappingURL=index.cjs.map
420
420
  //# sourceMappingURL=index.cjs.map