@libxai/board 0.17.419 → 0.17.421

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'),Sf=require('react-markdown'),Ef=require('remark-gfm'),Pf=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var mm__default=/*#__PURE__*/_interopDefault(mm);var Sf__default=/*#__PURE__*/_interopDefault(Sf);var Ef__default=/*#__PURE__*/_interopDefault(Ef);var Pf__default=/*#__PURE__*/_interopDefault(Pf);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 Bu(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 Ru=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 Ou(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=Ru,onRetry:c}=t,g,i=0;for(let p=1;p<=a;p++){i=p;try{return {data:await e(),attempts:i,success:!0}}catch(l){if(g=l,p===a||!n(g,p))return {error:g,attempts:i,success:false};let y=Ou(p,r,o,s);if(c)try{c(g,p,y);}catch(k){console.error("Error in retry callback:",k);}await new Promise(k=>setTimeout(k,y));}}return {error:g||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 Uu(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,c=`[${a}] [${r}] [${s}]`,g=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(c,o,g?n:"");break;case "INFO":console.info(c,o,g?n:"");break;case "WARN":console.warn(c,o,g?n:"");break;case "ERROR":console.error(c,o,g?n:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...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 Hu(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 Wu(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(c=>c.id===s.columnId);return [s.id,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 Gu(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}),c=n.toDataURL("image/png"),g=297,i=210,p=n.width/n.height,l=g-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,g,15,"F"),y.text(e.title||"Kanban Board",10,10);let k=(g-l)/2;return y.addImage(c,"PNG",k,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 c=e.cards.filter(g=>g.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,c.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):c.forEach(g=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(g.title,25,s),s+=6,g.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(g.description,160);o.text(p,25,s),s+=p.length*5;}let i=[];if(g.priority&&i.push(`Priority: ${g.priority}`),g.labels&&g.labels.length>0&&i.push(`Labels: ${g.labels.join(", ")}`),g.assignedUserIds&&g.assignedUserIds.length>0&&i.push(`Assigned: ${g.assignedUserIds.length} user(s)`),g.startDate||g.endDate){let p=[];g.startDate&&p.push(`Start: ${g.startDate}`),g.endDate&&p.push(`End: ${g.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 Hu(e,r);case "csv":return Wu(e);case "pdf":return await Gu(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"},c=new Blob([e],{type:n[t]}),g=URL.createObjectURL(c),i=document.createElement("a");i.href=g,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(g);}function _u(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 Vu(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 c=fd(t[n]||"");if(c.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-c.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let i={};a.forEach((y,k)=>{i[y]=c[k]||"";});let p=i.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let 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(c){s.push(`Line ${n+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function 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 _u(e);case "csv":return Vu(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 gt({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:c,themeName:g}=o,i={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":g,"data-gantt-portal":"true",style:i,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var Nd={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},Qu="#BDC3C7",eg=({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}),c=react.useRef(null),g=react.useRef(null),i=()=>{if(!g.current)return;let y=g.current.getBoundingClientRect(),k=window.innerHeight,C=window.innerWidth,h=160,b=220,u=4,x=y.right-h;x<10&&(x=y.left),x+h>C-10&&(x=C-h-10);let m=k-y.bottom,N=y.top,w;m>=b+u?w=y.bottom+u:N>=b+u?w=y.top-b-u:w=m>=N?y.bottom+u:Math.max(10,y.top-b-u),n({top:w,left:x}),o(true);};react.useEffect(()=>{let y=k=>{c.current&&!c.current.contains(k.target)&&!g.current?.contains(k.target)&&o(false);};if(r)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[r]),react.useEffect(()=>{let y=k=>{k.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||Qu;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:g,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${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(gt,{children:jsxRuntime.jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(Nd).map(([y,k])=>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:k.color,background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:C=>{C.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(eg,{color:k.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:k.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 tg=[{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,c]=react.useState({top:0,left:0}),g=react.useRef(null),i=react.useRef(null),f=(wo()?.themeName||"dark")==="dark",y=()=>{if(!i.current)return;let x=i.current.getBoundingClientRect(),m=window.innerHeight,N=window.innerWidth,w=320,R=380,v=4,I=x.left;I+w>N-10&&(I=N-w-10),I<10&&(I=10);let F=m-x.bottom,T=x.top,z;F>=R+v?z=x.bottom+v:T>=R+v?z=x.top-R-v:z=F>=T?x.bottom+v:Math.max(10,x.top-R-v),c({top:z,left:I}),s(true);};react.useEffect(()=>{let x=m=>{g.current&&!g.current.contains(m.target)&&!i.current?.contains(m.target)&&s(false);};if(o)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]),react.useEffect(()=>{let x=m=>{m.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[o]);let k=x=>{let m=new Date,N=I=>{let F=I.getFullYear(),T=String(I.getMonth()+1).padStart(2,"0"),z=String(I.getDate()).padStart(2,"0");return `${F}-${T}-${z}`},w=N(m),R=new Date(m);R.setDate(R.getDate()+x);let v=N(R);a(w,v),s(false);},C=()=>{if(!e||!t)return "Set date";let x=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(z=>isNaN(z)))return null;let I=v[0],F=v[1],T=v[2];return I===void 0||F===void 0||T===void 0?null:new Date(I,F-1,T)},m=x(e),N=x(t);if(!m||!N||isNaN(m.getTime())||isNaN(N.getTime()))return "Set date";let w=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${w[m.getMonth()]} ${m.getDate()} \u2013 ${w[N.getMonth()]} ${N.getDate()}`},h=e&&t,u=(()=>{if(!t)return false;let x=typeof t=="string"?new Date(t):t,m=new Date;return m.setHours(0,0,0,0),x<m})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):y(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${u?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${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(gt,{children:jsxRuntime.jsxs("div",{ref:g,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background: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:tg.map(x=>jsxRuntime.jsx("button",{onClick:()=>k(x.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color: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:m=>{m.currentTarget.style.backgroundColor=f?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",m.currentTarget.style.border=`1px solid ${f?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:m=>{m.currentTarget.style.backgroundColor=f?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",m.currentTarget.style.border=`1px solid ${f?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:x.label},x.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color: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:x=>a(x.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background: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:x=>a(e,x.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background: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:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function no({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[c,g]=react.useState(""),[i,p]=react.useState({top:0,left:0}),l=react.useRef(null),f=react.useRef(null),y=()=>{if(!f.current)return;let u=f.current.getBoundingClientRect(),x=window.innerHeight,m=window.innerWidth,N=300,w=380,R=4,v=u.right-N;v<10&&(v=u.left),v+N>m-10&&(v=m-N-10);let I=x-u.bottom,F=u.top,T;I>=w+R?T=u.bottom+R:F>=w+R?T=u.top-w-R:T=I>=F?u.bottom+R:Math.max(10,u.top-w-R),p({top:T,left:v}),n(true);};react.useEffect(()=>{let u=x=>{l.current&&!l.current.contains(x.target)&&!f.current?.contains(x.target)&&(n(false),g(""));};if(s)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),react.useEffect(()=>{let u=x=>{x.key==="Escape"&&(n(false),g(""));};if(s)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[s]);let k=u=>{let x=e.some(m=>m.id===u.id);a(x?e.filter(m=>m.id!==u.id):[...e,u]);},C=t.filter(u=>u.name.toLowerCase().includes(c.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(u=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:u.name,children:u.avatar?jsxRuntime.jsx("img",{src:u.avatar,alt:u.name,className:"asakaa-avatar-img"}):u.initials},u.id)),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(gt,{children:jsxRuntime.jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:c,onChange:u=>g(u.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children: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(u=>{let x=e.some(m=>m.id===u.id);return jsxRuntime.jsxs("button",{onClick:()=>k(u),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:m=>{m.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:u.color,color:"#fff"},children:u.avatar?jsxRuntime.jsx("img",{src:u.avatar,alt:u.name,className:"w-full h-full rounded-full object-cover"}):u.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:u.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:x?"#3b82f6":"transparent"},children:x?"\u2713":""})]},u.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Nn(e,t,a){let r=new Map;e.forEach(g=>{if(g.dependencies&&Array.isArray(g.dependencies)){let i=g.dependencies.map(p=>{if(typeof p=="string")return p;let l=p;return l.taskId||l.targetId||""}).filter(Boolean);r.set(g.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,c=g=>{if(!s.has(g)){s.add(g),n.add(g);let i=r.get(g)||[];for(let p of i){if(!s.has(p)&&c(p))return true;if(n.has(p))return true}}return n.delete(g),false};return c(a)}function Vo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[c,g]=react.useState(false),[i,p]=react.useState(""),[l,f]=react.useState(t.length>0),[y,k]=react.useState({top:0,left:0}),[C,h]=react.useState(null),b=react.useRef(null),u=react.useRef(null),x=()=>{if(!u.current)return;let v=u.current.getBoundingClientRect(),I=window.innerHeight,F=window.innerWidth,T=300,z=l?380:120,$=4,K=v.right-T;K<10&&(K=v.left),K+T>F-10&&(K=F-T-10);let ae=I-v.bottom,se=v.top,oe;ae>=z+$?oe=v.bottom+$:se>=z+$?oe=v.top-z-$:oe=ae>=se?v.bottom+$:Math.max(10,v.top-z-$),k({top:oe,left:K}),g(true);};react.useEffect(()=>{if(!c||!u.current)return;let v=u.current.getBoundingClientRect(),I=window.innerHeight,F=window.innerWidth,T=300,z=l?380:120,$=4,K=v.right-T;K<10&&(K=v.left),K+T>F-10&&(K=F-T-10);let ae=I-v.bottom,se=v.top,oe;ae>=z+$?oe=v.bottom+$:se>=z+$?oe=v.top-z-$:oe=ae>=se?v.bottom+$:Math.max(10,v.top-z-$),k({top:oe,left:K});},[l,c]),react.useEffect(()=>{let v=I=>{b.current&&!b.current.contains(I.target)&&!u.current?.contains(I.target)&&(g(false),p(""));};if(c)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[c]),react.useEffect(()=>{let v=I=>{I.key==="Escape"&&(g(false),p(""));};if(c)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[c]);let m=v=>{let I=t.includes(v),F=a.find(T=>T.id===v);if(h(null),I){let T=t.filter(z=>z!==v);r(T),T.length===0&&f(false);}else {if(s&&Nn(a,v,e)){let z=`Cannot add "${F?.title||v}" as dependency - would create circular reference`;h(z),n?.(v,F?.title||v),setTimeout(()=>h(null),3e3);return}r([...t,v]),f(true);}},N=()=>{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:u,onClick:()=>c?g(false):x(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke: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})]}),c&&jsxRuntime.jsx(gt,{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:N,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange: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:()=>m(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),g(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Sr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:c=[],allCards:g=[]})=>{let{attributes:i,listeners:p,setNodeRef:l,transform:f,transition:y,isDragging:k}=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=c.filter(m=>e.assignedUserIds?.includes(m.id)),b=e.progress===100,u=(e.attachments||[]).filter(m=>m.type.startsWith("image/")),x={...C,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:l,style:x,className:d("asakaa-card",k&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...p,onClick:m=>{m.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:m=>{m.currentTarget.style.display="none";}})}),u.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:u.length===1&&u[0]?jsxRuntime.jsx("img",{src:u[0].url,alt:u[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:m=>{m.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:u.slice(0,4).map((m,N)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:m.url,alt:m.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:w=>{w.currentTarget.style.display="none";}}),N===3&&u.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",u.length-4]})})]},m.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:m=>m.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(ro,{priority:e.priority,onChange:m=>n?.(e.id,{priority:m})})}),jsxRuntime.jsx("div",{onClick:m=>m.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:(m,N)=>n?.(e.id,{startDate:m,endDate:N})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:m=>m.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(no,{assignedUsers:h,availableUsers:c,onChange:m=>n?.(e.id,{assignedUserIds:m.map(N=>N.id)})})}),jsxRuntime.jsx("div",{onClick:m=>m.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Vo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(m=>typeof m=="string"?m:m.taskId):[],availableTasks:g,onChange:m=>n?.(e.id,{dependencies:m})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(m=>jsxRuntime.jsx("span",{className:"asakaa-label",children:m},m))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));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,c]=react.useState({top:0,left:0}),g=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(u=>u.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,u=window.innerWidth,x=180,m=280,N=4,w=h.right-x;w<10&&(w=h.left),w+x>u-10&&(w=u-x-10);let R=b-h.bottom,v=h.top,I;R>=m+N?I=h.bottom+N:v>=m+N?I=h.top-m-N:I=R>=v?h.bottom+N:Math.max(10,h.top-m-N),c({top:I,left:w}),s(true);};react.useEffect(()=>{let h=b=>{g.current&&!g.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);},k=l(),C=k.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:k.label,children:jsxRuntime.jsx(Bd,{icon:k.icon,color:C})}),o&&jsxRuntime.jsx(gt,{children:jsxRuntime.jsxs("div",{ref:g,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children: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),[c,g]=react.useState(false),[i,p]=react.useState(e),[l,f]=react.useState({top:0,left:0}),y=react.useRef(null),k=react.useRef(null),C=react.useRef(null);react.useEffect(()=>{if(s&&k.current){let x=k.current.getBoundingClientRect();f({top:x.bottom+window.scrollY+8,left:x.left+window.scrollX});}},[s]),react.useEffect(()=>{let x=m=>{y.current&&!y.current.contains(m.target)&&!k.current?.contains(m.target)&&(n(false),g(false));};if(s)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[s]),react.useEffect(()=>{let x=m=>{m.key==="Escape"&&(n(false),g(false),p(e));};if(s)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[s,e]),react.useEffect(()=>{c&&C.current&&(C.current.focus(),C.current.select());},[c]);let h=()=>{g(true),p(e);},b=()=>{let x=i.trim();x&&x!==e&&t(x),g(false),n(false),p(e);},u=x=>{x.key==="Enter"?b():x.key==="Escape"&&(g(false),p(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:k,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsxRuntime.jsx(gt,{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:c?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:C,type:"text",value:i,onChange:x=>p(x.target.value),onKeyDown:u,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:c,availableUsers:g,allCards:i,enableVirtualization:p,cardHeight:l=120,isCollapsed:f,onToggleCollapse:y,onColumnRename:k,onColumnDelete:C,isDeletable:h=false,className:b})=>{let{setNodeRef:u,isOver:x}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),m=react.useRef(null),N=p??dd(t.length),w=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>m.current,estimateSize:()=>l,enabled:N});if(a)return jsxRuntime.jsx("div",{ref:u,className:b,children:a(e,t)});let v=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let T=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:T}:T>=80?{state:"warning",percentage:T}:T>=60?{state:"approaching",percentage:T}:{state:"ok",percentage:T}})(),I=v.state==="exceeded",F=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:u,className:d("asakaa-column",x&&"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"})]})]}),(k||C)&&jsxRuntime.jsx(Od,{columnTitle:e.title,onRename:T=>k?.(e.id,T),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:m,className:"asakaa-column-cards",style:{maxHeight:N?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(T=>T.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):N?jsxRuntime.jsx("div",{style:{height:`${w.getTotalSize()}px`,position:"relative"},children:w.getVirtualItems().map(T=>{let z=t[T.index];return z?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${T.start}px)`},children:jsxRuntime.jsx(Sr,{card:z,render:r,onClick:n,onUpdate:c,availableUsers:g,allCards:i})},z.id):null})}):t.map(T=>jsxRuntime.jsx(Sr,{card:T,render:r,onClick:n,onUpdate:c,availableUsers:g,allCards:i},T.id))})})]})});No.displayName="Column";function Vs({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let g=()=>{let p=s.trim();p&&p!==e?t(p):n(e),o(false);},i=p=>{p.key==="Enter"?g():p.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:c,type:"text",value:s,onChange:p=>n(p.target.value),onBlur:g,onKeyDown:i,className:d("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:d("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function hg(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(c=>c.name.toLowerCase().replace(/\s+/g,"")===s||c.name.toLowerCase()===s);n&&!a.includes(n.id)&&a.push(n.id);}return a}function yg(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:c="dark",locale:g="es",currentUser:i}){let p=c==="dark",[l,f]=react.useState(false),[y,k]=react.useState([]),[C,h]=react.useState(0),[b,u]=react.useState(null),x=react.useRef(null),m=react.useRef(null),N=react.useCallback((F,T)=>{let z=hg(F,T);if(u(z),z){let $=r.filter(K=>K.name.toLowerCase().includes(z.query)||K.email&&K.email.toLowerCase().includes(z.query)).slice(0,5);k($),f($.length>0),h(0);}else f(false),k([]);},[r]),w=F=>{let T=F.target.value;t(T),N(T,F.target.selectionStart||0);},R=()=>{x.current&&N(e,x.current.selectionStart||0);},v=react.useCallback(F=>{if(!b||!x.current)return;let T=e.slice(0,b.start),z=e.slice(b.end),$=`@${F.name.replace(/\s+/g,"")} `,K=T+$+z;t(K),f(false),u(null),setTimeout(()=>{if(x.current){let ae=b.start+$.length;x.current.selectionStart=ae,x.current.selectionEnd=ae,x.current.focus();}},0);},[b,e,t]),I=F=>{if(l&&y.length>0)switch(F.key){case "ArrowDown":F.preventDefault(),h(T=>T<y.length-1?T+1:0);break;case "ArrowUp":F.preventDefault(),h(T=>T>0?T-1:y.length-1);break;case "Enter":{F.preventDefault();let T=y[C];T&&v(T);break}case "Tab":{F.preventDefault();let T=y[C];T&&v(T);break}case "Escape":F.preventDefault(),f(false);break}else F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),a());};return react.useEffect(()=>{let F=T=>{m.current&&!m.current.contains(T.target)&&x.current&&!x.current.contains(T.target)&&f(false);};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]),react.useEffect(()=>{if(l&&m.current){let F=m.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:x,type:"text",value:e,onChange:w,onSelect:R,onKeyDown:I,placeholder:o||(g==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,className:d("flex-1 bg-transparent text-sm outline-none",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:m,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:d("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:y.map((F,T)=>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",T===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:yg(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((c,g)=>c.type==="mention"?jsxRuntime.jsx("span",{className:d("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:c.value},g):jsxRuntime.jsx("span",{children:c.value},g))})}var 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[c,g]=react.useState(false),[i,p]=react.useState(""),[l,f]=react.useState(false),[y,k]=react.useState(An[10]||"#3B82F6"),[C,h]=react.useState({top:0,left:0}),b=react.useRef(null),u=react.useRef(null),x=react.useRef(null),m=react.useRef(null),N=t.filter(T=>T.name.toLowerCase().includes(i.toLowerCase())),w=t.some(T=>T.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(c&&u.current){let T=u.current.getBoundingClientRect();h({top:T.bottom+6,left:T.left});}},[c]),react.useEffect(()=>{let T=z=>{let $=z.target,K=b.current?.contains($),ae=x.current?.contains($);!K&&!ae&&(g(false),p(""),f(false));};if(c)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[c]),react.useEffect(()=>{c&&m.current&&m.current.focus();},[c]);let R=T=>{let z=e.some($=>$.id===T.id);a(z?e.filter($=>$.id!==T.id):[...e,T]);},v=async()=>{if(!(!r||!i.trim())){f(true);try{let T=await r(i.trim(),y);T&&(a([...e,T]),p(""),k(An[Math.floor(Math.random()*An.length)]||"#3B82F6"));}finally{f(false);}}},I=(T,z)=>{z.stopPropagation(),a(e.filter($=>$.id!==T));},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:u,type:"button",onClick:()=>!s&&g(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style: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(T=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${T.color}20`,color:T.color},children:T.name},T.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:x,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:C.top,left:C.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:m,type:"text",value:i,onChange:T=>p(T.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:T=>{T.key==="Enter"&&i.trim()&&!w&&r&&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(T=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${T.color}20`,color:T.color},onClick:z=>I(T.id,z),children:[T.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},T.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(T=>{let z=e.some($=>$.id===T.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>R(T),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:z?`${T.color}15`:"transparent",color:o.textPrimary},onMouseEnter:$=>{z||($.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:$=>{z||($.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:T.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:T.name}),z&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:T.color}})]},T.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!w&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:An.map(T=>jsxRuntime.jsx("button",{type:"button",onClick:()=>k(T),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:T,outline:y===T?`2px solid ${T}`:"none",outlineOffset:"2px"}},T))}),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 Vg(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:c=[],availableTags:g=[],onCreateTag:i,attachments:p=[],onUploadAttachments:l,onDeleteAttachment:f,availableTasks:y=[],comments:k=[],onAddComment:C,currentUser:h,mentionableUsers:b=[]}){let u=s==="dark",x={textTertiary:u?"#6B7280":"#9CA3AF",textSecondary:u?"#9CA3AF":"#6B7280",textPrimary:u?"#FFFFFF":"#111827",borderLight:u?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:u?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:u?"#1A1D25":"#FFFFFF",bgSecondary:u?"#0F1117":"#F9FAFB",hoverBg:u?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},m=e&&"title"in e&&!("name"in e),N=e,[w,R]=react.useState(e?Zd(e,c):null),[v,I]=react.useState(false),[F,T]=react.useState(false),[z,$]=react.useState(false),[K,ae]=react.useState(null),[se,oe]=react.useState(new Date),[xe,he]=react.useState(false),[Re,A]=react.useState(false),[O,L]=react.useState(""),[j,J]=react.useState(false),[de,be]=react.useState(false),[pe,Ie]=react.useState(false),[Q,Xe]=react.useState(""),Ne=react.useRef(null),[Je,dt]=react.useState(""),yt=react.useRef(null),[Qe,xt]=react.useState(""),[Pt,Tt]=react.useState(false);react.useEffect(()=>{if(e){let S=Zd(e,c);R(S),Xe(S.description||""),dt(S.name||"");}},[e?.id,c]),react.useEffect(()=>()=>{Ne.current&&clearTimeout(Ne.current),yt.current&&clearTimeout(yt.current);},[]);let Ye=react.useCallback(S=>{R(S),m&&o&&N?o(Vg(S,N)):r&&r(S);},[m,N,o,r]),B=react.useCallback(()=>{I(false),T(false),$(false),ae(null),A(false),L(""),J(false);},[]),ne=react.useCallback((S,Te)=>{if(!w)return;let X={...w,[S]:Te};Ye(X);},[w,Ye]),Pe=react.useCallback(S=>{Xe(S),Ne.current&&clearTimeout(Ne.current),Ne.current=setTimeout(()=>{if(w){let Te={...w,description:S};Ye(Te);}},800);},[w,Ye]),Ue=react.useCallback(S=>{dt(S),yt.current&&clearTimeout(yt.current),yt.current=setTimeout(()=>{if(w&&S.trim()){let Te={...w,name:S.trim()};Ye(Te);}},800);},[w,Ye]),_=react.useCallback(async()=>{if(!(!w||!Qe.trim()||!C)){Tt(true);try{let S=Gd(Qe,b);await C(w.id,Qe.trim(),S.length>0?S:void 0),xt("");}finally{Tt(false);}}},[w,Qe,C,b]),ue=react.useCallback(S=>{let Te=typeof S=="string"?new Date(S):S,Ce=new Date().getTime()-Te.getTime(),we=Math.floor(Ce/6e4),We=Math.floor(Ce/36e5),Oe=Math.floor(Ce/864e5);return we<1?n==="es"?"Ahora":"Just now":we<60?n==="es"?`Hace ${we} min`:`${we}m ago`:We<24?n==="es"?`Hace ${We}h`:`${We}h ago`:Oe<7?n==="es"?`Hace ${Oe}d`:`${Oe}d ago`:Te.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),ze=react.useCallback(S=>{if(!w)return;let Te=w.progress||0;S==="completed"?Te=100:S==="in-progress"&&Te===0?Te=10:S==="todo"&&(Te=0);let X={...w,status:S,progress:Te};Ye(X),I(false);},[w,Ye]),ce=react.useCallback((S,Te)=>{if(!w)return;let X={...w,startDate:S,endDate:Te};Ye(X);},[w,Ye]),nt=react.useCallback(()=>{let S=se.getFullYear(),Te=se.getMonth(),X=new Date(S,Te,1),we=new Date(S,Te+1,0).getDate(),We=X.getDay(),Oe=[],tt=new Date(S,Te,0).getDate();for(let Y=We-1;Y>=0;Y--)Oe.push({date:new Date(S,Te-1,tt-Y),isCurrentMonth:false});for(let Y=1;Y<=we;Y++)Oe.push({date:new Date(S,Te,Y),isCurrentMonth:true});let G=42-Oe.length;for(let Y=1;Y<=G;Y++)Oe.push({date:new Date(S,Te+1,Y),isCurrentMonth:false});return Oe},[se]),et=react.useCallback(async S=>{if(S.preventDefault(),S.stopPropagation(),be(false),!w||!l)return;let Te=Array.from(S.dataTransfer.files);if(Te.length!==0){Ie(true);try{await l(w.id,Te);}finally{Ie(false);}}},[w,l]),He=react.useCallback(async S=>{if(!w||!l||!S.target.files)return;let Te=Array.from(S.target.files);if(Te.length!==0){Ie(true);try{await l(w.id,Te);}finally{Ie(false);}S.target.value="";}},[w,l]),Mt=react.useCallback(S=>{S.preventDefault(),S.stopPropagation(),be(true);},[]),At=react.useCallback(S=>{S.preventDefault(),S.stopPropagation(),be(false);},[]),Ze=react.useCallback(S=>S<1024?`${S} B`:S<1024*1024?`${(S/1024).toFixed(1)} KB`:`${(S/(1024*1024)).toFixed(1)} MB`,[]),te=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",u?"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",u?"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",u?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:d("text-xs px-2 py-0.5 rounded",u?"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",u?"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",u?"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",u?"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",u?"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",u?"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":u?"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:Je,onChange:S=>Ue(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]":u?"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",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",u?"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":u?"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]",u?"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:()=>ze(S.id),className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",w.status===S.id&&(u?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",S.color)}),jsxRuntime.jsx("span",{className:u?"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",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{B(),$(!z);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"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,Te)=>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()},Te)),w.assignees.length>3&&jsxRuntime.jsxs("span",{className:d("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:["+",w.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:d("text-sm",u?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",u?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:z&&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",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:c.length>0?c.map(S=>{let Te=w.assignees?.some(X=>X.name===S.name);return jsxRuntime.jsxs("button",{onClick:()=>{let X=w.assignees||[],Ce;Te?Ce=X.filter(we=>we.name!==S.name):Ce=[...X,S],ne("assignees",Ce);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",Te&&(u?"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",u?"text-white":"text-gray-900"),children:S.name}),Te&&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",u?"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",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{ae(K?null:"start"),oe(w.startDate||new Date);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"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",u?"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:K&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ae(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",u?"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",u?"border-white/10":"border-gray-200"),children:[(()=>{let S=new Date,Te=new Date(S);Te.setDate(S.getDate()+1);let X=new Date(S);X.setDate(S.getDate()+((6-S.getDay()+7)%7||7));let Ce=new Date(S);Ce.setDate(S.getDate()+((1-S.getDay()+7)%7||7));let we=new Date(S);we.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:Te,display:Te.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:X,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ce,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:we,display:we.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,Y)=>jsxRuntime.jsxs("button",{className:d("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",u?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(K==="start"){let ye=w.endDate&&G.date>w.endDate?G.date:w.endDate;ce(G.date,ye),ae("end");}else {let ye=w.startDate&&G.date<w.startDate?G.date:w.startDate;ce(ye,G.date),ae(null);}},children:[jsxRuntime.jsx("span",{children:G.label}),jsxRuntime.jsx("span",{className:d("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:G.display})]},Y))})(),jsxRuntime.jsx("div",{className:d("border-t mt-2 pt-2",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{ce(void 0,void 0),ae(null);},className:d("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",u?"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",u?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:K==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:d("font-medium",u?"text-white":"text-gray-900"),children:se.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:()=>oe(new Date),className:d("p-1 rounded text-sm transition-colors",u?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>oe(new Date(se.getFullYear(),se.getMonth()-1)),className:d("p-1 rounded",u?"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:()=>oe(new Date(se.getFullYear(),se.getMonth()+1)),className:d("p-1 rounded",u?"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",u?"text-[#6B7280]":"text-gray-400"),children:S},S))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:nt().map((S,Te)=>{let X=S.date.toDateString()===new Date().toDateString(),Ce=w.startDate?.toDateString()===S.date.toDateString(),we=w.endDate?.toDateString()===S.date.toDateString(),We=Ce||we,Oe=w.startDate&&w.endDate&&S.date>=w.startDate&&S.date<=w.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let tt=new Date(S.date);if(K==="start"){let G=w.endDate&&tt>w.endDate?tt:w.endDate;ce(tt,G),ae("end");}else {let G=w.startDate&&tt<w.startDate?tt:w.startDate;ce(G,tt),ae(null);}},className:d("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!S.isCurrentMonth&&(u?"text-[#4B5563]":"text-gray-300"),S.isCurrentMonth&&(u?"text-white":"text-gray-900"),X&&"ring-2 ring-[#3B82F6]",Ce&&"bg-[#3B82F6] text-white",we&&!Ce&&"bg-[#7C3AED] text-white",Oe&&!We&&(u?"bg-[#7C3AED]/20":"bg-purple-100"),!We&&(u?"hover:bg-white/10":"hover:bg-gray-100")),children:S.date.getDate()},Te)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:d("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{B(),T(!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":u?"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:()=>T(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",u?"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:()=>{ne("priority",S.id),T(false);},className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",w.priority===S.id&&(u?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",S.color)}),jsxRuntime.jsx("span",{className:u?"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",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:d("text-sm",u?"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",u?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[xe?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:w.progress||0,onChange:S=>{let Te=parseInt(S.target.value),X=w.status;Te===100?X="completed":Te>0?X="in-progress":X="todo";let Ce={...w,progress:Te,status:X};Ye(Ce);},onBlur:()=>he(false),className:d("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",u?"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:()=>he(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",u?"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]",u?"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",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(hr,{selectedTags:w.tags||[],availableTags:g,onChange:S=>{ne("tags",S);},onCreateTag:i,theme:x})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:d("w-4 h-4 mt-1.5",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24 mt-1",u?"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 Te=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",u?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[Te?.name||S.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let X=(w.dependencies||[]).filter(Ce=>Ce!==S);ne("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(!Re);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"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",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="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:()=>{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]",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:d("p-2 border-b",u?"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",u?"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 Te=w.dependencies?.includes(S.id);return jsxRuntime.jsxs("button",{onClick:()=>{let X=w.dependencies||[],Ce;Te?Ce=X.filter(we=>we!==S.id):Ce=[...X,S.id],ne("dependencies",Ce);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",Te&&(u?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:d("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",Te?"bg-blue-500 border-blue-500":u?"border-white/30":"border-gray-300"),children:Te&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:d("block truncate",u?"text-white":"text-gray-900"),children:S.name}),jsxRuntime.jsx("span",{className:d("text-xs",u?"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",u?"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",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{B(),J(!j);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"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",u?"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",u?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:j&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>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",u?"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 Te=w.color===S.value;return jsxRuntime.jsx("button",{onClick:()=>{ne("color",S.value),J(false);},className:d("w-7 h-7 rounded-full flex items-center justify-center transition-all",Te&&"ring-2 ring-offset-2",u?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:S.value,outlineColor:Te?S.value:void 0},title:S.name,children:Te&&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",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",u?"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=>ne("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":u?"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",u?"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",u?"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",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:d("text-sm font-semibold",u?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:Q,onChange:S=>Pe(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",u?"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",u?"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",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:d("text-sm font-semibold mb-3",u?"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",u?"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",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:d("text-sm font-semibold mb-3",u?"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":u?"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]":u?"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",u?"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",u?"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",u?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:d("p-1 rounded transition-colors",u?"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",u?"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",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:d("text-sm font-semibold mb-3",u?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",p.length>0&&jsxRuntime.jsxs("span",{className:d("ml-2 text-xs font-normal",u?"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 Te=te(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",u?"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",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(Te,{className:d("w-5 h-5",u?"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",u?"text-white":"text-gray-900"),children:S.name}),jsxRuntime.jsx("p",{className:d("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:Ze(S.size)})]}),f&&jsxRuntime.jsx("button",{onClick:()=>f(S.id),className:d("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",u?"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:Mt,onDragLeave:At,onDrop:et,className:d("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",de?u?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":u?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",pe&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:He,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!l||pe}),pe?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",u?"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",de?"text-blue-500":u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:d("text-sm",u?"text-[#9CA3AF]":"text-gray-500"),children:de?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",u?"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",u?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:d("px-4 py-3 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:d("text-sm font-semibold",u?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",k.length>0&&jsxRuntime.jsxs("span",{className:d("ml-2 text-xs font-normal",u?"text-[#6B7280]":"text-gray-400"),children:["(",k.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:k.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:k.map(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",u?"text-white":"text-gray-900"),children:S.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:d("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:ue(S.createdAt)})]}),jsxRuntime.jsx("div",{className:d("text-sm",u?"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",u?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:d("text-sm",u?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:d("p-4 border-t",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(_d,{value:Qe,onChange:xt,onSubmit:_,users:b,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!C,isSubmitting:Pt,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:c,isLoading:g,error:i,children:p,availableTags:l=[],onCreateTag:f,attachmentsByCard:y,onUploadAttachments:k,onDeleteAttachment:C,comments:h,onAddComment:b,currentUser:u,mentionableUsers:x,onTaskOpen:m}){let[N,w]=Zs(),[R,v]=react.useState(null),I=o?.theme||"dark",F=I==="dark"||I==="neutral",T=F?"dark":"",z=react.useCallback((j,J)=>{t.onCardUpdate?.(j,J);},[t]),$=react.useCallback((j,J)=>{t.onColumnUpdate?.(j,{title:J});},[t]),K=react.useCallback(j=>{t.onColumnDelete?.(j);},[t]),ae=["todo","in-progress","completed"],se=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 j=new Map;return e.columns.forEach(J=>{let de=J.cardIds.map(be=>e.cards.find(pe=>pe.id===be)).filter(be=>be!==void 0).sort((be,pe)=>be.position-pe.position);j.set(J.id,de);}),j},[e.cards,e.columns]),xe=react.useMemo(()=>e.cards.map(j=>({id:j.id,name:j.title,startDate:j.startDate?new Date(j.startDate):void 0,endDate:j.endDate?new Date(j.endDate):void 0,progress:j.progress||0,status:j.columnId,priority:j.priority?.toLowerCase(),dependencies:Array.isArray(j.dependencies)?j.dependencies.map(J=>typeof J=="string"?J:J.taskId):[]})),[e.cards]),he=react.useCallback(j=>{let{active:J}=j,de=e.cards.find(be=>be.id===J.id);de&&w({isDragging:true,draggedCardId:de.id,sourceColumnId:de.columnId,targetColumnId:de.columnId});},[e.cards,w]),Re=react.useCallback(j=>{let{active:J,over:de}=j;if(!de||!e.cards.find(Ie=>Ie.id===J.id))return;let pe=null;de.data.current?.type==="column"?pe=de.id:de.data.current?.type==="card"&&(pe=e.cards.find(Q=>Q.id===de.id)?.columnId||null),pe&&pe!==N.targetColumnId&&w({...N,targetColumnId:pe});},[e.cards,N,w]),A=react.useCallback(async j=>{let{active:J,over:de}=j;if(w({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!de)return;let be=e.cards.find(Xe=>Xe.id===J.id);if(!be)return;let pe,Ie;if(de.data.current?.type==="column"){pe=de.id;let Xe=oe.get(pe)||[];Ie=Rs(Xe,0);}else {let Xe=e.cards.find(dt=>dt.id===de.id);if(!Xe)return;pe=Xe.columnId;let Ne=oe.get(pe)||[],Je=Ne.findIndex(dt=>dt.id===de.id);Ie=Rs(Ne,Je);}let Q=e.columns.find(Xe=>Xe.id===pe);if(Q&&Q.wipLimit&&Q.wipLimitType==="hard"){let Xe=oe.get(pe)||[];if(be.columnId!==pe&&Xe.length>=Q.wipLimit){t.onWipLimitExceeded?.(Q,be);return}}(be.columnId!==pe||be.position!==Ie)&&await t.onCardMove?.(be.id,pe,Ie);},[e.cards,e.columns,oe,t,w]),O=react.useCallback(j=>{v(j),a?.(j),m?.(j.id);},[a,m]),L=react.useCallback(j=>{t.onCardUpdate?.(j.id,j),v(j);},[t]);return g?jsxRuntime.jsx("div",{className:d("asakaa-board",T,n),style:c,children:jsxRuntime.jsx(rf,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:d("asakaa-board",T,n),style:c,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(xd,{themeName:I,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:se,collisionDetection:core$1.closestCorners,onDragStart:he,onDragOver:Re,onDragEnd:A,children:[jsxRuntime.jsxs("div",{className:d("asakaa-board",T,n),style:c,"data-theme":I,children:[e.columns.sort((j,J)=>j.position-J.position).map(j=>{let J=oe.get(j.id)||[],de=!ae.includes(j.id);return jsxRuntime.jsx(No,{column:j,cards:J,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:O,onCardUpdate:z,onColumnRename:$,onColumnDelete:K,isDeletable:de,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},j.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:N.draggedCardId?jsxRuntime.jsx(Sr,{card:e.cards.find(j=>j.id===N.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(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:k,onDeleteAttachment:C,availableTasks:xe,comments:h,onAddComment:b,currentUser:u,mentionableUsers:x})]})}function rf({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 df={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)"},cf={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)"},mf={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},pf={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function uf({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let i=p=>{c.current&&!c.current.contains(p.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let g=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,p)=>i.position-p.position).map((i,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>g(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom: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 gf({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[c,g]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let y=k=>{i.current&&!i.current.contains(k.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,k)=>{if(k){g(y);try{await k();}catch(C){console.error(`Export ${y} failed:`,C);}finally{g(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:l.map((y,k)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(y.id,y.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:k<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:c===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 ff({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:c,onExportExcel:g,translations:i}){let p=r==="dark"?df:cf,l={...o==="es"?mf:pf,...i},f=n||c||g;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(gf,{theme:p,t:l,onExportCSV:n,onExportJSON:c,onExportExcel:g}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),t&&(s?jsxRuntime.jsx(uf,{columns:e,onSelect:t,theme:p,t:l,createTaskLabel:a}):jsxRuntime.jsx(ff,{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),[c,g]=react.useState(""),i=react.useCallback(()=>{let f=c.trim();f&&(e(f),g(""),n(false));},[c,e]),p=react.useCallback(f=>{f.key==="Enter"?(f.preventDefault(),i()):f.key==="Escape"&&(g(""),n(false));},[i]),l=react.useCallback(()=>{setTimeout(()=>{c.trim()||n(false);},150);},[c]);return s?jsxRuntime.jsx("div",{className:d("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:c,onChange:f=>g(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:!c.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{g(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:d("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function ri({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:c="dark",locale:g="es"}){let[i,p]=react.useState(false),[l,f]=react.useState(false),[y,k]=react.useState(""),[C,h]=react.useState([]),[b,u]=react.useState(""),[x,m]=react.useState(""),[N,w]=react.useState(""),[R,v]=react.useState(false),[I,F]=react.useState(false),[T,z]=react.useState(false),$=react.useRef(null),K=react.useRef(null),ae={placeholder:o||(g==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(g==="es"?"Agregar Tarea":"Add Task"),save:g==="es"?"Guardar":"Save",addAssignee:g==="es"?"Agregar asignado":"Add assignee",addDates:g==="es"?"Agregar fechas":"Add dates",addPriority:g==="es"?"Agregar prioridad":"Add priority",startDate:g==="es"?"Inicio":"Start",endDate:g==="es"?"Fin":"End",low:g==="es"?"Baja":"Low",medium:g==="es"?"Media":"Medium",high:g==="es"?"Alta":"High",urgent:g==="es"?"Urgente":"Urgent"},se=react.useCallback(()=>{k(""),h([]),u(""),m(""),w(""),v(false),F(false),z(false),p(false);},[]);react.useEffect(()=>{i&&$.current&&$.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let A=O=>{K.current&&!K.current.contains(O.target)&&(y.trim()||se());};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[i,y,se]);let oe=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:x?new Date(x):void 0,priority:N||void 0}),k(""),h([]),u(""),m(""),w(""),v(!1),F(!1),z(!1),$.current?.focus();}catch(O){console.error("Error creating card:",O);}finally{f(false);}}},[y,e,C,b,x,N,t,l]),xe=react.useCallback(A=>{A.key==="Enter"&&!A.shiftKey?(A.preventDefault(),oe()):A.key==="Escape"&&se();},[oe,se]),he=react.useCallback(A=>{h(O=>O.includes(A)?O.filter(L=>L!==A):[...O,A]);},[]),Re=c==="dark";return i?jsxRuntime.jsxs("div",{ref:K,className:d("rounded-lg overflow-hidden shadow-lg",Re?"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=>k(A.target.value),onKeyDown:xe,placeholder:ae.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",Re?"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":Re?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ae.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||x?"bg-blue-500/20 text-blue-400":Re?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ae.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>z(!T),className:d("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||N?N==="urgent"?"bg-red-500/20 text-red-400":N==="high"?"bg-orange-500/20 text-orange-400":N==="medium"?"bg-yellow-500/20 text-yellow-400":N==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Re?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ae.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()||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"}):ae.save})]})]}),R&&a.length>0&&jsxRuntime.jsx("div",{className:d("px-3 pb-3 pt-0","border-t",Re?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(A=>jsxRuntime.jsxs("button",{onClick:()=>he(A.id),className: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":Re?"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",Re?"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",Re?"text-gray-500":"text-gray-400"),children:ae.startDate}),jsxRuntime.jsx("input",{type:"date",value:b,onChange:A=>u(A.target.value),className:d("w-full px-2 py-1.5 rounded text-xs border",Re?"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",Re?"text-gray-500":"text-gray-400"),children:ae.endDate}),jsxRuntime.jsx("input",{type:"date",value:x,onChange:A=>m(A.target.value),className:d("w-full px-2 py-1.5 rounded text-xs border",Re?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),T&&jsxRuntime.jsx("div",{className:d("px-3 pb-3 pt-0","border-t",Re?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(A=>jsxRuntime.jsx("button",{onClick:()=>w(N===A?"":A),className:d("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",N===A?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[A]} text-white`:Re?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:ae[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",Re?"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:ae.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:c,onOpenAIUsage:g,shortcut:i="k",className:p=""}){let[l,f]=react.useState(false),[y,k]=react.useState(""),[C,h]=react.useState("home"),[b,u]=react.useState(""),[x,m]=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"),k(""));};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[i]),react.useEffect(()=>{l||(h("home"),k(""),u(""),m(""));},[l]);let N=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":u(F||"");break;case "navigate":F?(a?.(F),N()):h("navigate");break;case "search":r?.(y),N();break;case "priority":h("priority");break;case "set-priority":x&&F&&(o?.(x,F),N());break;case "assign":h("assign");break;case "assign-user":x&&F&&(s?.(x,F),N());break;case "ai":h("ai");break;case "ai-generate-plan":n?.(),N();break;case "ai-predict-risks":c?.(),N();break;case "ai-usage":g?.(),N();break;case "back":h("home");break;}},[y,x,t,a,r,o,s,n,c,g,N]),R=react.useCallback(()=>{b&&y.trim()&&(t?.(b,y.trim()),N());},[b,y,t,N]);return l?jsxRuntime.jsx(gt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:N,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:v=>v.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:y,onValueChange:k,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:C==="create-card"&&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'),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=`
6
6
  position: fixed !important;
7
7
  inset: 0 !important;
8
8
  z-index: 2147483647 !important;
@@ -11,12 +11,12 @@
11
11
  justify-content: center !important;
12
12
  background: rgba(0, 0, 0, 0.95) !important;
13
13
  cursor: pointer !important;
14
- `;let c=document.createElement("img");c.src=e,c.alt=t,c.className="attachment-lightbox-image",c.style.cssText=`
14
+ `;let m=document.createElement("img");m.src=e,m.alt=t,m.className="attachment-lightbox-image",m.style.cssText=`
15
15
  max-width: 92vw !important;
16
16
  max-height: 92vh !important;
17
17
  object-fit: contain !important;
18
18
  cursor: default !important;
19
- `,c.onclick=l=>l.stopPropagation();let g=document.createElement("div");g.className="attachment-lightbox-hint",g.textContent="Click anywhere or press ESC to close",g.style.cssText=`
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=`
20
20
  position: absolute !important;
21
21
  bottom: 24px !important;
22
22
  left: 50% !important;
@@ -34,7 +34,7 @@
34
34
  padding: 8px 12px !important;
35
35
  background: rgba(0, 0, 0, 0.4) !important;
36
36
  border-radius: 20px !important;
37
- `,l.onclick=k=>k.stopPropagation(),a.forEach((k,C)=>{let h=document.createElement("button");h.className=`attachment-lightbox-dot ${C===r?"active":""}`,h.style.cssText=`
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=`
38
38
  width: 8px !important;
39
39
  height: 8px !important;
40
40
  border-radius: 50% !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=k=>{k.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
+ `,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=`
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=k=>{k.stopPropagation();let C=r<a.length-1?r+1:0;i(),o(C);},n.appendChild(l),n.appendChild(f),n.appendChild(y);}n.appendChild(c),n.appendChild(g),document.body.appendChild(n),setTimeout(()=>{g.style.transition="opacity 0.5s ease",g.style.opacity="0";},2e3);}function kf(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 wf(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,c]=react.useState(false),[g,i]=react.useState(false),[p,l]=react.useState(null),f=react.useRef(null),y=react.useRef(e);y.current=e;let k=react.useCallback((v,I)=>{I.preventDefault(),I.stopPropagation();let F=y.current.filter($=>li($.type)),T=F.findIndex($=>$.id===v.id),z=$=>{let K=y.current.filter(se=>li(se.type)),ae=K[$];ae&&uc(ae.url,ae.name,K,$,z);};uc(v.url,v.name,F,T,z);},[]),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(T=>{if(T.size/1048576>r){F.push(`${T.name} is too large (max ${r}MB)`);return}if(o&&!o.some($=>T.type.match($))){F.push(`${T.name} has invalid file type`);return}I.push(T);}),{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(T){l(T instanceof Error?T.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[C,t]),b=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(true);},[]),u=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(false);},[]),x=react.useCallback(v=>{v.preventDefault(),v.stopPropagation();},[]),m=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(false);let I=Array.from(v.dataTransfer.files);h(I);},[h]),N=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":""} ${g?"uploading":""}`,onDragEnter:b,onDragLeave:u,onDragOver:x,onDrop:m,onClick:w,children:[jsxRuntime.jsx("input",{ref:f,type:"file",multiple:true,onChange:N,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:g?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),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=>k(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:wf(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:kf(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:c=[],aiInsights:g=[],attachments:i=[],onAddComment:p,onDeleteComment:l,onUploadAttachments:f,onDeleteAttachment:y,onSuggestAssignee:k,onGenerateSubtasks:C,onEstimateEffort:h,currentUserId:b="user-1"}){let[u,x]=react.useState("details"),[m,N]=react.useState(false),[w,R]=react.useState({}),[v,I]=react.useState(""),[F,T]=react.useState(false),[z,$]=react.useState({});if(!t||!e)return null;let K=react.useCallback(()=>{N(false),R({}),x("details"),I(""),$({}),a();},[a]),ae=react.useCallback(()=>{r&&Object.keys(w).length>0&&(r(e.id,w),R({}),N(false));},[e.id,w,r]),se=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),K());},[e.id,o,K]),oe=react.useCallback(()=>{p&&v.trim()&&(p(e.id,v.trim()),I(""));},[e.id,v,p]),xe=react.useCallback(async()=>{if(k){T(true);try{let L=await k(e);$(j=>({...j,assignees:L}));}catch(L){console.error("Failed to suggest assignee:",L);}finally{T(false);}}},[e,k]),he=react.useCallback(async()=>{if(C){T(true);try{let L=await C(e);$(j=>({...j,subtasks:L}));}catch(L){console.error("Failed to generate subtasks:",L);}finally{T(false);}}},[e,C]),Re=react.useCallback(async()=>{if(h){T(true);try{let L=await h(e);$(j=>({...j,effort:L}));}catch(L){console.error("Failed to estimate effort:",L);}finally{T(false);}}},[e,h]),A={...e,...w},O=s.filter(L=>A.assignedUserIds?.includes(L.id));return jsxRuntime.jsx(gt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:K,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:L=>L.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:A.priority==="URGENT"?"#EF4444":A.priority==="HIGH"?"#F59E0B":A.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),m?jsxRuntime.jsx("input",{type:"text",value:w.title??A.title,onChange:L=>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:[m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:ae,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{N(false),R({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>N(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:se,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:K,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>x("details"),className:`card-detail-tab ${u==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>x("comments"),className:`card-detail-tab ${u==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>x("activity"),className:`card-detail-tab ${u==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>x("attachments"),className:`card-detail-tab ${u==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>x("ai"),className:`card-detail-tab ${u==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[u==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),m?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"}),m?jsxRuntime.jsx("select",{multiple:true,value:w.assignedUserIds??A.assignedUserIds??[],onChange:L=>{let j=Array.from(L.target.selectedOptions,J=>J.value);R({...w,assignedUserIds:j});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(L=>jsxRuntime.jsx("option",{value:L.id,children:L.name},L.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children: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"}),m?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"}),m?jsxRuntime.jsx("input",{type:"date",value:w.startDate?new Date(w.startDate).toISOString().split("T")[0]:A.startDate?new Date(A.startDate).toISOString().split("T")[0]:"",onChange:L=>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"}),m?jsxRuntime.jsx("input",{type:"date",value:w.endDate?new Date(w.endDate).toISOString().split("T")[0]:A.endDate?new Date(A.endDate).toISOString().split("T")[0]:"",onChange:L=>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"}),m?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 j=typeof L=="string"?L:L.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",j.slice(-4)]},j)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:A.createdAt?new Date(A.createdAt).toLocaleString():"Unknown"})]})]}),u==="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: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(L=>{let j=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:[j&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:j.color},children:j.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:j?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(L.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(L.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:L.content})]},L.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),u==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(L=>{let j=s.find(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:j?.name||"Unknown"})," ",L.type.replace(/_/g," ").toLowerCase(),L.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:L.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(L.timestamp).toLocaleString()})]})]},L.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),u==="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})}),u==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:xe,disabled:F||!k,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:he,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:Re,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"]})]}),z.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),z.assignees.map((L,j)=>{let J=s.find(de=>de.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),"%"]})]})]},j)})]}),z.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),z.subtasks.map((L,j)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:L.title}),L.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:L.description}),L.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",L.estimatedTime,"h"]})]},j))]}),z.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[z.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(z.effort.confidence*100).toFixed(0),"%"]})]})]}),g.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),g.map(L=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${L.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:L.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:L.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:L.description}),L.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",L.suggestedAction]})]},L.id))]}),!z.assignees&&!z.subtasks&&!z.effort&&g.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Zo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[c,g]=react.useState({top:0,left:0}),i=react.useRef(null),p=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),f=window.innerHeight,y=window.innerWidth,k=4,C=l.left;C+o>y-10&&(C=y-o-10),C<10&&(C=10);let h=f-l.bottom,b=l.top,u;return h>=s+k?u=l.bottom+k:b>=s+k?u=l.top-s-k:h>=b?u=l.bottom+k:u=Math.max(10,l.top-s-k),{top:u,left:C}},[e,o,s]);return react.useEffect(()=>{t&&g(p());},[t,p]),react.useEffect(()=>{if(!t)return;let l=y=>{let k=y.target;i.current&&!i.current.contains(k)&&e.current&&!e.current.contains(k)&&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(gt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var at={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 Mf=["LOW","MEDIUM","HIGH","URGENT"],Af=["todo","in-progress","review","done"];function pi({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:c=[],onAddComment:g,onDeleteComment:i,currentUser:p,onAIGenerateDescription:l,onAICreateSubtasks:f,onAIFindSimilar:y,availableColumns:k=[],availableLabels:C=[],availableTags:h=[],onCreateTag:b,onUploadCoverImage:u,unsplashAccessKey:x,theme:m,onSubtasksChange:N,attachments:w=[],onUploadAttachments:R,onDeleteAttachment:v}){let I=wo(),F=m||I?.themeName||"dark",[T,z]=react.useState(e),[$,K]=react.useState(false),[ae,se]=react.useState(e?.subtasks||[]),[oe,xe]=react.useState(false),[he,Re]=react.useState(""),[A,O]=react.useState(""),[L,j]=react.useState("all"),[J,de]=react.useState(false),[be,pe]=react.useState(false),[Ie,Q]=react.useState(false),[Xe,Ne]=react.useState(false),[Je,dt]=react.useState(false),[yt,Qe]=react.useState(false),xt=react.useRef(null),Pt=react.useRef(null),Tt=react.useRef(null),Ye=react.useRef(null),B=react.useRef(null),ne=react.useRef(null),Pe=react.useRef(null),Ue=react.useRef(null),_=react.useRef(null),ue=react.useRef(null),ze=react.useRef(null),ce=react.useRef(null);react.useEffect(()=>{e&&!T?(z({...e}),se(e.subtasks||[])):e&&T&&e.id!==T.id&&(z({...e}),se(e.subtasks||[]));},[e,T]),react.useEffect(()=>{let U=le=>{let Ge=le.target;Ye.current&&!Ye.current.contains(Ge)&&de(false),B.current&&!B.current.contains(Ge)&&pe(false),ne.current&&!ne.current.contains(Ge)&&Q(false),Pe.current&&!Pe.current.contains(Ge)&&Ne(false);};if(J||be||Ie||Xe)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[J,be,Ie,Xe]),react.useEffect(()=>{if(!t)return;let U=le=>{let Ge=le.target,Nt=Ge.tagName==="INPUT"||Ge.tagName==="TEXTAREA"||Ge.isContentEditable;if(le.key==="Escape"){le.preventDefault(),J||be||Ie||Xe||Je||yt?(de(false),pe(false),Q(false),Ne(false),dt(false),Qe(false)):Nt||a();return}if(Nt&&le.key!=="Escape")return;let ct=le.metaKey||le.ctrlKey;switch(le.key.toLowerCase()){case "s":le.preventDefault(),de(true);break;case "a":le.preventDefault(),Q(true);break;case "p":le.preventDefault(),pe(true);break;case "l":le.preventDefault(),Ne(true);break;case "d":ct||(le.preventDefault(),dt(true),setTimeout(()=>Ue.current?.focus(),0));break;case "e":ct||(le.preventDefault(),Qe(true));break;case "i":le.preventDefault(),K(true),setTimeout(()=>Pt.current?.focus(),0);break;case "t":le.preventDefault(),xe(true);break;case "c":le.preventDefault(),Tt.current?.focus();break}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[t,a,J,be,Ie,Xe,Je,yt]);let nt=react.useCallback(U=>{let le=U.currentTarget.textContent?.trim()||"";if(T&&le!==T.title){let Ge={...T,title:le};z(Ge),r?.(T.id,{title:le});}},[T,r]),et=react.useCallback(U=>{U.key==="Enter"&&(U.preventDefault(),U.currentTarget.blur()),U.key==="Escape"&&(U.preventDefault(),U.currentTarget.textContent=T?.title||"",U.currentTarget.blur());},[T]),He=react.useCallback(()=>{T&&e&&T.description!==e.description&&r?.(T.id,{description:T.description}),K(false);},[T,e,r]),Mt=react.useCallback(U=>{if(T){let le={...T,columnId:U};z(le),r?.(T.id,{columnId:U}),de(false);}},[T,r]),At=react.useCallback(U=>{if(T){let le={...T,priority:U};z(le),r?.(T.id,{priority:U}),pe(false);}},[T,r]),Ze=react.useCallback(U=>{if(T){let le=T.assignedUserIds||[],Ge=le.includes(U)?le.filter(ct=>ct!==U):[...le,U],Nt={...T,assignedUserIds:Ge};z(Nt),r?.(T.id,{assignedUserIds:Ge});}},[T,r]),te=react.useCallback(U=>{if(T){let le=T.labels||[],Ge=le.includes(U)?le.filter(ct=>ct!==U):[...le,U],Nt={...T,labels:Ge};z(Nt),r?.(T.id,{labels:Ge});}},[T,r]),S=react.useCallback(U=>{if(T){let le={...T,tags:U};z(le),r?.(T.id,{tags:U});}},[T,r]),Te=react.useCallback(U=>{if(T){let le=U.target.value,Ge={...T,endDate:le};z(Ge),r?.(T.id,{endDate:le}),dt(false);}},[T,r]),X=react.useCallback(U=>{if(T){let le={...T,estimatedTime:parseFloat(U)||0};z(le),r?.(T.id,{estimatedTime:parseFloat(U)||0});}},[T,r]),Ce=react.useCallback(()=>{if(he.trim()&&T){let U={id:`subtask-${Date.now()}`,title:he.trim(),completed:false,createdAt:new Date},le=[...ae,U];se(le),Re(""),xe(false),N?.(T.id,le);}},[he,ae,T,N]),we=react.useCallback(U=>{let le=ae.map(Ge=>Ge.id===U?{...Ge,completed:!Ge.completed,updatedAt:new Date}:Ge);se(le),T&&N?.(T.id,le);},[ae,T,N]),We=react.useCallback(U=>{let le=ae.filter(Ge=>Ge.id!==U);se(le),T&&N?.(T.id,le);},[ae,T,N]),Oe=react.useCallback(()=>{A.trim()&&T&&g&&(g(T.id,A.trim()),O(""));},[A,T,g]),tt=react.useCallback(U=>{(U.metaKey||U.ctrlKey)&&U.key==="Enter"&&(U.preventDefault(),Oe());},[Oe]),G=U=>jsxRuntime.jsx(Sf__default.default,{remarkPlugins:[Ef__default.default],rehypePlugins:[Pf__default.default],components:{a:({node:le,...Ge})=>jsxRuntime.jsx("a",{...Ge,target:"_blank",rel:"noopener noreferrer"})},children:U}),Y=c.filter(U=>L==="comments"?U.type.includes("COMMENT"):L==="history"?!U.type.includes("COMMENT"):true);if(!t||!e)return null;let ye=T||e,Ke=s.filter(U=>ye.assignedUserIds?.includes(U.id)),Be=ae.filter(U=>U.completed).length;return jsxRuntime.jsx(gt,{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":F,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:xt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:nt,onKeyDown:et,children:ye.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:_,className:"modal-v2-field",onClick:()=>de(!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:ye.columnId||"No status"})]}),jsxRuntime.jsx(Zo,{triggerRef:_,isOpen:J,onClose:()=>de(false),width:250,estimatedHeight:200,children:(k.length>0?k:Af.map(U=>({id:U,title:U}))).map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${ye.columnId===U.id?"active":""}`,onClick:()=>Mt(U.id),children:U.title},U.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ne,children:[jsxRuntime.jsxs("button",{ref:ue,className:"modal-v2-field",onClick:()=>Q(!Ie),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Ke.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Ke.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(Zo,{triggerRef:ue,isOpen:Ie,onClose:()=>Q(false),width:280,estimatedHeight:300,children:s.map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ye.assignedUserIds?.includes(U.id)?"active":""}`,onClick:()=>Ze(U.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:U.color},children:U.initials}),U.name,ye.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:B,children:[jsxRuntime.jsxs("button",{ref:ze,className:"modal-v2-field",onClick:()=>pe(!be),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:ye.priority||"None"})]}),jsxRuntime.jsxs(Zo,{triggerRef:ze,isOpen:be,onClose:()=>pe(false),width:180,estimatedHeight:220,children:[Mf.map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${U.toLowerCase()} ${ye.priority===U?"active":""}`,onClick:()=>At(U),children:U},U)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>At(""),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:ye.tags||[],availableTags:h,onChange:S,onCreateTag:b,theme:at[F]||at.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Pe,children:[jsxRuntime.jsxs("button",{ref:ce,className:"modal-v2-field",onClick:()=>Ne(!Xe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"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:ye.labels&&ye.labels.length>0?jsxRuntime.jsx("span",{children:ye.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Zo,{triggerRef:ce,isOpen:Xe,onClose:()=>Ne(false),width:220,estimatedHeight:200,children:(C.length>0?C:["Bug","Feature","Enhancement","Documentation"]).map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ye.labels?.includes(U)?"active":""}`,onClick:()=>te(U),children:[U,ye.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:()=>{dt(!Je),setTimeout(()=>Ue.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:ye.endDate?new Date(ye.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Ue,type:"date",value:typeof ye.endDate=="string"?ye.endDate.split("T")[0]:ye.endDate?(()=>{let U=new Date(ye.endDate),le=U.getUTCFullYear(),Ge=String(U.getUTCMonth()+1).padStart(2,"0"),Nt=String(U.getUTCDate()).padStart(2,"0");return `${le}-${Ge}-${Nt}`})():"",onChange:Te,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Qe(!yt),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:ye.estimatedTime?`${ye.estimatedTime}h`:"Not set"})]}),yt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ye.estimatedTime||"",onChange:U=>X(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"})]}),$?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:ye.description||"",onChange:U=>{if(T){let le={...T,description:U.target.value};z(le);}},onBlur:He,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>K(true),children:ye.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:G(ye.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"}),ae.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Be,"/",ae.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>xe(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:[ae.map(U=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${U.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>we(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:()=>We(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:he,onChange:U=>Re(U.target.value),onKeyDown:U=>{U.key==="Enter"&&Ce(),U.key==="Escape"&&(xe(false),Re(""));},onBlur:Ce,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:ye.id,attachments:w,onUpload:R?U=>R(ye.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 ${L==="all"?"active":""}`,onClick:()=>j("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${L==="comments"?"active":""}`,onClick:()=>j("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${L==="history"?"active":""}`,onClick:()=>j("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[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:Tt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:A,onChange:U=>O(U.target.value),onKeyDown:tt,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:[Y.map(U=>{let le=s.find(Nt=>Nt.id===U.userId);if(U.type.includes("COMMENT")){let Nt=n.find(ct=>ct.id===U.metadata?.commentId);return Nt?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[le&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:le.color},children:le.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:le?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Nt.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:le?.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)}),Y.length===0&&jsxRuntime.jsxs("div",{className:"modal-v2-empty",children:[jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function zf({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.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((c,g)=>c+g.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(zf,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,c)=>n+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,c)=>n+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,c)=>n+(c.planned||0),0)})]})]})]})}function qf({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,c=e[e.length-1]?.ideal||0,g=s>0?(s-n)/s*100:0,i=n<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(qf,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:g>=50?"#10B981":"#F59E0B"},children:[g.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var o0={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},wc=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function n0({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,c=e+n*Math.cos(-a*(Math.PI/180)),g=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:g,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function 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((g,i)=>g+i.value,0),n=e.map(g=>({...g,totalValue:s,color:g.color||o0[g.name]||wc[e.indexOf(g)%wc.length]})),c=n.map(g=>g.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?n0:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((g,i)=>jsxRuntime.jsx(recharts.Cell,{fill:c[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Cc,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(g,i)=>{let p=i.payload,l=s>0?(p.value/s*100).toFixed(0):"0";return `${g} (${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((g,i)=>jsxRuntime.jsx(recharts.Cell,{fill:c[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((g,i)=>i.value>g.value?i:g).name})]})]})]})}var On=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,c]=react.useState(false),[g,i]=react.useState(false),[p,l]=react.useState(false),[f,y]=react.useState(false);if(e.length===0)return null;let k=e.map(m=>m.id),C=m=>{r.onBulkUpdate?.(k,{priority:m}),c(false);},h=m=>{r.onBulkMove?.(k,m),i(false),a();},b=m=>{r.onBulkUpdate?.(k,{assignedUserIds:m}),l(false);},u=m=>{let N=new Set;e.forEach(R=>{R.labels?.forEach(v=>N.add(v));});let w=Array.from(new Set([...N,...m]));r.onBulkUpdate?.(k,{labels:w}),y(false);},x=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(k),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(m=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>C(m),children:[jsxRuntime.jsx("span",{className:d("asakaa-priority-dot",m==="LOW"&&"bg-asakaa-priority-low",m==="MEDIUM"&&"bg-asakaa-priority-medium",m==="HIGH"&&"bg-asakaa-priority-high",m==="URGENT"&&"bg-asakaa-priority-urgent")}),m]},m))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!g),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),g&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(m=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(m.id),children:m.title},m.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(m=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([m.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:m.color},children:m.initials}),m.name]},m.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>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(m=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>u([m]),children:m},m))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:x,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});On.displayName="BulkOperationsToolbar";function c0(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,c,g,i;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(y=>{let k=a?.find(C=>C.id===y);n=`assignee-${y}`,c=k?.name||`User ${y}`,g=k?.color,i=k?.avatar,r.has(n)||r.set(n,{id:n,title:c,groupValue:y,cardIds:[],color:g,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",c="Unassigned",g="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:c,groupValue:null,cardIds:[],color:g,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let 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];c=f.title,g=f.color,r.has(n)||r.set(n,{id:n,title:c,groupValue:s,cardIds:[],color:g}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(y=>{n=`label-${y}`,c=y,g="#6b7280",r.has(n)||r.set(n,{id:n,title:c,groupValue:y,cardIds:[],color:g}),r.get(n).cardIds.push(o.id);}):(n="label-none",c="No Labels",g="#6b7280",r.has(n)||r.set(n,{id:n,title:c,groupValue:null,cardIds:[],color:g}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function hi({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),c=react.useMemo(()=>c0(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),g=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"||c.length===0?jsxRuntime.jsx(Hr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:d("asakaa-swimlane-view",o),children:[c.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&&g(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":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)}),c.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var 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),c=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 g=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:d("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:d("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:yi.map(i=>jsxRuntime.jsxs("button",{onClick:()=>g(i.value),className:d("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var 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 u0(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,g=o.meta?e.metaKey:true;return s&&n&&c&&g}function 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(g=>{o.current=[...o.current,g];},[]),c=react.useCallback(g=>{o.current=o.current.filter(i=>i.action!==g);},[]);return react.useEffect(()=>{function g(i){if(!s.current)return;let 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(u0(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",g),()=>window.removeEventListener("keydown",g)},[r]),{registerShortcut:n,unregisterShortcut:c,isEnabled:a}}function f0(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function b0(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 h0(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=b0(e),r=t?f0(t):"";return a?`${a} + ${r}`:r}function y0(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 c(g){g.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let n=y0(e);return jsxRuntime.jsxs("div",{className:d("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([c,g])=>g.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:g.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:h0(i)})]},i.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var 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=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:**
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 c=i=>{t(i),o(false);},g=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(g).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:()=>c(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter: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,c]=react.useState("export"),[g,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,g,C);gd(h,g);},k=async C=>{let h=C.target.files?.[0];if(h){try{let b=await hd(h),u=h.name.endsWith(".json")?"json":"csv",x=bd(b,u);l(x),x.success&&r&&r(x,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:()=>c("export"),className:d("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:d("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(C=>jsxRuntime.jsxs("button",{onClick:()=>i(C),className:d("p-4 rounded-lg border-2 transition-all text-center",g===C?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[C==="json"&&"\u{1F4C4}",C==="csv"&&"\u{1F4CA}",C==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:C})]},C))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick: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:k,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 C0=["URGENT","HIGH","MEDIUM","LOW"],T0=[{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"}],N0=[{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:c,availableUsers:g=[],availableLabels:i=[],availableColumns:p=[],showQuickFilters:l=true,compact:f=false,groupBy:y="none",onGroupByChange:k}){let[C,h]=react.useState(true),b=react.useCallback(w=>{a({search:w.target.value});},[a]),u=react.useCallback(w=>{a({dateFilter:w.target.value});},[a]),x=react.useCallback(w=>{r({by:w.target.value});},[r]),m=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${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"}),N&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!C&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:u,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:w=>{let R=w.target.value;a({priorities:R==="all"?[]:[R]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),C0.map(w=>jsxRuntime.jsx("option",{value:w,children:w},w))]})}),g.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:w=>{let R=w.target.value;a({assignees:R==="all"?[]:[R]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),g.map(w=>jsxRuntime.jsx("option",{value:w.id,children:w.name},w.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:w=>{let 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:x,className:"filter-bar__select filter-bar__select--sm",children:T0.map(w=>jsxRuntime.jsx("option",{value:w.value,children:w.label},w.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:m,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),k&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:y,onChange:w=>k(w.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:N0.map(w=>jsxRuntime.jsx("option",{value:w.value,children:w.label},w.value))})}),N&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Di({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:c,onExportGanttCSV:g}){let[i,p]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let y=k=>{l.current&&!l.current.contains(k.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 c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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(()=>g?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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),B0="asakaa-theme";function Ac({children:e,defaultTheme:t=Un,storageKey:a=B0}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,g=po[r];Object.entries(g.colors).forEach(([p,l])=>{l&&c.style.setProperty(`--theme-${R0(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=g.colors[p];f&&c.style.setProperty(l,f);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes: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 R0(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 at[e]||at.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",at[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",at[e].bgSecondary),bgGrid:r("--theme-bg-card",at[e].bgGrid),bgWeekend:r("--theme-bg-hover",at[e].bgWeekend),border:r("--theme-border-primary",at[e].border),borderLight:r("--theme-border-subtle",at[e].borderLight),textPrimary:r("--theme-text-primary",at[e].textPrimary),textSecondary:r("--theme-text-secondary",at[e].textSecondary),textTertiary:r("--theme-text-tertiary",at[e].textTertiary),accent:r("--theme-accent-primary",at[e].accent),accentHover:r("--theme-accent-hover",at[e].accentHover),accentLight:r("--theme-accent-primary",at[e].accentLight),taskBarPrimary:r("--theme-accent-primary",at[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",at[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",at[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",at[e].dependency),dependencyHover:r("--theme-border-secondary",at[e].dependencyHover),criticalPath:r("--theme-error",at[e].criticalPath),criticalPathLight:r("--theme-error",at[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",at[e].today):e==="neutral"?r("--theme-text-primary",at[e].today):r("--theme-error",at[e].today),todayLight:e==="light"?r("--theme-accent-primary",at[e].todayLight):e==="neutral"?r("--theme-text-primary",at[e].todayLight):r("--theme-error",at[e].todayLight),milestone:r("--theme-warning",at[e].milestone),milestoneLight:r("--theme-warning",at[e].milestoneLight),statusTodo:r("--theme-text-tertiary",at[e].statusTodo),statusInProgress:r("--theme-accent-primary",at[e].statusInProgress),statusCompleted:r("--theme-success",at[e].statusCompleted),hoverBg:r("--theme-bg-hover",at[e].hoverBg),focusRing:r("--theme-accent-primary",at[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 rb({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[c,g]=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)&&g(false);};return c&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]),!(t||a||r||o||s||n))return null;let k=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(h=>h.handler),C=async(h,b)=>{if(b){p(h);try{await b();}catch(u){console.error(`Export ${h} failed:`,u);}finally{p(null),g(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>g(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:f.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:k.map((h,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<k.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 ob({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 nb({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 sb({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 c=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],g=c.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${g}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((i,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<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay: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 ib({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),c=react.useRef(null),g=jr();react.useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let y=C=>{c.current&&!c.current.contains(C.target)&&n(false);},k=C=>{C.key==="Escape"&&n(false);};document.addEventListener("mousedown",y),document.addEventListener("keydown",k),c._cleanup=()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",k);};},100);return ()=>{clearTimeout(f),c._cleanup&&c._cleanup();}},[s]);let i=[{value:"all",label:g.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:g.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:g.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:g.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:c,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:g.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:g.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-2",children:i.map(f=>{let y=t===f.value&&!r,k=()=>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:k()}),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:g.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:c,onRowDensityChange:g,showThemeSelector:i=false,showCreateTaskButton:p=false,createTaskLabel:l,onCreateTask:f,taskFilter:y="all",onTaskFilterChange:k,hideCompleted:C=false,onHideCompletedChange:h,onExportPNG:b,onExportPDF:u,onExportExcel:x,onExportCSV:m,onExportJSON:N,onExportMSProject:w}){let R=jr(),v=b||u||x||m||N||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(nb,{options:I,value:t,onChange:T=>a(T),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(sb,{theme:e,value:c,onChange:g}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(ib,{theme:e,value:y,onChange:k,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(rb,{theme:e,onExportPNG:b,onExportPDF:u,onExportExcel:x,onExportCSV:m,onExportJSON:N,onExportMSProject:w}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(ob,{options:F,value:s,onChange:T=>n(T),theme:e})]})]})}function _n({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),c=react.useRef(null),g=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=l=>{c.current&&!c.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:g,onClick:()=>{if(!r&&g.current){let p=g.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(gt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(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),[c,g]=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,k=window.innerHeight,C=t,h=a;t+p+f>y&&(C=t-p,C<f&&(C=f)),a+l+f>k&&(h=k-l-f,h<f&&(h=f)),g({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:`${c.x}px`,top:`${c.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(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:c,onTaskOutdent:g,onTaskRename:i,onTaskToggleExpand:p,onOpenTaskModal:l,enableKeyboard:f=true}){let y=react.useRef(false),k=react.useCallback(x=>{y.current=x;},[]),C=react.useCallback(x=>{let m=[],N=w=>{for(let R of w)m.push(R),R.subtasks&&R.subtasks.length>0&&R.isExpanded&&N(R.subtasks);};return N(x),m},[]),h=react.useCallback(()=>{let x=C(e);for(let m of x)if(t.has(m.id))return m;return null},[e,t,C]),b=react.useCallback((x,m)=>{let N=C(e);if(N.length===0)return;let w=h();if(!w){a(N[0].id,false);return}let R=N.findIndex(F=>F.id===w.id);if(R===-1)return;let v=x==="up"?R-1:R+1;if(v<0||v>=N.length)return;let I=N[v];a(I.id,m);},[e,h,C,a]),u=react.useCallback(x=>{if(!f)return;let m=x.target;if(m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable||y.current){x.key==="Escape"&&(m.blur(),y.current=false);return}let R=navigator.platform.toUpperCase().indexOf("MAC")>=0?x.metaKey:x.ctrlKey,v=Array.from(t),I=h();if(x.key==="ArrowUp"){x.preventDefault(),b("up",x.shiftKey);return}if(x.key==="ArrowDown"){x.preventDefault(),b("down",x.shiftKey);return}if(I&&(x.key==="ArrowRight"||x.key==="ArrowLeft")){I.subtasks&&I.subtasks.length>0&&(x.preventDefault(),(x.key==="ArrowRight"&&!I.isExpanded||x.key==="ArrowLeft"&&I.isExpanded)&&p(I.id));return}if(x.altKey&&(x.key==="ArrowUp"||x.key==="ArrowDown")){v.length>0&&(x.preventDefault(),n(v,x.key==="ArrowUp"?"up":"down"));return}if(x.key==="Tab"&&!x.shiftKey){v.length>0&&(x.preventDefault(),c(v));return}if(x.key==="Tab"&&x.shiftKey){v.length>0&&(x.preventDefault(),g(v));return}if(x.key==="Enter"&&!x.shiftKey&&!R){I&&(x.preventDefault(),r(I.id,"below"));return}if(x.key==="Enter"&&x.shiftKey&&!R){I&&(x.preventDefault(),r(I.id,"above"));return}if(x.key==="Enter"&&R){I&&(x.preventDefault(),l(I.id));return}if(x.key==="F2"){I&&(x.preventDefault(),i(I.id));return}if(x.key==="Delete"||x.key==="Backspace"&&R){v.length>0&&(x.preventDefault(),o(v));return}if(x.key==="d"&&R&&!x.shiftKey){v.length>0&&(x.preventDefault(),s(v));return}},[f,t,h,b,r,o,s,n,c,g,i,p,l]);return react.useEffect(()=>{if(f)return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u);}},[f,u]),{setIsEditing:k}}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),k=f.indexOf(l);if(y===-1||k===-1){o(l);return}let C=Math.min(y,k),h=Math.max(y,k),b=f.slice(C,h+1);t(new Set(b)),r(l);},[a,o]),c=react.useCallback((l,f,y,k)=>{k?n(l,f):y?s(l):o(l);},[o,s,n]),g=react.useCallback((l,f)=>{f?t(y=>{let k=new Set(y);return k.add(l),k}):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:c,handleKeyboardSelection:g,clearSelection:i,isTaskSelected:p}}function Bo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let c={...r[n],parentId:o,level:s,position:n};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function 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}},c=(l,f,y)=>l.map(k=>k.id===f?{...k,subtasks:[...k.subtasks||[],...y],isExpanded:true}:k.subtasks?{...k,subtasks:c(k.subtasks,f,y)}:k),g=new Set(t),{tasks:i,removed:p}=n(e,g);return c(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 k=y.subtasks.findIndex(C=>C.id===l);if(k!==-1){let[C]=y.subtasks.splice(k,1);return C}}if(y.subtasks){let k=n(y.subtasks,p,l);if(k)return k}}return null},c=(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&&c(y.subtasks,p,l);return i},g=n(a,o.id,r);g&&(s&&s.subtasks?c(s.subtasks,o.id,g):c(a,o.id,g));}return a}function Wi(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,c,g)=>{let i=n.findIndex(l=>l.id===c);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,c,g))return true;return false}let p=g==="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 c=n.findIndex(p=>p.id===r);if(c===-1){for(let p of n)if(p.subtasks&&o(p.subtasks))return true;return false}let g=n[c],i={...g,id:`${g.id}-copy-${Date.now()}`,name:`${g.name} (Copy)`,subtasks:g.subtasks?s(g.subtasks):void 0};return n.splice(c+1,0,i),true},s=n=>n.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function 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"},c=g=>{let i=g.findIndex(l=>l.id===t);if(i===-1){for(let l of g)if(l.subtasks&&c(l.subtasks))return true;return false}let p=a==="above"?i:i+1;return g.splice(p,0,n),true};return c(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,c=r?.endDate||s,g={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(c),color:r?.color||"#3B82F6"},i=p=>p.map(l=>{if(l.id===t){let f=l.subtasks||[];return {...l,subtasks:[...f,g],isExpanded:true}}return l.subtasks?{...l,subtasks:i(l.subtasks)}:l});return {tasks:i(e),newTask:g}}function Yc(e,t,a,r){if(t===a)return e;let o=jc(e,t);if(!o)return e;if(a){let c=(g,i)=>{if(!g.subtasks)return false;for(let p of g.subtasks)if(p.id===i||c(p,i))return true;return false};if(c(o,a))return e}let s=c=>c.filter(g=>g.id!==t).map(g=>g.subtasks&&g.subtasks.length>0?{...g,subtasks:s(g.subtasks)}:g),n=s(e);if(a===null){let c=r!==void 0?r:n.length;n.splice(c,0,{...o,parentId:void 0});}else {let c=g=>g.map(i=>{if(i.id===a){let 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:c(i.subtasks)}:i});n=c(n);}return n}function Kn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:c,onTaskToggle:g,scrollTop:i,columns:p,onToggleColumn:l,onColumnResize:f,onTaskUpdate:y,onTaskIndent:k,onTaskOutdent:C,onTaskMove:h,onMultiTaskDelete:b,onTaskDuplicate:u,onTaskCreate:x,onTaskRename:m,onCreateSubtask:N,onOpenTaskModal:w,onDeleteRequest:R,onTaskReparent:v}){let I=react.useContext(Lo),[F,T]=react.useState(null),[z,$]=react.useState(null),[K,ae]=react.useState(""),se=react.useRef(null),[oe,xe]=react.useState(null),[he,Re]=react.useState(0),[A,O]=react.useState(0),[L,j]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[J,de]=react.useState(null),[be,pe]=react.useState(null),[Ie,Q]=react.useState(null),Xe=react.useRef(0),Ne=5,Je=react.useRef(false),[dt,yt]=react.useState(null),[Qe,xt]=react.useState(false),[Pt,Tt]=react.useState(null),[Ye,B]=react.useState(false),ne=react.useRef(null);react.useEffect(()=>{function G(Y){ne.current&&!ne.current.contains(Y.target)&&B(false);}if(Ye)return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[Ye]),react.useEffect(()=>{z&&se.current&&(se.current.focus(),se.current.select());},[z]),react.useEffect(()=>{if(!oe)return;let G=ye=>{let Ke=ye.clientX-he,Be=A+Ke;f?.(oe,Be);},Y=()=>{xe(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",Y),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",Y),document.body.style.cursor="",document.body.style.userSelect="";}},[oe,he,A,f]);let{selectedTaskIds:Pe,handleTaskClick:Ue,isTaskSelected:_}=Vc(),{setIsEditing:ue}=Gc({tasks:e,selectedTaskIds:Pe,onTaskSelect:(G,Y)=>{let Ke=Bo(e).map(Be=>Be.id);Ue(G,Ke,Y||false,false);},onTaskCreate:x||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:u||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:k||(()=>{}),onTaskOutdent:C||(()=>{}),onTaskRename:G=>{let Y=Bo(e).find(ye=>ye.id===G);Y&&Mt(Y);},onTaskToggleExpand:g||(()=>{}),onOpenTaskModal:G=>{let Y=Bo(e).find(ye=>ye.id===G);Y&&w&&w(Y);},enableKeyboard:true}),ze=(G,Y=0)=>{let ye=[];for(let Ke of G)ye.push({task:Ke,level:Y}),Ke.subtasks&&Ke.subtasks.length>0&&Ke.isExpanded&&ye.push(...ze(Ke.subtasks,Y+1));return ye},ce=ze(e),nt=48,et=Math.max(ce.length*a,600-nt),He=G=>!G.startDate||!G.endDate?"-":`${Math.ceil((G.endDate.getTime()-G.startDate.getTime())/(1e3*60*60*24))}d`,Mt=G=>{$(G.id),ae(G.name),ue(true);},At=G=>{K.trim()&&K!==e.find(Y=>Y.id===G)?.name&&m?.(G,K.trim()),$(null),ae(""),ue(false);},Ze=()=>{$(null),ae(""),ue(false);},te=(G,Y)=>{Y.stopPropagation(),N?.(G.id);},S=(G,Y)=>{Y.preventDefault(),Xe.current=Y.clientY,de(G),Je.current=false,xt(false),yt({x:Y.clientX,y:Y.clientY});},Te=G=>{if(!J||(Math.abs(G.clientY-Xe.current)>Ne&&!Je.current&&(Je.current=true,xt(true)),yt({x:G.clientX,y:G.clientY}),!Je.current))return;let ye=document.querySelectorAll("[data-task-row]"),Ke=null,Be=null;ye.forEach(U=>{let le=U.getBoundingClientRect(),Ge=U.getAttribute("data-task-row");if(Ge&&Ge!==J&&G.clientY>=le.top&&G.clientY<=le.bottom){Ke=Ge;let Nt=G.clientY-le.top,ct=le.height;Nt<ct*.25?Be="above":Nt>ct*.75?Be="below":Be="child";}}),pe(Ke),Q(Be);},X=()=>{if(Je.current&&J&&be&&Ie){if(Ie==="child")v?.(J,be);else if(Ie==="above"||Ie==="below"){let G=(Ke,Be,U=null)=>{for(let le of Ke){if(le.id===Be)return U;if(le.subtasks){let Ge=G(le.subtasks,Be,le.id);if(Ge!==void 0)return Ge}}},Y=G(e,be,null),ye=(Ke,Be)=>{let U=Ke.findIndex(le=>le.id===Be);return Ie==="below"?U+1:U};if(Y===null){let Ke=ye(e,be);v?.(J,null,Ke);}else {let Ke=ce.find(Be=>Be.task.id===Y)?.task;if(Ke?.subtasks){let Be=ye(Ke.subtasks,be);v?.(J,Y,Be);}}}}de(null),pe(null),Q(null),yt(null),Je.current=false,xt(false);};react.useEffect(()=>{if(J)return document.addEventListener("mousemove",Te),document.addEventListener("mouseup",X),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Te),document.removeEventListener("mouseup",X),document.body.style.cursor="",document.body.style.userSelect="";}},[J,be,Ie]);let Ce=(G,Y,ye)=>{switch(G.id){case "name":let Ke=z===Y.id,Be=F===Y.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ye*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:Be?1:.3},onMouseDown:H=>S(Y.id,H),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),Y.subtasks&&Y.subtasks.length>0?jsxRuntime.jsx("button",{onClick:H=>{H.stopPropagation(),g?.(Y.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:Y.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:Y.color||"#3B82F6",opacity:Y.parentId?.6:1,borderColor:Y.isMilestone?t.accent:"transparent",borderWidth:Y.isMilestone?"2px":"0px"},title:Y.isMilestone?"Milestone":Y.parentId?"Subtask":"Task"})}),Ke?jsxRuntime.jsx("input",{ref:se,type:"text",value:K,onChange:H=>ae(H.target.value),onKeyDown:H=>{H.key==="Enter"?At(Y.id):H.key==="Escape"&&Ze();},onBlur:()=>At(Y.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:H=>H.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:Y.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Y.parentId?"13px":"14px",fontWeight:Y.isMilestone?600:Y.parentId?400:600,letterSpacing:Y.parentId?"0":"-0.01em"},title:Y.name,children:Y.name}),Be&&!Ke&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:H=>H.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:H=>te(Y,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(),Mt(Y);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let le=G.id==="startDate"?"startDate":"endDate",Ge=Y[le],Nt=Pt?.taskId===Y.id&&Pt?.field===le,ct=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(Nt)Tt(null);else {let Me=H.currentTarget.getBoundingClientRect();Tt({taskId:Y.id,field:le,month:Ge?typeof Ge=="string"?new Date(Ge):Ge:new Date,position:{top:Me.bottom+4,left:Me.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:ct(Ge)})]}),Nt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Tt(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:Pt?.position.top,left:Pt?.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,Me=new Date(H);Me.setDate(H.getDate()+1);let Ae=new Date(H);Ae.setDate(H.getDate()+7);let Ut=new Date(H);return Ut.setDate(H.getDate()+14),[{label:"Hoy",date:H},{label:"Ma\xF1ana",date:Me},{label:"Pr\xF3xima semana",date:Ae},{label:"2 semanas",date:Ut}].map((_e,ht)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:$e=>$e.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:$e=>$e.currentTarget.style.backgroundColor="transparent",onClick:()=>{y?.(Y.id,{[le]:_e.date}),Tt(null);},children:_e.label},ht))})(),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?.(Y.id,{[le]:void 0}),Tt(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:()=>Tt(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:Pt?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Tt(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,Me)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:H},Me))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let H=Pt?.month||new Date,Me=H.getFullYear(),Ae=H.getMonth(),Ut=new Date(Me,Ae,1).getDay(),me=new Date(Me,Ae+1,0).getDate(),_e=new Date,ht=[];for(let ut=Ut-1;ut>=0;ut--)ht.push({day:new Date(Me,Ae,-ut).getDate(),date:new Date(Me,Ae-1,new Date(Me,Ae,-ut).getDate()),isCurrentMonth:false});for(let ut=1;ut<=me;ut++)ht.push({day:ut,date:new Date(Me,Ae,ut),isCurrentMonth:true});let $e=42-ht.length;for(let ut=1;ut<=$e;ut++)ht.push({day:ut,date:new Date(Me,Ae+1,ut),isCurrentMonth:false});return ht.map((ut,ya)=>{let ka=ut.date.toDateString()===_e.toDateString(),qe=(Ge?typeof Ge=="string"?new Date(Ge):Ge: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?qe?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:qe?"#3B82F6":"transparent",boxShadow:ka&&!qe?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{y?.(Y.id,{[le]:ut.date}),Tt(null);},children:ut.day},ya)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:He(Y)})});case "assignees":let Dr=r.filter(H=>Y.assignees?.some(Me=>Me.name===H.name||Me.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 Me=H.map(Ae=>({id:Ae.id,name:Ae.name,initials:Ae.initials,color:Ae.color}));y?.(Y.id,{assignees:Me.length>0?Me: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:Y.status||"todo",onChange:H=>{y?.(Y.id,{status:H,progress:H==="completed"?100:Y.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Y.progress}%`,backgroundColor:Y.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[Y.progress,"%"]})]});case "priority":let fr={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ua={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},M=fr[Y.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?.(Y.id,{priority:Ua[H]||"medium"});}})});default:return null}},we=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:()=>{N?.(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:()=>{N?.(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),tt=Oe.reduce((G,Y)=>G+Y.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:tt},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${nt}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,Y)=>{let ye=Y===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:ye?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Be=>{Be.preventDefault(),j({isOpen:true,x:Be.clientX,y:Be.clientY,type:"header",columnId:G.id});},onMouseEnter:Be=>{Be.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Be=>{Be.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:oe===G.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Be=>{Be.preventDefault(),Be.stopPropagation(),xe(G.id),Re(Be.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:ne,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:et},children:ce.map(({task:G,level:Y},ye)=>{let Ke=_(G.id),Be=be===G.id,U=Be&&Ie==="above",le=Be&&Ie==="below",Ge=Be&&Ie==="child",Nt={};return Ge&&(Nt.backgroundColor=`${t.accent}15`,Nt.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`:ye%2===0?t.bgPrimary:t.bgGrid,...Nt},onMouseEnter:()=>T(G.id),onMouseLeave:()=>T(null),onClick:ct=>{let fr=Bo(e).map(H=>H.id),M=navigator.platform.toUpperCase().indexOf("MAC")>=0?ct.metaKey:ct.ctrlKey;Ue(G.id,fr,M,ct.shiftKey),s?.(G);},onDoubleClick:ct=>{ct.stopPropagation(),n?.(G);},onContextMenu:ct=>{ct.preventDefault(),j({isOpen:true,x:ct.clientX,y:ct.clientY,type:"task",task:G}),c?.(G,ct);},whileHover:{backgroundColor:Ke?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}}),le&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Oe.map((ct,Dr)=>{let fr=Dr===Oe.length-1,Ua=ct.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Ua?"justify-start":"justify-center"}`,style:{width:`${ct.width}px`,minWidth:`${ct.minWidth??(Ua?200:60)}px`,maxWidth:`${ct.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:Ce(ct,G,Ua?Y:0)},`${G.id}-${ct.id}`)})]},G.id)})}),jsxRuntime.jsx(Io,{isOpen:L.isOpen,x:L.x,y:L.y,items:L.type==="header"&&L.columnId?we(L.columnId):L.type==="task"&&L.task?We(L.task):[],onClose:()=>j({...L,isOpen:false}),theme:t}),Qe&&dt&&J&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:dt.x+12,top:dt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let G=ce.find(Y=>Y.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,c]=react.useState(e),[g,i]=react.useState(t),[p,l]=react.useState(null),[f,y]=react.useState(null),[k,C]=react.useState(null),[h,b]=react.useState(null),[u,x]=react.useState(0),[m,N]=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:c,ghostWidth:g,setGhostWidth:i,connectionLine:p,setConnectionLine:l,hoveredTaskId:f,setHoveredTaskId:y,activeZone:k,setActiveZone:C,draggedSegmentIndex:h,setDraggedSegmentIndex:b,draggedSegmentStartX:u,setDraggedSegmentStartX:x,segmentDragOffsetX:m,setSegmentDragOffsetX:N,hoveredSegmentIndex:w,setHoveredSegmentIndex:R,isHovered:v,setIsHovered:I,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(K,ae)=>{r("none"),l(null),y(null),c(K),i(ae),N(0),b(null),x(0);}}}function qn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:c,onClick:g,onDoubleClick:i,onContextMenu:p,onDateChange:l,onDependencyCreate:f,allTaskPositions:y=[],onDragMove:k,onHoverChange:C}){let h=Qc(t,r),b=react.useRef(null),u=react.useRef(null),x=react.useRef(null),{dragMode:m,setDragMode:N,dragOffset:w,setDragOffset:R,ghostX:v,setGhostX:I,ghostWidth:F,setGhostWidth:T,connectionLine:z,setConnectionLine:$,hoveredTaskId:K,setHoveredTaskId:ae,activeZone:se,setActiveZone:oe,draggedSegmentIndex:xe,setDraggedSegmentIndex:he,draggedSegmentStartX:Re,setDraggedSegmentStartX:A,segmentDragOffsetX:O,setSegmentDragOffsetX:L,hoveredSegmentIndex:j,setHoveredSegmentIndex:J,isHovered:de,setIsHovered:be,isDragging:pe,isResizing:Ie,isConnecting:Q,resetDragState:Xe}=h,Ne=32,Je=8,dt=e.endDate&&e.endDate<new Date&&e.progress<100,yt=e.isCriticalPath,Qe=o.name==="neutral"||o.today==="#1C1917",xt=e.status==="completed"||e.progress===100,Pt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Ye=e.isCriticalPath||dt?"#DC2626":e.color?e.color:e.priority&&Pt[e.priority]?Pt[e.priority]:o.taskBarPrimary,ne=(X=>X>=80?20:X>=60?15:X>=50?12:10)(r),Pe=r<50,Ue=r<40;react.useEffect(()=>{if(C)if(de&&!pe&&!e.segments){let X=a<100;C({task:e,x:t,y:a,width:r,height:Ne,showBelow:X});}else C(null);},[de,pe,e,t,a,r,Ne,C]);let _=X=>X.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ue=()=>{let X=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${X} day${X!==1?"s":""}`},ze=X=>Math.round(X/s)*s,ce=X=>{let Ce=Math.round(X/s),we=new Date(n);return we.setDate(we.getDate()+Ce),we},nt=(X,Ce)=>{for(let we of y){if(we.id===e.id)continue;let We=5;if(X>=we.x-We&&X<=we.x+we.width+We&&Ce>=we.y-We&&Ce<=we.y+we.height+We)return we.id}return null},et=react.useCallback((X,Ce,we)=>{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 tt=Oe.matrixTransform(We.getScreenCTM()?.inverse()),G=we!==void 0?we:t,Y=Ce;if(!Y){let ye=tt.x-G;X.shiftKey?(Y="connect",$({x:t+r,y:a+Ne/2})):X.ctrlKey||X.metaKey?Y="move":X.altKey?Y=ye<r/2?"resize-start":"resize-end":Ue?ye<r/2?Y="move":Y="resize-end":Pe?ye<=ne/2?Y="resize-start":ye>=r-ne/2?Y="resize-end":Y="move":ye<=ne?Y="resize-start":ye>=r-ne?Y="resize-end":Y="move";}N(Y),be(false),oe(null),Y==="move"?R(tt.x-G):Y==="connect"?$({x:t+r,y:a+Ne/2}):R(0),I(G),T(r);},[t,r,a,Ne]),He=react.useCallback(X=>{let Ce=b.current?.ownerSVGElement;if(!Ce)return;let we=Ce.closest(".gantt-timeline-scroll");if(!we)return;let We=we.getBoundingClientRect(),Oe=60,tt=15,G=0;if(X.clientX<We.left+Oe){let Y=We.left+Oe-X.clientX;G=-Math.min(tt,Y/2);}else if(X.clientX>We.right-Oe){let Y=X.clientX-(We.right-Oe);G=Math.min(tt,Y/2);}return G!==0&&(we.scrollLeft+=G),G!==0},[]),Mt=react.useCallback(X=>{if(m==="none")return;x.current=X;let Ce=b.current?.ownerSVGElement;if(!Ce)return;if(m==="move"||m==="resize-start"||m==="resize-end"){let Oe=He(X);Oe&&!u.current?u.current=window.setInterval(()=>{x.current&&(He(x.current),Mt(x.current));},16):!Oe&&u.current&&(window.clearInterval(u.current),u.current=null);}let we=Ce.createSVGPoint();we.x=X.clientX,we.y=X.clientY;let We=we.matrixTransform(Ce.getScreenCTM()?.inverse());if(m==="connect"){$({x:We.x,y:We.y});let Oe=nt(We.x,We.y);ae(Oe);}else if(m==="move"){let Oe=We.x-w,tt=ze(Oe);I(tt),T(r);let G=Math.round((tt-t)/s);if(k?.(e.id,G,true),e.segments&&e.segments.length>0&&xe!==null){let Y=tt-Re;L(Y);}}else if(m==="resize-start"){let Oe=We.x,tt=ze(Oe),G=t+r-tt;G>=s&&(I(tt),T(G));}else if(m==="resize-end"){let Oe=We.x,G=ze(Oe)-t;G>=s&&T(G);}},[m,t,r,s,w,e,ze,xe,Re,nt,ae,$,I,T,L,k,He]),At=react.useCallback(()=>{if(u.current&&(window.clearInterval(u.current),u.current=null),x.current=null,m!=="none"){if(m==="connect")K&&f&&f(e,K),$(null),ae(null);else {let X=e.endDate.getTime()-e.startDate.getTime(),Ce,we,We=true;if(m==="move"){if(Ce=ce(v),we=new Date(Ce.getTime()+X),e.segments&&e.segments.length>0&&xe!==null){let Oe=Math.round(O/s),tt=e.segments.map((Ke,Be)=>{if(Be===xe){let U=new Date(Ke.startDate),le=new Date(Ke.endDate);return U.setDate(U.getDate()+Oe),le.setDate(le.getDate()+Oe),{startDate:U,endDate:le}}return Ke}),G=tt.flatMap(Ke=>[Ke.startDate,Ke.endDate]),Y=new Date(Math.min(...G.map(Ke=>Ke.getTime()))),ye=new Date(Math.max(...G.map(Ke=>Ke.getTime())));l?.({...e,segments:tt},Y,ye),Xe(t,r);return}}else m==="resize-start"?(Ce=ce(v),we=e.endDate,Ce>we&&(console.warn("Invalid date range: start date must be before or equal to end date"),We=false)):m==="resize-end"?(Ce=e.startDate,we=ce(v+F),we<Ce&&(console.warn("Invalid date range: end date must be after or equal to start date"),We=false)):We=false;We&&Ce&&we&&(we.getTime()<Ce.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,Ce,we));}k?.(e.id,0,false),Xe(t,r);}},[m,v,F,e,l,K,f,t,r,s,ce,O,xe,Xe,k]);react.useEffect(()=>{if(m==="none")return;let X=we=>{Mt(we);},Ce=()=>{At();};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",Ce),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",Ce),u.current&&(window.clearInterval(u.current),u.current=null);}},[m,Mt,At]);let Ze=pe&&!Q?v:t,te=pe&&!Q?F:r,S=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:b,"data-task-bar":"true",onClick:()=>!pe&&g?.(e),onDoubleClick:X=>{pe||(X.stopPropagation(),i?.(e));},onContextMenu:X=>{X.preventDefault(),p?.(e,X);},onMouseEnter:()=>!pe&&be(true),onMouseLeave:()=>{pe||(be(false),oe(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:Ne,fill:"transparent",style:{pointerEvents:"all"}}),de&&!pe&&!Pe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:ne,height:Ne,fill:se==="resize-start"?o.accent:"transparent",opacity:se==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>oe("resize-start"),onMouseDown:X=>et(X,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ne,y:a,width:r-ne*2,height:Ne,fill:se==="move"?o.accent:"transparent",opacity:se==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:X=>et(X,"move")}),jsxRuntime.jsx("rect",{x:t+r-ne,y:a,width:ne,height:Ne,fill:se==="resize-end"?o.accent:"transparent",opacity:se==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:X=>et(X,"resize-end")})]}),de&&!pe&&Ue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Ne,fill:se==="move"?o.accent:"transparent",opacity:se==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:X=>et(X,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ne,fill:se==="resize-end"?o.accent:"transparent",opacity:se==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:X=>et(X,"resize-end")}),de&&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"}})]}),pe&&!Q&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:v,y:a,width:F,height:Ne,rx:Je,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ze,y:a,width:te,height:Ne,rx:Je,fill:Ye,"data-task-class":S,initial:{opacity:0,scale:.95},animate:{opacity:pe&&!Q?.15:e.parentId?.6:de?.9:.8,scale:de&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:X=>et(X),style:{cursor:pe?Q?"crosshair":Ie?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Ze,y:a,width:te*(e.progress/100),height:Ne,rx:Je,fill:Ye,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((X,Ce)=>{let we=(X.startDate.getTime()-n.getTime())/864e5*s,Oe=(X.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-we+s,tt=pe&&m==="move"&&xe===Ce,G=j===Ce,Y=tt?we+O:we;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!pe&&J(Ce),onMouseLeave:()=>!pe&&J(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Y,y:a,width:Oe,height:Ne,rx:Je,fill:Ye,initial:{opacity:0,scale:.95},animate:{opacity:tt||e.parentId?.6:G?.9:.8,scale:G&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ye=>{ye.stopPropagation(),he(Ce),A(we),et(ye,void 0,we);},style:{cursor:pe?Q?"crosshair":Ie?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Y,y:a,width:Oe*(e.progress/100),height:Ne,rx:Je,fill:Ye,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ce}`)}),Qe&&(dt||yt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[yt&&!dt&&jsxRuntime.jsx("rect",{x:Ze,y:a,width:te,height:Ne,rx:Je,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),dt&&jsxRuntime.jsx("rect",{x:Ze,y:a,width:te,height:Ne,rx:Je,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),te>60&&!e.segments&&(()=>{let X=c.taskLabel(e),Ce=typeof X=="string"?X:e.name,we=Ce.length>Math.floor(te/8)?`${Ce.substring(0,Math.floor(te/8))}...`:Ce;return jsxRuntime.jsx("text",{x:Ze+12,y:a+Ne/2,dominantBaseline:"middle",fill:xt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:xt?"line-through":"none"},children:we})})(),te>100&&e.progress>0&&e.progress<100&&!pe&&!e.segments&&jsxRuntime.jsxs("text",{x:Ze+te-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&&te>80&&!pe&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Ze+te-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Ze+te-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(de||Ie)&&!Q&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Ze-2,y:a,width:16,height:Ne,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>oe("resize-start"),onMouseLeave:()=>oe(null),onMouseDown:X=>{X.stopPropagation(),et(X,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ze+4,y:a+8,width:3,height:Ne-16,rx:1.5,fill:se==="resize-start"||m==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Ze+te-14,y:a,width:16,height:Ne,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>oe("resize-end"),onMouseLeave:()=>oe(null),onMouseDown:X=>{X.stopPropagation(),et(X,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ze+te-7,y:a+8,width:3,height:Ne-16,rx:1.5,fill:se==="resize-end"||m==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:de&&!pe&&!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:X=>{X.stopPropagation(),et(X,"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:se==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Q&&z&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Ne/2,x2:z.x,y2:z.y,stroke:K?o.statusCompleted:o.accent,strokeWidth:K?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:K?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:z.x,cy:z.y,r:K?8:6,fill:K?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),K&&jsxRuntime.jsx(framerMotion.motion.text,{x:z.x+15,y:z.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:z.x+10},animate:{opacity:1,x:z.x+15},transition:{duration:.2},children:"Connect"})]}),(de||pe)&&!Q&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ze-2,y:a-2,width:te+4,height:Ne+4,rx:Je+2,fill:"none",stroke:pe?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:pe?.6:.4,initial:{opacity:0},animate:{opacity:pe?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Ie&&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:de&&!pe&&!e.segments&&!C&&(()=>{let we=a<100,We=we?a+Ne+13:a-82-13,Oe=we?`M ${Ze+te/2-6} ${a+Ne+3} L ${Ze+te/2} ${a+Ne+13} L ${Ze+te/2+6} ${a+Ne+3}`:`M ${Ze+te/2-6} ${a-13} L ${Ze+te/2} ${a-3} L ${Ze+te/2+6} ${a-13}`,tt=We+22,G=We+40,Y=We+55,ye=We+70,Ke=we?We+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:we?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:we?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Oe,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Ze+te/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:Ze+te/2,y:tt,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Ze+te/2-110,y:G,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Ze+te/2-70,y:G,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:_(e.startDate)}),jsxRuntime.jsx("text",{x:Ze+te/2-110,y:Y,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Ze+te/2-70,y:Y,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:_(e.endDate)}),jsxRuntime.jsx("text",{x:Ze+te/2+10,y:G,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Ze+te/2+65,y:G,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ue()}),jsxRuntime.jsx("text",{x:Ze+te/2+10,y:Y,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Ze+te/2+65,y:Y,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:Ze+te/2-110,y:ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Ze+te/2-50,y:ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Be=>Be.name).join(", ").substring(0,30),e.assignees.map(Be=>Be.name).join(", ").length>30?"...":""]})]}),!we&&jsxRuntime.jsx("text",{x:Ze+te/2,y:Ke,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ue?"Left: move \u2022 Right: resize":Pe?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function am({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:c}=e,g=82,i=13,p=c?o+n+i:o-g-i,l=c?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,f=p+22,y=p+40,k=p+55,C=p+70,h=m=>m.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let m=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${m} day${m!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:p,width:240,height:g,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y: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:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?h(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y,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:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(m=>m.name).join(", ").substring(0,30),a.assignees.map(m=>m.name).join(", ").length>30?"...":""]})]})]})})}function Zn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:c=false}){let[g,i]=react.useState(false),[p,l]=react.useState(null),f=r-t,y=f>0,k=Math.abs(f)<5,h=5,b=20,u=!k&&a<=e,x,m;if(k)if(m=(e+a)/2,n==="squared")x=`M ${e} ${t} L ${a} ${r}`;else {let se=Math.min(Math.abs(a-e)/3,30);x=`M ${e} ${t} C ${e+se} ${t}, ${a-se} ${r}, ${a} ${r}`;}else if(m=a-b,u){let oe=e+15,xe=a-b,he=y?t+20:t-20;m=xe,n==="squared"?x=`M ${e} ${t} L ${oe} ${t} L ${oe} ${he} L ${xe} ${he} L ${xe} ${r} L ${a} ${r}`:y?x=`M ${e} ${t} L ${oe-h} ${t} Q ${oe} ${t} ${oe} ${t+h} L ${oe} ${he-h} Q ${oe} ${he} ${oe-h} ${he} L ${xe+h} ${he} Q ${xe} ${he} ${xe} ${he+h} L ${xe} ${r-h} Q ${xe} ${r} ${xe+h} ${r} L ${a} ${r}`:x=`M ${e} ${t} L ${oe-h} ${t} Q ${oe} ${t} ${oe} ${t-h} L ${oe} ${he+h} Q ${oe} ${he} ${oe-h} ${he} L ${xe+h} ${he} Q ${xe} ${he} ${xe} ${he-h} L ${xe} ${r+h} Q ${xe} ${r} ${xe+h} ${r} L ${a} ${r}`;}else n==="squared"?x=`M ${e} ${t} L ${m} ${t} L ${m} ${r} L ${a} ${r}`:y?x=`M ${e} ${t} L ${m-h} ${t} Q ${m} ${t} ${m} ${t+h} L ${m} ${r-h} Q ${m} ${r} ${m+h} ${r} L ${a} ${r}`:x=`M ${e} ${t} L ${m-h} ${t} Q ${m} ${t} ${m} ${t-h} L ${m} ${r+h} Q ${m} ${r} ${m+h} ${r} L ${a} ${r}`;let N=5,w=`M ${a} ${r} L ${a-N} ${r-N*.5} M ${a} ${r} L ${a-N} ${r+N*.5}`,R=o.dependency,v=o.dependencyHover||R,I="#f87171",F="rgba(248, 113, 113, 0.15)",T=m,z=(t+r)/2;if(p)if(k)T=Math.max(e+10,Math.min(a-10,p.x)),z=t;else if(u){let se=e+15,oe=a-b,xe=y?t+20:t-20,he=[[e,t,se,t],[se,t,se,xe],[se,xe,oe,xe],[oe,xe,oe,r],[oe,r,a,r]],Re=1/0,A={x:T,y:z};for(let O of he){let L=$(p.x,p.y,O[0],O[1],O[2],O[3]),j=Math.hypot(p.x-L.x,p.y-L.y);j<Re&&(Re=j,A=L);}T=A.x,z=A.y;}else {let se=[[e,t,m,t],[m,t,m,r],[m,r,a,r]],oe=1/0,xe={x:T,y:z};for(let he of se){let Re=$(p.x,p.y,he[0],he[1],he[2],he[3]),A=Math.hypot(p.x-Re.x,p.y-Re.y);A<oe&&(oe=A,xe=Re);}T=xe.x,z=xe.y;}function $(se,oe,xe,he,Re,A){let O=Re-xe,L=A-he,j=O*O+L*L;if(j===0)return {x:xe,y:he};let J=((se-xe)*O+(oe-he)*L)/j;return J=Math.max(0,Math.min(1,J)),{x:xe+J*O,y:he+J*L}}let K=se=>{let oe=se.currentTarget.ownerSVGElement;if(!oe)return;let xe=oe.getBoundingClientRect();l({x:se.clientX-xe.left,y:se.clientY-xe.top});},ae=()=>{i(false),l(null);};return c?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:ae,onMouseMove:K,children:[jsxRuntime.jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:x,fill:"none",stroke:v,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:x,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:se=>{se.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:T,cy:z,r:9,fill:F,stroke:I,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:T-3,y1:z-3,x2:T+3,y2:z+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:T+3,y1:z-3,x2:T-3,y2:z+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:ae,onMouseMove:K,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:x,fill:"none",stroke:g?v:R,strokeWidth:g?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:w,fill:"none",stroke:g?v:R,strokeWidth:g?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:g?4:3,fill:g?v:R,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),g&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:se=>{se.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:T,cy:z,r:9,fill:F,stroke:I,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:T-3,y1:z-3,x2:T+3,y2:z+3,stroke:I,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:T+3,y1:z-3,x2:T-3,y2:z+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),c=16,g=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:g(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var 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,c=new Set,g=i=>{if(!n.has(i)){n.add(i),c.add(i);let p=r.get(i)||[];for(let l of p){if(!n.has(l)&&g(l))return true;if(c.has(l))return true}}return c.delete(i),false};return g(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=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"]],c=s.map(g=>{let i=g.startDate&&g.endDate?ve.calculateDuration(g.startDate,g.endDate):0;return [g.name,g.startDate?ve.formatDate(g.startDate):"N/A",g.endDate?ve.formatDate(g.endDate):"N/A",i>0?`${i} days`:"N/A",`${g.progress}%`,g.status||"N/A"]});r(o,{head:n,body:c,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=ve.flattenTasks(e).map(g=>{let i=g.startDate&&g.endDate?ve.calculateDuration(g.startDate,g.endDate):0;return {"Task ID":g.id,"Task Name":g.name,"Start Date":g.startDate?ve.formatDate(g.startDate):"","End Date":g.endDate?ve.formatDate(g.endDate):"","Duration (days)":i>0?i:"","Progress (%)":g.progress,Status:g.status||"",Assignees:g.assignees?.map(p=>p.name).join(", ")||"",Dependencies:g.dependencies?.join(", ")||"","Is Milestone":g.isMilestone?"Yes":"No","Parent ID":g.parentId||"",Level:g.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let c=a.utils.book_new();a.utils.book_append_sheet(c,s,"Gantt Tasks"),a.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=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,c=ve.getLatestEndDate(e)||new Date,g=r.map((f,y)=>{let k=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 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=>`
113
113
  <PredecessorLink>
114
114
  <PredecessorUID>${o.get(b)}</PredecessorUID>
115
115
  <Type>1</Type>
@@ -118,7 +118,7 @@
118
118
  <LagFormat>7</LagFormat>
119
119
  </PredecessorLink>`).join("");return `
120
120
  <Task>
121
- <UID>${k}</UID>
121
+ <UID>${x}</UID>
122
122
  <ID>${y+1}</ID>
123
123
  <Name>${f.name.replace(/[<>&'"]/g,b=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[b]||b)}</Name>
124
124
  <Type>0</Type>
@@ -201,7 +201,7 @@
201
201
  <LastSaved>${s(new Date)}</LastSaved>
202
202
  <ScheduleFromStart>1</ScheduleFromStart>
203
203
  <StartDate>${s(n)}</StartDate>
204
- <FinishDate>${s(c)}</FinishDate>
204
+ <FinishDate>${s(m)}</FinishDate>
205
205
  <FYStartDate>1</FYStartDate>
206
206
  <CriticalSlackLimit>0</CriticalSlackLimit>
207
207
  <CurrencyDigits>2</CurrencyDigits>
@@ -337,11 +337,11 @@
337
337
  </WeekDays>
338
338
  </Calendar>
339
339
  </Calendars>
340
- <Tasks>${g}
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 k=t.find(C=>C.id===y);if(k){o(k);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,c=i=>{if(n.has(i.id))return;let p=i.startDate&&i.endDate?ve.calculateDuration(i.startDate,i.endDate):0,l=t.filter(k=>k.dependencies&&k.dependencies.includes(i.id)),f=s;if(l.length>0)for(let k of l){c(k);let C=n.get(k.id)?.ls||0;f=Math.min(f,C);}let y=f-p;n.set(i.id,{ls:y,lf:f});};a.forEach(c);let g=[];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&&g.push(i.id);}}return g},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 c=ve.getLatestEndDate(e);if(!c)return null;let g=ve.calculateDuration(a.endDate,c);return Math.max(0,g)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,g)=>c-g)[0];if(!s)return null;let n=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 c=ve.calculateDuration(n.startDate,n.endDate),g;a!==void 0?(g=new Date(n.startDate),g.setDate(g.getDate()+a)):(g=new Date(r.endDate),g.setDate(g.getDate()+1));let i=ve.calculateEndDate(g,c),p=l=>l.map(f=>f.id===n.id?{...f,startDate:g,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,c)=>{if(a===0)return [];let g=[],i=o.getTime(),p=1e3*60*60*24,l=ve.findTaskById(e,t);if(!l||!l.endDate)return [];let f=(y,k,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 u=r.findIndex(T=>T.id===b.id);if(u===-1)continue;let x=b.startDate.getTime(),N=(b.endDate.getTime()-x)/p,R=(x-i)/p*s,v=R+k*s,I=Math.max(N*s,s),F=c+u*n+12;g.push({taskId:b.id,taskName:b.name,originalX:R,previewX:v,width:I,y:F,rowIndex:u,daysDelta:k,color:b.color}),f(b.id,k,C);}};return f(t,a),g},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 c=new Date(o.endDate);c.setDate(c.getDate()+r);let g=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:c}],i=p=>p.map(l=>l.id===o.id?{...l,endDate:c,segments:g}: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:c="en",templates:g,dependencyLineStyle:i="curved",onTaskClick:p,onTaskDblClick:l,onTaskContextMenu:f,onTaskDateChange:y,onDependencyCreate:k,onDependencyDelete:C}){let b=jr(),[u,x]=react.useState([]),[m,N]=react.useState(null),w=react.useCallback(A=>{N(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 j=new Date(Date.UTC(O.getUTCFullYear(),0,1));return Math.ceil(((O.getTime()-j.getTime())/864e5+1)/7)},T=A=>{let O=A.getDay();return O===0||O===6},z=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 j=L.createSVGPoint();j.x=A.clientX,j.y=A.clientY;let J=j.matrixTransform(L.getScreenCTM()?.inverse()),de=z(J.x),be=new Date(de);be.setDate(be.getDate()+1),y?.(O,de,be);},[z,y]),K=react.useMemo(()=>{let A=J=>J.map(de=>{if(de.subtasks&&de.subtasks.length>0){let be=A(de.subtasks),pe=be.filter(Ie=>Ie.startDate&&Ie.endDate);if(pe.length>0){let Ie=pe.map(Je=>Je.startDate.getTime()),Q=pe.map(Je=>Je.endDate.getTime()),Xe=new Date(Math.min(...Ie)),Ne=new Date(Math.max(...Q));return {...de,subtasks:be,startDate:Xe,endDate:Ne}}return {...de,subtasks:be}}return de}),O=(J,de=[])=>{for(let be of J)de.push(be),be.subtasks&&be.subtasks.length>0&&(be.isExpanded===void 0||be.isExpanded)&&O(be.subtasks,de);return de},L=A(e);return O(L)},[e]),ae=react.useCallback(A=>{if(!A.startDate||!A.endDate)return {x:0,width:0};let O=A.startDate.getTime(),L=A.endDate.getTime(),j=o.getTime(),J=(O-j)/(1e3*60*60*24),de=(L-O)/(1e3*60*60*24),be=J*v*n,pe=Math.max(v*n,40),Ie=Math.max(de*v*n,pe);return {x:be,width:Ie}},[o,v,n]),se=react.useMemo(()=>K.filter(A=>A.startDate&&A.endDate).map(A=>{let{x:O,width:L}=ae(A),J=K.findIndex(de=>de.id===A.id)*a+12;return {id:A.id,x:O,y:J,width:L,height:32}}),[K,ae]),oe=react.useCallback((A,O,L)=>{if(!L||O===0){x([]);return}let j=ve.calculateCascadePreview(e,A,O,K,o,v*n,a,48);x(j);},[e,K,o,v,n,a,48]),xe=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(c,{day:"numeric",month:"short"}),x:J}),O.setDate(O.getDate()+1);else if(r==="week"){let de=F(O);A.push({date:new Date(O),label:`${b.labels.week} ${de}`,x:J}),O.setDate(O.getDate()+7);}else A.push({date:new Date(O),label:O.toLocaleDateString(c,{month:"short",year:"numeric"}),x:J}),O.setMonth(O.getMonth()+1);}return A},[o,s,r,v,n,c,b.labels.week]),he=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*v*n,[o,v,n]),Re=Math.max(K.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(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}),xe.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}`)),he>=0&&he<=I&&jsxRuntime.jsx("circle",{cx:he,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(I,1e3),height:Re,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:Re,fill:t.bgPrimary}),xe.map((A,O)=>{let L=xe[O+1]?.x||I,j=T(A.date);return jsxRuntime.jsxs("g",{children:[j&&jsxRuntime.jsx("rect",{x:A.x,y:0,width:L-A.x,height:K.length*a,fill:t.bgWeekend,opacity:1}),O>0&&jsxRuntime.jsx("line",{x1:A.x,y1:0,x2:A.x,y2:K.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},O)}),K.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:j=>$(j,A),onMouseEnter:j=>{j.currentTarget.setAttribute("fill",t.accentLight),j.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:j=>{j.currentTarget.setAttribute("fill","transparent"),j.currentTarget.setAttribute("opacity","1");}},`clickable-${A.id}`),jsxRuntime.jsx("text",{x:he>0?he: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}`)}),K.map((A,O)=>{if(!A.startDate||!A.endDate)return null;let{x:L,width:j}=ae(A),J=O*a+12,de=A.subtasks&&A.subtasks.length>0&&!A.isMilestone;return A.isMilestone?jsxRuntime.jsx(es,{task:A,x:L+j/2,y:J+16,theme:t,onClick:p},A.id):de?jsxRuntime.jsxs("g",{onClick:()=>p?.(A),onContextMenu:be=>{be.preventDefault(),be.stopPropagation(),f?.(A,be);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:L,y:J,width:j,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:L,y1:J,x2:L+j,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+j,y1:J,x2:L+j,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:L,y1:J+32,x2:L+j,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),j>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:j,theme:t,dayWidth:v*n,startDate:o,templates:g,onClick:p,onDoubleClick:l,onContextMenu:f,onDateChange:y,onDependencyCreate:k,allTaskPositions:se,onDragMove:oe,onHoverChange:w},A.id)}),K.map((A,O)=>!A.dependencies||A.dependencies.length===0||!A.startDate||!A.endDate?null:A.dependencies.map(L=>{let j=K.find(Ne=>Ne.id===L);if(!j||!j.startDate||!j.endDate)return null;let J=K.findIndex(Ne=>Ne.id===L),de=ae(j),be=ae(A),pe=de.x+de.width,Ie=J*a+28,Q=be.x,Xe=O*a+28;return jsxRuntime.jsx(Zn,{x1:pe,y1:Ie,x2:Q,y2:Xe,theme:t,lineStyle:i,onDelete:()=>C?.(A.id,L)},`dep-${L}-${A.id}`)})),u.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}`)),he>=0&&he<=I&&jsxRuntime.jsx("line",{x1:he,y1:0,x2:he,y2:Re,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),m&&jsxRuntime.jsx(am,{tooltipData:m,theme:t})]})]})}var Xb=['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"})]}),Jb=()=>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"})}),Zb=()=>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"})}),Qb=()=>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"})}),eh=()=>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:c,onDependencyDelete:g}){let[i,p]=react.useState(false),[l,f]=react.useState(false),[y,k]=react.useState([]),[C,h]=react.useState(""),[b,u]=react.useState(false),[x,m]=react.useState(true),N=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:T,suggestions:z=Xb,maxHistory:$=50,persistHistory:K}=a,ae=K?.storageKey||"gantt-ai-history",se=K?.maxMessages??5;react.useEffect(()=>{if(K?.enabled)try{let O=localStorage.getItem(ae);if(O){let j=JSON.parse(O).map(J=>({...J,timestamp:new Date(J.timestamp)}));k(j.slice(-se));}}catch(O){console.warn("[GanttAIAssistant] Failed to load persisted history:",O);}},[K?.enabled,ae,se]),react.useEffect(()=>{if(K?.enabled&&y.length>0)try{let O=y.filter(L=>!L.isLoading).slice(-se);localStorage.setItem(ae,JSON.stringify(O));}catch(O){console.warn("[GanttAIAssistant] Failed to persist history:",O);}},[y,K?.enabled,ae,se]),react.useEffect(()=>{w.current&&w.current.scrollIntoView({behavior:"smooth"});},[y]),react.useEffect(()=>{i&&!l&&N.current&&setTimeout(()=>N.current?.focus(),100);},[i,l]);let oe=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&&c?.(O.dependencyFrom,O.dependencyTo);break;case "unlink_tasks":O.taskId&&O.dependencyFrom&&g?.(O.taskId,O.dependencyFrom);break}},[o,s,n,c,g]),xe=react.useCallback(async O=>{if(!O.trim()||b)return;let L={id:`user-${Date.now()}`,role:"user",content:O,timestamp:new Date};k(J=>[...J.slice(-($-1)),L]),h(""),m(false),u(true);let j={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};k(J=>[...J,j]);try{if(T){let J=await T(O,e);k(de=>{let be=de.filter(Ie=>!Ie.isLoading),pe={id:`assistant-${Date.now()}`,role:"assistant",content:J.message,timestamp:new Date,command:J};return [...be,pe]}),oe(J);}else k(J=>[...J.filter(be=>!be.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){k(de=>[...de.filter(pe=>!pe.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${J instanceof Error?J.message:"Unknown error"}`,timestamp:new Date}]);}finally{u(false);}},[b,$,T,e,oe]),he=O=>{O.preventDefault(),xe(C);},Re=O=>{h(O),N.current?.focus();};if(react.useEffect(()=>{let O=L=>{(L.metaKey||L.ctrlKey)&&L.key==="k"&&(L.preventDefault(),p(j=>!j),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=j=>{let J=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(gt,{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(Qb,{})}),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(Zb,{})})]})]}),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&&x&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:z.slice(0,4).map((O,L)=>jsxRuntime.jsx("button",{onClick:()=>Re(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(eh,{}):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:he,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:N,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(Jb,{})})]}),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]}});},[]),c=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}});},[]),g=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:g}}function lm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,g=c?n.metaKey:n.ctrlKey;if(g&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!c&&g&&n.key==="y"){n.preventDefault(),t();return}if(c&&g&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var oh={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 {...oh,...e}}var ph=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:c="comfortable",showThemeSelector:g=true,showExportButton:i=true,availableUsers:p=[],templates:l,enableAutoCriticalPath:f=true,persistExpandedState:y,persistFilter:k,aiAssistant:C,locale:h="en",customTranslations:b,showCreateTaskButton:u=false,createTaskLabel:x,onCreateTask:m,taskFilter:N,onTaskFilterChange:w,onThemeChange:R,onTaskClick:v,onTaskDblClick:I,onTaskContextMenu:F,onTaskUpdate:T,onProgressChange:z,onTaskEdit:$,onTaskAddSubtask:K,onTaskMarkIncomplete:ae,onTaskSetInProgress:se,onDependencyCreate:oe,onDependencyDelete:xe,onBeforeTaskAdd:he,onAfterTaskAdd:Re,onBeforeTaskUpdate:A,onAfterTaskUpdate:O,onBeforeTaskDelete:L,onAfterTaskDelete:j}=a,de=react.useContext(zn)?.theme,[be,pe]=react.useState(de||s||"dark"),[Ie,Q]=react.useState(n),[Xe,Ne]=react.useState(c),[Je,dt]=react.useState(1),yt=react.useCallback(()=>k?typeof k=="string"?k:"gantt-filter-state":null,[k]),[Qe,xt]=react.useState(()=>{if(!k)return "all";try{let D=typeof k=="string"?k:"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"}),Pt=N??Qe,Tt=w??xt,[Ye,B]=react.useState(()=>{if(!k)return false;try{let D=typeof k=="string"?k:"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=yt();if(D)try{let P={taskFilter:Pt,hideCompleted:Ye};localStorage.setItem(D,JSON.stringify(P));}catch(P){console.warn("[GanttBoard] Error saving filter state to localStorage:",P);}},[Pt,Ye,yt]);let[ne,Pe]=react.useState(0),[Ue,_]=react.useState(false),[ue,ze]=react.useState(null),[ce,nt]=react.useState({isOpen:false,x:0,y:0,task:null}),[et,He]=react.useState(null),[Mt,At]=react.useState(null);react.useEffect(()=>{de&&de!==be&&pe(de);},[de]),react.useEffect(()=>{s&&s!==be&&pe(s);},[s]);let Ze=react.useCallback(D=>{pe(D),R?.(D);},[R]),{state:te,setState:S,undo:Te,redo:X,canUndo:Ce,canRedo:we,clearHistory:We}=im(t,50),Oe=react.useCallback(()=>y?typeof y=="string"?y:"gantt-expanded-tasks":null,[y]),tt=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)&&(tt.current=new Map(V));}}catch(P){console.warn("[GanttBoard] Error loading expanded state from localStorage:",P);}}let Y=react.useCallback(()=>{let D=Oe();if(D)try{let P=Array.from(tt.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 re=tt.current.get(V.id),ge=re!==void 0?{...V,isExpanded:re}:V;return ge.subtasks?.length?{...ge,subtasks:D(ge.subtasks)}:ge});tt.current.size>0?S(D(t)):S(t);},[t,S]);let ye=react.useRef(t),Ke=react.useRef(true);react.useEffect(()=>{if(Ke.current){Ke.current=false,ye.current=te;return}if(!r)return;let D=JSON.stringify(ye.current),P=JSON.stringify(te);D!==P&&(ye.current=te,r(te));},[te,r]);let Be=react.useMemo(()=>Fi(h,b),[h,b]),U=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}],[]),[le,Ge]=react.useState(()=>U(Be));react.useEffect(()=>{Ge(D=>D.map(P=>({...P,label:Be.columns[P.id==="name"?"taskName":P.id]||P.label})));},[Be]);let Nt=react.useMemo(()=>le.filter(P=>P.visible).reduce((P,V)=>P+V.width,0),[le]),ct=react.useRef(le.filter(D=>D.visible).map(D=>D.id).join(","));react.useEffect(()=>{let D=le.filter(re=>re.visible),P=D.map(re=>re.id).join(","),V=ct.current;if(P!==V){let re=D.some(Ee=>Ee.id!=="name"),ge=V.includes(",");re?!ge&&re&&ze(null):ze(null),ct.current=P;}},[le]);let Dr=60,fr=.6,Ua=react.useMemo(()=>{let P=Nt+Dr,V=typeof window<"u"?window.innerWidth*fr:800,re=Math.max(P,V);return ue!==null?Math.max(200,Math.min(ue,re)):Math.max(200,P)},[ue,Nt]),M=react.useRef(null),H=react.useRef(null),Me=react.useRef(null),Ae=react.useMemo(()=>Fc(be),[be]),Ut=react.useMemo(()=>({theme:Ae,themeName:be}),[Ae,be]),me=react.useMemo(()=>dm(l),[l]),_e=react.useMemo(()=>{if(!f)return te;let D=ve.calculateCriticalPath(te),P=V=>V.map(re=>({...re,isCriticalPath:D.includes(re.id),subtasks:re.subtasks?P(re.subtasks):void 0}));return P(te)},[te,f]),ht=react.useMemo(()=>{if(Pt==="all"&&!Ye)return _e;let D=P=>{let V=[];for(let re of P){let ge=re.subtasks?.length?D(re.subtasks):void 0,Ee=false;if(Ye)Ee=re.progress<100;else switch(Pt){case "all":Ee=true;break;case "incomplete":Ee=re.progress<100;break;case "in_progress":Ee=re.progress>0&&re.progress<100;break;case "completed":Ee=re.progress===100;break}(Ee||ge&&ge.length>0)&&V.push({...re,subtasks:ge});}return V};return D(_e)},[_e,Pt,Ye]),$e=ph(Xe);lm({undo:Te,redo:X,canUndo:Ce,canRedo:we,enabled:true}),react.useImperativeHandle(o,()=>({getTask:D=>ve.findTaskById(te,D),addTask:(D,P)=>{S(V=>{if(!P)return [...V,{...D,level:0}];let re=ge=>ge.map(Ee=>Ee.id===P?{...Ee,subtasks:[...Ee.subtasks||[],{...D,parentId:P,level:(Ee.level||0)+1}],isExpanded:true}:Ee.subtasks?{...Ee,subtasks:re(Ee.subtasks)}:Ee);return re(V)});},updateTask:(D,P)=>{S(V=>{let re=ge=>ge.map(Ee=>Ee.id===D?{...Ee,...P}:Ee.subtasks?{...Ee,subtasks:re(Ee.subtasks)}:Ee);return re(V)});},deleteTask:D=>{S(P=>{let V=re=>re.filter(ge=>ge.id===D?false:(ge.subtasks&&(ge.subtasks=V(ge.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(re=>ve.splitTask(re,D,P,V));},calculateEndDate:ve.calculateEndDate,calculateDuration:ve.calculateDuration,validateDependency:(D,P)=>!ve.validateDependencies(te,D,P),getAllTasks:()=>ve.flattenTasks(te),getTasksByStatus:D=>ve.flattenTasks(te).filter(P=>P.status===D),getTasksByParent:D=>D?ve.findTaskById(te,D)?.subtasks||[]:te.filter(V=>!V.parentId),getCriticalPath:()=>ve.flattenTasks(te).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(te,D);if(he){let re=he({...V,parentId:D});if((re instanceof Promise?await re:re)===false)return}S(P),Re&&Re({...V,parentId:D});},scrollToTask:D=>{let V=ve.flattenTasks(te).findIndex(re=>re.id===D);if(V!==-1&&M.current){let re=V*$e;M.current.scrollTo({top:re,behavior:"smooth"}),H.current&&H.current.scrollTo({top:re,behavior:"smooth"});}},highlightTask:(D,P=2e3)=>{},expandTask:D=>{S(P=>{let V=re=>re.map(ge=>ge.id===D?{...ge,isExpanded:true}:ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge);return V(P)});},collapseTask:D=>{S(P=>{let V=re=>re.map(ge=>ge.id===D?{...ge,isExpanded:false}:ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge);return V(P)});},expandAll:()=>{S(D=>{let P=V=>V.map(re=>({...re,isExpanded:true,subtasks:re.subtasks?P(re.subtasks):void 0}));return P(D)});},collapseAll:()=>{S(D=>{let P=V=>V.map(re=>({...re,isExpanded:false,subtasks:re.subtasks?P(re.subtasks):void 0}));return P(D)});},undo:Te,redo:X,canUndo:()=>Ce,canRedo:()=>we,clearHistory:We,exportToPNG:async()=>{if(!Me.current||!M.current||!H.current)throw new Error("Gantt container not found");let D=Me.current,P=M.current.querySelector(".gantt-grid-scroll"),V=H.current,re=P?.scrollTop||0,ge=V.scrollTop,Ee=D.style.overflow,Bt=D.style.height;try{let mt=P?.querySelector(".gantt-taskgrid-content"),qt=V.querySelector("svg"),wa=mt?.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:Ae.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=re),V.scrollTop=ge;}},exportToPDF:async D=>{await ve.exportToPDF(te,D);},exportToExcel:async D=>{await ve.exportToExcel(te,D);},exportToJSON:()=>ve.exportToJSON(te),exportToCSV:()=>ve.exportToCSV(te),importFromJSON:D=>{let P=ve.importFromJSON(D);S(P);},getTasks:()=>te,refresh:()=>{S(D=>[...D]);},clearAll:()=>{S([]);}}),[te,Te,X,Ce,we,We,Ae,$e]);let ut=react.useCallback(D=>{Ge(P=>P.map(V=>V.id===D?{...V,visible:!V.visible}:V));},[]),ya=react.useCallback((D,P)=>{Ge(V=>V.map(re=>{if(re.id!==D)return re;let ge=re.minWidth??100,Ee=re.maxWidth??800,Bt=Math.max(ge,Math.min(Ee,P));return {...re,width:Bt}}));},[]),ka=react.useCallback(D=>{S(P=>{let V=ji(P,D),re=ge=>{for(let Ee of ge){if(Ee.id===D){tt.current.set(D,Ee.isExpanded??true);return}Ee.subtasks?.length&&re(Ee.subtasks);}};return re(V),Y(),V}),a.onTaskToggleExpand?.(D);},[a,Y]),Ft=react.useCallback((D,P)=>{if(A&&A(D,P)===false)return;let re=ve.findTaskById(te,D)?.progress,ge=Bt=>Bt.map(mt=>mt.id===D?{...mt,...P}:mt.subtasks?{...mt,subtasks:ge(mt.subtasks)}:mt);S(ge(te));let Ee=ve.findTaskById(ge(te),D);Ee&&(T?.(Ee),O?.(Ee),P.progress!==void 0&&re!==void 0&&P.progress!==re&&z?.(D,re,P.progress));},[te,T,A,O,z]),qe=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(re=>Yc(re,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))),j&&P.forEach(V=>j(V)));},[a,L,j]),bu=react.useCallback(D=>{S(P=>_i(P,D)),D.forEach(P=>a.onTaskDuplicate?.(P));},[a]),hu=react.useCallback((D,P)=>{S(V=>{let{tasks:re,newTask:ge}=Kc(V,D,P);return he&&he(ge)===false?V:(a.onTaskCreate?.(ge.parentId,ge.position||0),Re?.(ge),re)});},[a,he,Re]),yu=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]),vu=react.useCallback((D,P,V)=>{let re=D.startDate?Math.round((P.getTime()-D.startDate.getTime())/864e5):0,ge=mt=>mt.map(qt=>qt.id===D.id?{...qt,startDate:P,endDate:V,...D.segments&&{segments:D.segments}}:qt.subtasks?{...qt,subtasks:ge(qt.subtasks)}:qt),Ee=ge(te);Ee=ve.autoScheduleDependents(Ee,D.id,re),S(Ee);let Bt={...D,startDate:P,endDate:V};T?.(Bt);},[te,T]),xu=react.useCallback((D,P)=>{F?.(D,P),nt({isOpen:true,x:P.clientX,y:P.clientY,task:D});},[F]),ku=react.useCallback((D,P)=>{let V=ve.splitTask(te,D.id,P);S(V),nt({isOpen:false,x:0,y:0,task:null});},[te]),ed=react.useCallback(D=>{let P=ve.findTaskById(te,D.id)||D;I?.(P),$||He(P);},[te,I,$]),td=react.useCallback((D,P,V)=>{let re=new Map,ge=wa=>{wa.forEach(Da=>{Da.dependencies&&re.set(Da.id,Da.dependencies),Da.subtasks&&ge(Da.subtasks);});};ge(V);let Ee=re.get(P)||[];re.set(P,[...Ee,D]);let Bt=new Set,mt=new Set,qt=wa=>{if(!Bt.has(wa)){Bt.add(wa),mt.add(wa);let Da=re.get(wa)||[];for(let Ir of Da){if(!Bt.has(Ir)&&qt(Ir))return true;if(mt.has(Ir))return true}}return mt.delete(wa),false};return qt(P)},[]),ad=react.useCallback((D,P)=>{if(td(D.id,P,te)){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;"}),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.
343
343
 
344
- Task dependencies must flow in one direction only.`);return}let V=re=>re.map(ge=>{if(ge.id===P){let Ee=ge.dependencies||[];if(!Ee.includes(D.id))return {...ge,dependencies:[...Ee,D.id]}}return ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge});S(V(te)),oe?.(D.id,P);},[te,oe,td]),rd=react.useCallback((D,P)=>{let V=re=>re.map(ge=>{if(ge.id===D&&ge.dependencies){let Ee=ge.dependencies.filter(Bt=>Bt!==P);return {...ge,dependencies:Ee}}return ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge});S(V(te)),xe?.(D,P);},[te,xe]),{startDate:yn,endDate:wu}=react.useMemo(()=>{let D=te.filter(Ee=>Ee.startDate&&Ee.endDate);if(D.length===0){let Ee=new Date,Bt=new Date(Ee);Bt.setDate(Bt.getDate()-30);let mt=new Date(Ee);return mt.setDate(mt.getDate()+60),{startDate:Bt,endDate:mt}}let P=D.flatMap(Ee=>[Ee.startDate,Ee.endDate]).filter(Ee=>Ee!==void 0),V=new Date(Math.min(...P.map(Ee=>Ee.getTime()))),re=new Date(Math.max(...P.map(Ee=>Ee.getTime()))),ge=Ie==="day"?7:Ie==="week"?14:30;return V.setDate(V.getDate()-ge),re.setDate(re.getDate()+ge),{startDate:V,endDate:re}},[te,Ie]),Cu=react.useCallback(async()=>{if(!Me.current||!M.current||!H.current)return;await new Promise(eo=>setTimeout(eo,200));let D=Me.current,P=M.current.querySelector(".gantt-grid-scroll"),V=H.current,re=P?.scrollTop||0,ge=P?.scrollLeft||0,Ee=V.scrollTop,Bt=V.scrollLeft,mt=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,Au=D.querySelector('[class*="h-12"]')?.offsetHeight||48,As=Math.max(ko,to,Br),Fs=Au+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 Fu=await mm__default.default(D,{backgroundColor:Ae.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=Fu.toDataURL("image/png"),Is.click();}finally{D.style.overflow=mt,D.style.height=qt,D.style.width=Ir,P&&(P.style.overflow=wa,P.style.height="",P.scrollTop=re,P.scrollLeft=ge),V.style.overflow=Da,V.style.height="",V.style.width=vn,V.scrollTop=Ee,V.scrollLeft=Bt;}},[Ae]),Tu=react.useCallback(async()=>{await ve.exportToPDF(te);},[te]),Nu=react.useCallback(async()=>{await ve.exportToExcel(te);},[te]),Du=react.useCallback(()=>{let D=ve.exportToCSV(te),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);},[te]),Su=react.useCallback(()=>{let D=ve.exportToJSON(te),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);},[te]),Eu=react.useCallback(()=>{ve.exportToMSProject(te,"Gantt Project","project.xml");},[te]),Pu=D=>{D.preventDefault(),_(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 mt=D.scrollTop;Pe(mt),P.scrollTop=mt,requestAnimationFrame(()=>{xo.current=false;});},re=()=>{if(xo.current)return;xo.current=true;let mt=P.scrollTop;Pe(mt),D.scrollTop=mt,requestAnimationFrame(()=>{xo.current=false;});},ge=mt=>{if(Ue&&P){let wa=P.parentElement?.getBoundingClientRect()?.left||0,Da=mt.clientX-wa,Ir=200,vn=Nt+Dr,eo=window.innerWidth*fr,br=Math.max(vn,eo);Da>=Ir&&Da<=br&&ze(Da);}if(Ms&&D){let qt=mt.clientX-Wo.current.x,wa=mt.clientY-Wo.current.y;D.scrollLeft=Wo.current.scrollLeft-qt,D.scrollTop=Wo.current.scrollTop-wa;}},Ee=()=>{_(false),od(false);},Bt=mt=>{if(mt.button!==0)return;let qt=mt.target;qt.closest("[data-task-bar]")||qt.closest("[data-dependency-line]")||qt.closest("button")||qt.closest('[role="button"]')||qt.tagName==="rect"&&qt.getAttribute("data-clickable")==="true"||(od(true),Wo.current={x:mt.clientX,y:mt.clientY,scrollLeft:D.scrollLeft,scrollTop:D.scrollTop},mt.preventDefault());};return D.addEventListener("scroll",V),P.addEventListener("scroll",re),D.addEventListener("mousedown",Bt),document.addEventListener("mousemove",ge),document.addEventListener("mouseup",Ee),()=>{D.removeEventListener("scroll",V),P.removeEventListener("scroll",re),D.removeEventListener("mousedown",Bt),document.removeEventListener("mousemove",ge),document.removeEventListener("mouseup",Ee);}},[Ue,Ms,Nt]);let nd=react.useRef(false),Mu=react.useRef(null);return react.useLayoutEffect(()=>{if(nd.current||te.length===0||!H.current)return;nd.current=true,Mu.current=yn;let D=H.current,P=new Date,V=Ie==="day"?60:Ie==="week"?20:8,re=(P.getTime()-yn.getTime())/(1e3*60*60*24),ge=D.clientWidth,Bt=re*V*Je-ge/2;re>=0&&ge>0&&(D.scrollLeft=Math.max(0,Bt));},[te.length,yn,Ie,Je]),jsxRuntime.jsx(Lo.Provider,{value:Be,children:jsxRuntime.jsx(zs.Provider,{value:Ut,children:jsxRuntime.jsxs("div",{ref:Me,className:"flex flex-col h-full w-full",style:{backgroundColor:Ae.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Gn,{theme:Ae,timeScale:Ie,onTimeScaleChange:Q,zoom:Je,onZoomChange:dt,currentTheme:be,onThemeChange:Ze,rowDensity:Xe,onRowDensityChange:Ne,showThemeSelector:g,showCreateTaskButton:u,createTaskLabel:x,onCreateTask:m,taskFilter:Pt,onTaskFilterChange:Tt,hideCompleted:Ye,onHideCompletedChange:B,onExportPNG:i?Cu:void 0,onExportPDF:i?Tu:void 0,onExportExcel:i?Nu:void 0,onExportCSV:i?Du:void 0,onExportJSON:i?Su:void 0,onExportMSProject:i?Eu: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:ht,theme:Ae,rowHeight:$e,availableUsers:p,templates:me,onTaskClick:v,onTaskDblClick:ed,onTaskContextMenu:F,onTaskToggle:ka,scrollTop:ne,columns:le,onToggleColumn:ut,onColumnResize:ya,onTaskUpdate:Ft,onTaskIndent:qe,onTaskOutdent:Yt,onTaskMove:Lr,onMultiTaskDelete:Es,onTaskDuplicate:bu,onTaskCreate:hu,onTaskRename:yu,onCreateSubtask:Ps,onOpenTaskModal:v?D=>v(D):void 0,onDeleteRequest:(D,P)=>At({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:Ae.border,zIndex:15},onMouseDown:Pu}),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:ht,theme:Ae,rowHeight:$e,timeScale:Ie,startDate:yn,endDate:wu,zoom:Je,locale:h,templates:me,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:v,onTaskDblClick:ed,onTaskContextMenu:xu,onTaskDateChange:vu,onDependencyCreate:ad,onDependencyDelete:rd})})]}),ce.task&&jsxRuntime.jsx(Io,{isOpen:ce.isOpen,x:ce.x,y:ce.y,theme:Ae,onClose:()=>nt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let D=ce.task;if(!D)return [];let P=ve.findTaskById(te,D.id)||D;return P.subtasks&&P.subtasks.length>0?[{id:"addSubtask",label:Be.contextMenu?.addSubtask||"Add Subtask",icon:_t.Add,onClick:()=>{K?K(P):Ps(P.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Be.contextMenu?.deleteTask||"Delete Task",icon:_t.Delete,onClick:()=>{At({taskId:P.id,taskName:P.name});}}]:[{id:"edit",label:Be.contextMenu?.editTask||"Edit Task",icon:_t.Pencil,onClick:()=>{$?$(P):He(P);}},{id:"addSubtask",label:Be.contextMenu?.addSubtask||"Add Subtask",icon:_t.Add,onClick:()=>{K?K(P):Ps(P.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:Be.contextMenu?.markIncomplete||"Mark Incomplete",icon:_t.MarkIncomplete,onClick:()=>{ae?ae(P):Ft(P.id,{status:"todo",progress:0});},disabled:P.status==="todo"},{id:"setInProgress",label:Be.contextMenu?.setInProgress||"Set In Progress",icon:_t.SetInProgress,onClick:()=>{se?se(P):Ft(P.id,{status:"in-progress"});},disabled:P.status==="in-progress"},{id:"markComplete",label:Be.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:Be.contextMenu?.splitTask||"Split Task",icon:_t.Split,onClick:()=>{if(!P.startDate||!P.endDate){console.warn("Cannot split task without dates");return}let re=P.startDate.getTime(),ge=P.endDate.getTime(),Ee=re+(ge-re)/2,Bt=new Date(Ee);ku(P,Bt);},disabled:!P.startDate||!P.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Be.contextMenu?.deleteTask||"Delete Task",icon:_t.Delete,onClick:()=>{At({taskId:P.id,taskName:P.name});}}]})()}),jsxRuntime.jsx(lo,{task:et,isOpen:!!et,onClose:()=>He(null),onTaskUpdate:D=>{et&&(Ft(et.id,D),He(null));},theme:be==="light"?"light":"dark",locale:h==="es"?"es":"en",availableUsers:p,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Mt&&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:()=>At(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:Ae.bgSecondary,border:`1px solid ${Ae.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Ae.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:Ae.textPrimary,fontFamily:"Inter, sans-serif"},children:[Be.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Ae.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:Ae.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:Ae.textPrimary},children:['"',Mt.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Ae.bgPrimary,borderTop:`1px solid ${Ae.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>At(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Ae.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor=Ae.hoverBg;},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:h==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Es([Mt.taskId]),At(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:te,theme:Ae,config:C,onTasksUpdate:S,onTaskUpdate:Ft,onTaskCreate:D=>{S(P=>[...P,D]);},onTaskDelete:D=>{Es([D]);},onDependencyCreate:(D,P)=>{let V=ve.findTaskById(te,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:c=a?"edit":"create",theme:g="dark",customStatuses:i=[],availableTags:p=[],onCreateTag:l,attachments:f=[],onUploadAttachments:y,onDeleteAttachment:k}){let C=[...Zi,...i.filter(B=>!Zi.some(ne=>ne.id===B.id))],h=at[g]||at.dark,[b,u]=react.useState(false),[x,m]=react.useState(false),[N,w]=react.useState(false),[R,v]=react.useState(false),[I,F]=react.useState({top:0,left:0}),[T,z]=react.useState(null),[$,K]=react.useState(new Date),[ae,se]=react.useState({top:0,left:0}),[oe,xe]=react.useState(false),[he,Re]=react.useState([]),[A,O]=react.useState(false),[L,j]=react.useState(""),J=react.useRef(null),de=react.useRef(null),be=react.useRef(null),pe=react.useRef(null),Ie=react.useRef(null),[Q,Xe]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Ne,Je]=react.useState({});react.useEffect(()=>{a?(Xe({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&xe(true)):(Xe({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),xe(false),Re([]));},[a,e]),react.useEffect(()=>{let B=ne=>{J.current&&!J.current.contains(ne.target)&&u(false),de.current&&!de.current.contains(ne.target)&&m(false),be.current&&!be.current.contains(ne.target)&&w(false),pe.current&&!pe.current.contains(ne.target)&&v(false);};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);let dt=()=>{let B={};return Q.name.trim()||(B.name="El nombre es requerido"),Q.startDate&&Q.endDate&&Q.startDate>Q.endDate&&(B.endDate="La fecha de fin debe ser posterior a la de inicio"),Je(B),Object.keys(B).length===0},yt=async B=>{if(B.preventDefault(),!!dt())try{let ne=c==="create"&&he.length>0?{...Q,pendingFiles:he}:Q;await s(ne),Re([]),t();}catch(ne){console.error("Error submitting task:",ne);}},Qe=(B,ne)=>{Xe(Pe=>{let Ue={...Pe,[B]:ne};if(B==="status"){let _=ne;_==="todo"?Ue.progress=0:_==="in-progress"?(Pe.progress===0||Pe.progress===100)&&(Ue.progress=50):_==="completed"||_==="closed"?Ue.progress=100:(_==="in-review"||_==="review")&&(Ue.progress=75);}if(B==="progress"){let _=typeof ne=="number"?ne:parseInt(ne,10);_===100&&Pe.status!=="completed"?Ue.status="completed":_>0&&_<100&&Pe.status==="todo"?Ue.status="in-progress":_===0&&Pe.status!=="todo"&&(Ue.status="todo");}return Ue}),Ne[B]&&Je(Pe=>{let Ue={...Pe};return delete Ue[B],Ue});},xt=C.find(B=>B.id===Q.status)??Zi[0],Pt=Qi.find(B=>B.id===Q.priority)??Qi[1],Tt=yr.find(B=>B.value===Q.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":g,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:xt.color||h.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:h.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:h.textTertiary},onMouseEnter: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:yt,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:Q.name,onChange:B=>Qe("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}),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:Q.description||"",onChange:B=>Qe("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&&u(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...Ye,borderColor:xt.color,backgroundColor:`${xt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:xt.color}}),jsxRuntime.jsx("span",{style:{color:xt.color},children:xt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:xt.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:ne=>ne.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:ne=>ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{Qe("status",B.id),u(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:B.color}}),B.title,Q.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:de,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&m(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ye,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:Pt.color}}),jsxRuntime.jsx("span",{children:Pt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},children:Qi.map(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:ne=>ne.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:ne=>ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{Qe("priority",B.id),m(false);},children:[jsxRuntime.jsx("span",{children:B.icon}),B.label,Q.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:be,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!N),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ye,disabled:n,children:[Q.assignees&&Q.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:Q.assignees.slice(0,3).map((B,ne)=>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},ne))}),Q.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:h.textTertiary},children:["+",Q.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:h.textTertiary}}),jsxRuntime.jsx("span",{style:{color:h.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},children:o.map(B=>{let ne=Q.assignees?.some(Pe=>Pe.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:Pe=>Pe.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:Pe=>Pe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let Pe=ne?(Q.assignees||[]).filter(Ue=>Ue.name!==B.name):[...Q.assignees||[],{name:B.name,avatar:B.avatar,initials:B.name.split(" ").map(Ue=>Ue[0]).join("").toUpperCase().slice(0,2),color:h.accent}];Qe("assignees",Pe);},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:ne&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:h.accent}})})]},B.id)})})})]}),jsxRuntime.jsxs("div",{ref:pe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(R)v(false);else {if(pe.current){let B=pe.current.getBoundingClientRect(),ne=window.innerHeight,Pe=120,_=ne-B.bottom<Pe?B.top-Pe-8:B.bottom+8;F({top:_,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:Q.color}}),jsxRuntime.jsx("span",{children:Tt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&jsxRuntime.jsxs(gt,{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 ne=Q.color===B.value;return jsxRuntime.jsx("button",{type:"button",onClick:Pe=>{Pe.preventDefault(),Pe.stopPropagation(),Qe("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:ne?`2px solid ${B.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},B.value)})})})})]})})]}),p.length>0||l?jsxRuntime.jsx(hr,{selectedTags:Q.tags||[],availableTags:p,onChange:B=>Qe("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:Ie,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!Q.isMilestone)if(T==="start")z(null);else {if(Ie.current){let B=Ie.current.getBoundingClientRect(),ne=window.innerHeight,Pe=320,_=ne-B.bottom<Pe?B.top-Pe-8:B.bottom+8;se({top:_,left:B.left});}z("start"),K(Q.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ye,opacity:Q.isMilestone?.5:1,cursor:Q.isMilestone?"not-allowed":"pointer"},disabled:n||Q.isMilestone,children:Q.startDate?Q.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&&!Q.isMilestone)if(T==="end")z(null);else {if(Ie.current){let B=Ie.current.getBoundingClientRect(),ne=window.innerHeight,Pe=320,_=ne-B.bottom<Pe?B.top-Pe-8:B.bottom+8;se({top:_,left:B.left});}z("end"),K(Q.endDate||Q.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ye,opacity:Q.isMilestone?.5:1,cursor:Q.isMilestone?"not-allowed":"pointer"},disabled:n||Q.isMilestone,children:Q.endDate?Q.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(gt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>z(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:`${ae.top}px`,left:`${ae.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,ne=new Date(B);ne.setDate(B.getDate()+1);let Pe=new Date(B);Pe.setDate(B.getDate()+7);let Ue=new Date(B);return Ue.setDate(B.getDate()+14),[{label:"Hoy",date:B},{label:"Ma\xF1ana",date:ne},{label:"Pr\xF3xima semana",date:Pe},{label:"2 semanas",date:Ue}].map((ue,ze)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:h.textPrimary},onMouseEnter:ce=>ce.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{T==="start"?(Qe("startDate",ue.date),(!Q.endDate||ue.date>Q.endDate)&&Qe("endDate",ue.date),z("end")):(Qe("endDate",ue.date),(!Q.startDate||ue.date<Q.startDate)&&Qe("startDate",ue.date),z(null));},children:ue.label},ze))})(),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:()=>{Qe("startDate",void 0),Qe("endDate",void 0),z(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>K(new Date($.getFullYear(),$.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color: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:()=>K(new Date($.getFullYear(),$.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:h.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((B,ne)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:h.textTertiary},children:B},ne))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let B=$.getFullYear(),ne=$.getMonth(),Pe=new Date(B,ne,1).getDay(),Ue=new Date(B,ne+1,0).getDate(),_=new Date,ue=[];for(let ce=Pe-1;ce>=0;ce--)ue.push({day:new Date(B,ne,-ce).getDate(),date:new Date(B,ne-1,new Date(B,ne,-ce).getDate()),isCurrentMonth:false});for(let ce=1;ce<=Ue;ce++)ue.push({day:ce,date:new Date(B,ne,ce),isCurrentMonth:true});let ze=42-ue.length;for(let ce=1;ce<=ze;ce++)ue.push({day:ce,date:new Date(B,ne+1,ce),isCurrentMonth:false});return ue.map((ce,nt)=>{let et=ce.date.toDateString()===_.toDateString(),He=Q.startDate?.toDateString()===ce.date.toDateString(),Mt=Q.endDate?.toDateString()===ce.date.toDateString(),At=Q.startDate&&Q.endDate&&ce.date>=Q.startDate&&ce.date<=Q.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:ce.isCurrentMonth?He||Mt?"#FFF":h.textPrimary:h.textTertiary,backgroundColor:He?"#3B82F6":Mt?"#7C3AED":At?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:et&&!He&&!Mt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{T==="start"?(Qe("startDate",ce.date),Q.endDate&&ce.date>Q.endDate&&Qe("endDate",ce.date),z("end")):(Qe("endDate",ce.date),Q.startDate&&ce.date<Q.startDate&&Qe("startDate",ce.date),z(null));},children:ce.day},nt)})})()})]})]})]})})]}),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:Q.progress,onChange:B=>Qe("progress",parseInt(B.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:h.bgSecondary,accentColor:Q.progress<30?"#EF4444":Q.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:`${Q.progress<30?"#EF4444":Q.progress<70?"#F59E0B":"#10B981"}20`,color:Q.progress<30?"#EF4444":Q.progress<70?"#F59E0B":"#10B981"},children:[Q.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>xe(!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||f.length>0||c==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:h.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:h.textTertiary},children:["Adjuntos ",c==="create"?he.length>0&&`(${he.length})`:f.length>0&&`(${f.length})`]})]}),c==="create"?jsxRuntime.jsx(kr,{cardId:"pending",attachments:he.map((B,ne)=>({id:`pending-${ne}`,cardId:"pending",name:B.name,size:B.size,type:B.type,url:URL.createObjectURL(B),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:B=>Re(ne=>[...ne,...B]),onDelete:B=>{let ne=parseInt(B.replace("pending-",""),10);Re(Pe=>Pe.filter((Ue,_)=>_!==ne));},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:k,maxSizeMB:10,maxFiles:20}),c==="create"&&he.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:h.textTertiary},children:[he.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:Q.isMilestone,onChange:B=>Qe("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"]}),Q.dependencies&&Q.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:Q.dependencies.map(B=>{let ne=r.find(Pe=>Pe.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:[ne?.name||B.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let Pe=(Q.dependencies||[]).filter(Ue=>Ue!==B);Qe("dependencies",Pe);},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),j("");},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),j("");}}),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=>j(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 ne=Q.dependencies?.includes(B.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let Pe=Q.dependencies||[],Ue;ne?Ue=Pe.filter(_=>_!==B.id):Ue=[...Pe,B.id],Qe("dependencies",Ue);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:ne?`${h.accent}10`:"transparent"},onMouseEnter:Pe=>{ne||(Pe.currentTarget.style.backgroundColor=h.hoverBg);},onMouseLeave:Pe=>{Pe.currentTarget.style.backgroundColor=ne?`${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:ne?h.accent:"transparent",borderColor:ne?h.accent:h.borderLight},children:ne&&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:c==="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=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.
345
345
 
346
346
  AVAILABLE COMMANDS:
347
347
  1. move_task - Move a task to a different date
@@ -386,7 +386,7 @@ If ambiguous, ask for clarification in the message field.`;function ym(e){return
386
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(`
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(c=>c.name.toLowerCase()===r);if(o)return o;let s=a.find(c=>c.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(c=>{let g=c.name.toLowerCase();return n.every(i=>g.includes(i))})}function 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 k=new Date(r),C=k.getDay(),h=y-C;return h<=0&&(h+=7),k.setDate(k.getDate()+h),k}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let f=parseInt(s[1],10),y=s[2].toLowerCase(),k=new Date(r);return y==="day"||y==="d\xEDa"||y==="dias"?k.setDate(k.getDate()+f):y==="week"||y==="semana"||y==="semanas"?k.setDate(k.getDate()+f*7):(y==="month"||y==="mes"||y==="meses")&&k.setMonth(k.getMonth()+f),k}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let f=parseInt(c[1],10),y=parseInt(c[2],10)-1,k=parseInt(c[3],10);return new Date(k,y,f)}let g={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let f=parseInt(i[1],10),y=g[i[2].toLowerCase()],k=i[3]?parseInt(i[3],10):r.getFullYear();if(y!==void 0)return new Date(k,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),k=l[3]?parseInt(l[3],10):r.getFullYear();if(f!==void 0)return new Date(k,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,k=new Date(f);return k.setDate(k.getDate()+y),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:f,endDate:k},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 c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let i=c[1].trim(),p=c[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 g=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(g&&g[1]){let i=g[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 Ch(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 Th(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},c=n(e.startDate),g=n(e.endDate),i=e.metadata?.isMilestone===true||c&&g&&Math.abs(g.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:g,progress:e.progress||0,status:Ch(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:Th(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),c=react.useRef(null);react.useEffect(()=>{let f=y=>{c.current&&!c.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]);let g=sl[0],i=sl.find(f=>f.value===e)??g,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:c,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:k=>{k.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),c=react.useRef(null);react.useEffect(()=>{let p=l=>{c.current&&!c.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let g=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",g.color)}),jsxRuntime.jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:g.label[i]})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick: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",g.color)}),jsxRuntime.jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:g.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:d("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children: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,c]=react.useState(false),[g,i]=react.useState(""),p=react.useRef(null);react.useEffect(()=>{let k=C=>{p.current&&!p.current.contains(C.target)&&(c(false),i(""));};return n&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[n]);let l=t.filter(k=>k.name.toLowerCase().includes(g.toLowerCase())||k.email?.toLowerCase().includes(g.toLowerCase())),f=k=>e.some(C=>C.name===k),y=k=>{if(a)if(f(k.name))a(e.filter(C=>C.name!==k.name));else {let C={name:k.name,initials:ms(k.name),color:k.color||ps(k.name).replace("bg-","").replace("-500",""),avatar:k.avatarUrl};a([...e,C]);}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:d("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((k,C)=>jsxRuntime.jsx("div",{className:d("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!k.avatar&&ps(k.name)),style:k.color&&!k.avatar?{backgroundColor:k.color}:void 0,title:k.name,children:k.avatar?jsxRuntime.jsx("img",{src:k.avatar,alt:k.name,className:"w-full h-full rounded-full object-cover"}):k.initials||ms(k.name)},`${k.name}-${C}`)),e.length>3&&jsxRuntime.jsxs("div",{className:d("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:p,className:"relative",children:[jsxRuntime.jsx("button",{onClick:k=>{k.stopPropagation(),c(!n);},className:d("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:d("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:d("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((k,C)=>jsxRuntime.jsx("div",{className:d("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!k.avatar&&ps(k.name)),style:k.color&&!k.avatar?{backgroundColor:k.color}:void 0,children:k.avatar?jsxRuntime.jsx("img",{src:k.avatar,alt:k.name,className:"w-full h-full rounded-full object-cover"}):k.initials||ms(k.name)},`${k.name}-${C}`)),e.length>2&&jsxRuntime.jsxs("span",{className:d("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:d("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-64",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsxRuntime.jsx("input",{type:"text",value:g,onChange:k=>i(k.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:d("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:k=>k.stopPropagation()})}),jsxRuntime.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:l.length===0?jsxRuntime.jsx("p",{className:d("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):l.map(k=>jsxRuntime.jsxs("button",{onClick:C=>{C.stopPropagation(),y(k);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:d("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!k.avatarUrl&&ps(k.name)),children:k.avatarUrl?jsxRuntime.jsx("img",{src:k.avatarUrl,alt:k.name,className:"w-full h-full rounded-full object-cover"}):ms(k.name)}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:r?"text-white":"text-gray-900",children:k.name}),k.email&&jsxRuntime.jsx("div",{className:d("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:k.email})]}),f(k.name)&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},k.id))}),e.length>0&&jsxRuntime.jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((k,C)=>jsxRuntime.jsxs("span",{className:d("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[k.name,jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),a(e.filter(b=>b.name!==k.name));},className:"hover:text-red-500",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},`${k.name}-${C}`))})]})]})}var Yh={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"]},qh={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),[c,g]=react.useState(()=>{if(e){let h=e instanceof Date?e:new Date(e);return new Date(h.getFullYear(),h.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),i=react.useRef(null),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(),k=(h,b)=>new Date(h,b,1).getDay(),C=()=>{let h=c.getFullYear(),b=c.getMonth(),u=y(h,b),x=k(h,b),m=new Date,N=[];for(let w=0;w<x;w++)N.push(jsxRuntime.jsx("div",{className:"w-8 h-8"},`empty-${w}`));for(let w=1;w<=u;w++){let R=new Date(h,b,w),v=p&&p.getDate()===w&&p.getMonth()===b&&p.getFullYear()===h,I=m.getDate()===w&&m.getMonth()===b&&m.getFullYear()===h;N.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 N};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(),g(new Date(c.getFullYear(),c.getMonth()-1,1));},className:d("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:d("w-4 h-4",a?"text-white":"text-gray-600")})}),jsxRuntime.jsxs("span",{className:d("text-sm font-medium",a?"text-white":"text-gray-900"),children:[Yh[l][c.getMonth()]," ",c.getFullYear()]}),jsxRuntime.jsx("button",{onClick:h=>{h.stopPropagation(),g(new Date(c.getFullYear(),c.getMonth()+1,1));},className:d("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:d("w-4 h-4",a?"text-white":"text-gray-600")})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:qh[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(),c=s.clientX-n.left,g=Math.round(c/n.width*100),i=Math.max(0,Math.min(100,g));t(i);},className:d("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:d("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxRuntime.jsxs("span",{className:d("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function Rm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[c,g]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{g(e);},[e]);let p=()=>{c!==e&&t?.(c),n(false);},l=f=>{f.key==="Enter"?p():f.key==="Escape"&&(g(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:d("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:c,onChange:f=>g(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[c,g]=react.useState(false),[i,p]=react.useState(e?.toString()||""),l=react.useRef(null);react.useEffect(()=>{c&&l.current&&(l.current.focus(),l.current.select());},[c]),react.useEffect(()=>{p(e?.toString()||"");},[e]);let f=()=>{let k=parseFloat(i);if(!isNaN(k)){let C=k;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&t?.(C);}g(false);},y=k=>{k.key==="Enter"?f():k.key==="Escape"&&(p(e?.toString()||""),g(false));};return n||!t?jsxRuntime.jsx("span",{className:d("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:e!==void 0?e:r}):c?jsxRuntime.jsx("input",{ref:l,type:"number",value:i,onChange:k=>p(k.target.value),onBlur:f,onKeyDown:y,onClick:k=>k.stopPropagation(),min:o,max:s,className:d("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:k=>{k.stopPropagation(),g(true);},className:d("text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",e===void 0&&(a?"text-[#6B7280]":"text-gray-400")),children:e!==void 0?e:r})}function zm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,c]=react.useState(false),g=react.useRef(null);return react.useEffect(()=>{let i=p=>{g.current&&!g.current.contains(p.target)&&c(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:d("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:g,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),c(!n);},className:d("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:d("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:d("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:d("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),a(i),c(false);},className:d("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function 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 hy(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function yy(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:c,onColumnHide:g,onColumnSort:i,availableUsers:p=[]}){let l=react.useRef(null),f=r==="es"?Km.es:Km.en;if(react.useEffect(()=>{let b=x=>{l.current&&!l.current.contains(x.target)&&t();},u=x=>{x.key==="Escape"&&t();};return document.addEventListener("mousedown",b),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",u);}},[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}),c&&(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:()=>{c({...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:()=>{c({...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:()=>{c({...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:()=>{c({...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:()=>{c({...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:()=>{c({...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:()=>{c({...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(u=>({id:`assign-${u.id}`,label:u.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:u.name.charAt(0).toUpperCase()}),onClick:()=>{let x=e.task.assignees||[],N=x.some(w=>w.name===u.name)?x.filter(w=>w.name!==u.name):[...x,{name:u.name,initials:hy(u.name),color:u.color||yy(u.name),avatar:u.avatarUrl}];c({...e.task,assignees:N}),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},k=()=>{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();}})),g&&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:()=>{g(e.columnId),t();}})),b},C=e.type==="task"?y():k(),h={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:l,style:h,className:d("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#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(vy,{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 vy({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(c=>jsxRuntime.jsxs("button",{onClick:c.onClick,className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:c.icon}),c.label]},c.id))})]})}var 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"})},By=["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:c}){let[g,i]=react.useState(""),p=react.useRef(null),l=c==="es"?Qm.es:Qm.en;if(react.useEffect(()=>{if(!e)return;let b=setTimeout(()=>{let u=m=>{p.current&&!p.current.contains(m.target)&&t();},x=m=>{m.key==="Escape"&&t();};document.addEventListener("mousedown",u),document.addEventListener("keydown",x),p._cleanup=()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",x);};},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 u=a.map(x=>x.id===b?{...x,visible:!x.visible}:x);o(u);},k=(b,u)=>{let x=a.find(N=>N.type===b&&(!u||N.customFieldId===u));if(x){y(x.id);return}let m={id:u||b,type:b,label:u?r.find(N=>N.id===u)?.name||b:f(b),width:120,visible:true,sortable:true,resizable:true,customFieldId:u};o([...a,m]);},C=By.filter(b=>f(b).toLowerCase().includes(g.toLowerCase())),h=r.filter(b=>b.name.toLowerCase().includes(g.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:g,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 u=a.find(N=>N.type===b&&!N.customFieldId),x=u?.visible??false,m=b==="name";return jsxRuntime.jsxs("button",{onClick:()=>{m||(u?y(u.id):k(b));},disabled:m,className:d("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",m&&"opacity-50 cursor-not-allowed"),children:[jsxRuntime.jsx("div",{className:d("w-5 h-5 rounded border flex items-center justify-center",x?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children: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 x=a.find(m=>m.customFieldId===b.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>k(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",x?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children: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 _y=[{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(""),[c,g]=react.useState("text"),[i,p]=react.useState([""]),l=o==="es"?ap.es:ap.en;react.useEffect(()=>{e&&(n(""),g("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:c};c==="dropdown"&&(h.options=i.filter(b=>b.trim())),a(h),t();},y=()=>{p([...i,""]);},k=(h,b)=>{let u=[...i];u[h]=b,p(u);},C=h=>{i.length>1&&p(i.filter((b,u)=>u!==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:_y.map(h=>jsxRuntime.jsxs("button",{onClick:()=>g(h.type),className:d("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",c===h.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:c===h.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:h.icon}),jsxRuntime.jsx("span",{className:d("text-xs",c===h.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:l.types[h.type]})]},h.type))})]}),c==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:d("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((h,b)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:h,onChange:u=>k(b,u.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,c]=react.useState(false),g=react.useRef(null),i=s==="es"?np.es:np.en;react.useEffect(()=>{if(!n)return;let f=setTimeout(()=>{let y=C=>{g.current&&!g.current.contains(C.target)&&c(false);},k=C=>{C.key==="Escape"&&c(false);};document.addEventListener("mousedown",y),document.addEventListener("keydown",k),g._cleanup=()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",k);};},100);return ()=>{clearTimeout(f),g._cleanup&&g._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:g,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),c(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,k=()=>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:k()}),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 dp(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(...dp(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 cp({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:c=[],customFields:g=[]}){let{theme:i="dark",locale:p="en",customTranslations:l,showSearch:f=true,showHierarchy:y=true,tableColumns:k,allowColumnCustomization:C=true,allowColumnResize:h=true,enableContextMenu:b=true}=t,u=ls(p,l),x=i==="dark",[m,N]=react.useState("startDate"),[w,R]=react.useState("asc"),[v,I]=react.useState(""),[F,T]=react.useState("all"),[z,$]=react.useState(false),[K,ae]=react.useState(k||cv),[se,oe]=react.useState(false),[xe,he]=react.useState(false),[Re,A]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[O,L]=react.useState(null),[j,J]=react.useState(0),[de,be]=react.useState(0),pe=react.useRef(null);react.useEffect(()=>{k&&ae(k);},[k]);let Ie=react.useMemo(()=>{let _=new Set;function ue(ze){for(let ce of ze)ce.subtasks?.length&&(ce.isExpanded!==false&&_.add(ce.id),ue(ce.subtasks));}return ue(e),_},[e]),Q=react.useMemo(()=>K.filter(_=>_.visible),[K]),Xe=react.useCallback(_=>{a.onTaskToggleExpand?.(_);},[a]),Ne=react.useCallback(_=>{m===_?R(ue=>ue==="asc"?"desc":"asc"):(N(_),R("asc")),a.onSortChange?.({column:_,direction:w==="asc"?"desc":"asc"});},[m,w,a]),Je=react.useCallback(_=>{ae(_),a.onColumnsChange?.(_);},[a]),dt=react.useCallback(_=>{let ue=K.map(ze=>ze.id===_?{...ze,visible:false}:ze);Je(ue);},[K,Je]),yt=react.useCallback((_,ue)=>{N(_),R(ue);},[]),Qe=react.useCallback((_,ue,ze)=>{b&&(_.preventDefault(),A({isOpen:true,x:_.clientX,y:_.clientY,type:ue?"task":"header",task:ue,columnId:ze}));},[b]),xt=react.useCallback(()=>{A(_=>({..._,isOpen:false}));},[]),Pt=react.useCallback((_,ue)=>{if(!h)return;_.preventDefault(),_.stopPropagation();let ze=K.find(ce=>ce.id===ue);ze&&(L(ue),J(_.clientX),be(ze.width));},[K,h]);react.useEffect(()=>{if(!O)return;let _=ze=>{let ce=ze.clientX-j,nt=Math.max(50,de+ce),et=K.map(He=>He.id===O?{...He,width:nt}:He);ae(et);},ue=()=>{O&&a.onColumnsChange?.(K),L(null);};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",ue),()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",ue);}},[O,j,de,K,a]);let Tt=react.useCallback(async _=>{if(a.onCreateCustomField){let ue={..._,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(ue);}he(false);},[a]),Ye=react.useCallback(_=>_.progress===100||_.status==="completed"?"completed":_.progress&&_.progress>0||_.status==="in-progress"?"in-progress":"todo",[]),B=react.useMemo(()=>{let _=dp(e);if(v.trim()){let ue=v.toLowerCase();_=_.filter(ze=>ze.name.toLowerCase().includes(ue));}return F!=="all"&&(_=_.filter(ue=>Ye(ue)===F)),z&&(_=_.filter(ue=>Ye(ue)!=="completed")),_.sort((ue,ze)=>{let ce,nt;switch(m){case "name":ce=ue.name.toLowerCase(),nt=ze.name.toLowerCase();break;case "startDate":ce=ue.startDate?.getTime()||0,nt=ze.startDate?.getTime()||0;break;case "endDate":ce=ue.endDate?.getTime()||0,nt=ze.endDate?.getTime()||0;break;case "progress":ce=ue.progress||0,nt=ze.progress||0;break;case "status":ce=ue.status||"todo",nt=ze.status||"todo";break;case "priority":let et={urgent:0,high:1,medium:2,low:3,none:4};ce=et[ue.priority]??4,nt=et[ze.priority]??4;break;default:return 0}return ce<nt?w==="asc"?-1:1:ce>nt?w==="asc"?1:-1:0}),_},[e,v,F,z,m,w,Ye]),ne=react.useCallback((_,ue)=>{let ze=et=>{a.onTaskUpdate?.({..._,...et});},ce=et=>et?_.customFields?.find(Mt=>Mt.fieldId===et)?.value:void 0,nt=(et,He)=>{if(!et)return;let At=[..._.customFields||[]],Ze=At.findIndex(te=>te.fieldId===et);Ze>=0?At[Ze]={fieldId:et,value:He}:At.push({fieldId:et,value:He}),ze({customFields:At});};switch(ue.type){case "name":return null;case "status":return jsxRuntime.jsx(Nm,{value:_.status||(_.progress===100?"completed":_.progress&&_.progress>0?"in-progress":"todo"),onChange:He=>{ze({status:He,progress:He==="completed"?100:He==="in-progress"?50:0});},isDark:x,locale:p,translations:u.status});case "priority":return jsxRuntime.jsx(Sm,{value:_.priority,onChange:He=>ze({priority:He}),isDark:x,locale:p});case "assignees":return jsxRuntime.jsx(Pm,{value:_.assignees||[],availableUsers:c,onChange:He=>ze({assignees:He}),isDark:x,locale:p});case "startDate":return jsxRuntime.jsx(us,{value:_.startDate,onChange:He=>ze({startDate:He}),isDark:x,locale:p});case "endDate":return jsxRuntime.jsx(us,{value:_.endDate,onChange:He=>ze({endDate:He}),isDark:x,locale:p});case "progress":return jsxRuntime.jsx(Lm,{value:_.progress||0,onChange:He=>{let Mt=He===100?"completed":He>0?"in-progress":"todo";ze({progress:He,status:Mt});},isDark:x});case "tags":return jsxRuntime.jsx(Vm,{value:_.tags||[],isDark:x});case "text":return jsxRuntime.jsx(Rm,{value:ce(ue.customFieldId)||"",onChange:He=>nt(ue.customFieldId,He),isDark:x});case "number":return jsxRuntime.jsx(Um,{value:ce(ue.customFieldId)||0,onChange:He=>nt(ue.customFieldId,He),isDark:x});case "date":let et=ce(ue.customFieldId);return jsxRuntime.jsx(us,{value:et?new Date(et):void 0,onChange:He=>nt(ue.customFieldId,He),isDark:x,locale:p});case "dropdown":return jsxRuntime.jsx(zm,{value:ce(ue.customFieldId)||"",options:ue.options||[],onChange:He=>nt(ue.customFieldId,He),isDark:x});case "checkbox":return jsxRuntime.jsx(Wm,{value:ce(ue.customFieldId)||false,onChange:He=>nt(ue.customFieldId,He),isDark:x});default:return jsxRuntime.jsx("span",{className:d("text-sm",x?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,x,p,c,u]),Pe=react.useCallback(_=>({name:u.columns.name,status:u.columns.status,priority:u.columns.priority,assignees:u.columns.assignees,startDate:u.columns.startDate,endDate:u.columns.endDate,progress:u.columns.progress})[_.type]||_.label,[u]),Ue=react.useMemo(()=>Q.reduce((_,ue)=>_+ue.width,0)+(C?48:0),[Q,C]);return r?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:d("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[u.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:d("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:d("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:d("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:u.empty.noTasks}),jsxRuntime.jsx("p",{className:d("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:u.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:pe,className:d("flex-1 flex flex-col w-full h-full overflow-hidden",x?"bg-[#0F1117]":"bg-white",O&&"select-none",s),style:n,children:[jsxRuntime.jsx("div",{className:d("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(sp,{value:F,hideCompleted:z,onChange:T,onHideCompletedChange:$,isDark:x,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",x?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:v,onChange:_=>I(_.target.value),placeholder:u.toolbar.searchPlaceholder,className:d("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",x?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsxs("div",{className:d("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[B.length," ",u.pagination.tasks]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsxs("div",{style:{minWidth:Ue},children:[jsxRuntime.jsxs("div",{className:d("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",x?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[Q.map(_=>jsxRuntime.jsxs("div",{className:d("relative flex items-center gap-2 px-4 py-3",x?"text-[#9CA3AF]":"text-gray-500"),style:{width:_.width,minWidth:_.minWidth},onContextMenu:ue=>Qe(ue,void 0,_.id),children:[_.sortable?jsxRuntime.jsxs("button",{onClick:()=>Ne(_.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[Pe(_),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:d("w-3 h-3",m===_.id&&"text-[#3B82F6]")})]}):jsxRuntime.jsx("span",{children:Pe(_)}),h&&_.resizable&&jsxRuntime.jsx("div",{className:d("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",O===_.id&&"bg-[#3B82F6]"),onMouseDown:ue=>Pt(ue,_.id)})]},_.id)),C&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsxRuntime.jsx("button",{onClick:_=>{_.stopPropagation(),oe(ue=>!ue);},className:d("p-1.5 rounded-lg transition-colors",x?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",se&&(x?"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:se,onClose:()=>oe(false),columns:K,customFields:g,onColumnsChange:Je,onCreateCustomField:()=>{oe(false),he(true);},isDark:x,locale:p})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B.map((_,ue)=>{let ze=Ie.has(_.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:ue*.02},className:d("flex items-center border-b transition-colors",x?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(_),onDoubleClick:()=>a.onTaskDoubleClick?.(_),onContextMenu:ce=>Qe(ce,_),children:[Q.map(ce=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:ce.width,minWidth:ce.minWidth},children:ce.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&_.level>0&&jsxRuntime.jsx("div",{style:{width:`${_.level*24}px`},className:"flex-shrink-0"}),y&&_.hasChildren&&jsxRuntime.jsx("button",{onClick:nt=>{nt.stopPropagation(),Xe(_.id);},className:d("p-0.5 rounded flex-shrink-0",x?"hover:bg-white/10":"hover:bg-gray-200"),children:ze?jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:d("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")})}),y&&!_.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsx("button",{onClick:nt=>{nt.stopPropagation(),a.onTaskUpdate?.({..._,progress:_.progress===100?0:100,status:_.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(mv,{status:_.status,progress:_.progress})}),jsxRuntime.jsx("span",{className:d("truncate font-medium",x?"text-white":"text-gray-900",_.progress===100&&(x?"line-through text-[#6B7280]":"line-through text-gray-400")),children:_.name})]}):ne(_,ce)},ce.id)),C&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},_.id)})}),B.length===0&&v&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:d("w-12 h-12 mx-auto mb-4",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:d(x?"text-[#9CA3AF]":"text-gray-600"),children:u.empty.noResults})]})})]})}),jsxRuntime.jsx(qm,{state:Re,onClose:xt,isDark:x,locale:p,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:dt,onColumnSort:yt,availableUsers:c}),jsxRuntime.jsx(rp,{isOpen:xe,onClose:()=>he(false),onSave:Tt,isDark:x,locale:p})]})}var mp=[{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}],pp=[{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"}],up=[{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 gp(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 fp(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 bp(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 kp({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 Cp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:c,availableTags:g=[],onCreateTag:i,attachmentsByTask:p,comments:l,onAddComment:f,currentUser:y,mentionableUsers:k,onTaskOpen:C}){let{theme:h="dark",locale:b="en",customTranslations:u}=t,x=ys(b,u),m=h==="dark",N={textTertiary:m?"#6B7280":"#9CA3AF",textSecondary:m?"#9CA3AF":"#6B7280",textPrimary:m?"#FFFFFF":"#111827",borderLight:m?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:m?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:m?"#1A1D25":"#FFFFFF",bgSecondary:m?"#0F1117":"#F9FAFB",hoverBg:m?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[w,R]=react.useState(r||new Date),[v,I]=react.useState(null),[F,T]=react.useState(null),[z,$]=react.useState(null),[K,ae]=react.useState(new Date),[se,oe]=react.useState({}),xe=4,he=3,[Re,A]=react.useState(false),[O,L]=react.useState(false),[j,J]=react.useState(false),[de,be]=react.useState(false),[pe,Ie]=react.useState(null),[Q,Xe]=react.useState(""),[Ne,Je]=react.useState(void 0),[dt,yt]=react.useState(null),[Qe,xt]=react.useState(false),[Pt,Tt]=react.useState(false),[Ye,B]=react.useState(null),[ne,Pe]=react.useState(false),[Ue,_]=react.useState(new Date),[ue,ze]=react.useState(false),[ce,nt]=react.useState(false),[et,He]=react.useState(false),[Mt,At]=react.useState(""),[Ze,te]=react.useState(false),[S,Te]=react.useState(""),[X,Ce]=react.useState(false),we=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);},[]),tt=react.useMemo(()=>{let M=w.getFullYear(),H=w.getMonth(),Me=new Date(M,H,1),Ae=new Date(M,H+1,0),Ut=Me.getDay(),me=Ae.getDate(),_e=Mv(e),ht=new Date;ht.setHours(0,0,0,0);let $e=[],ut=Ut,ya=new Date(M,H,0).getDate();for(let Ft=ut-1;Ft>=0;Ft--){let qe=new Date(M,H-1,ya-Ft);$e.push({date:qe,isCurrentMonth:false,isToday:false,isWeekend:qe.getDay()===0||qe.getDay()===6,events:_e.filter(Yt=>Cl(qe,Yt)).map(Yt=>({id:Yt.id,title:Yt.name,start:Yt.startDate,end:Yt.endDate,task:Yt}))});}for(let Ft=1;Ft<=me;Ft++){let qe=new Date(M,H,Ft),Yt=qe.getTime()===ht.getTime();$e.push({date:qe,isCurrentMonth:true,isToday:Yt,isWeekend:qe.getDay()===0||qe.getDay()===6,events:_e.filter(ua=>Cl(qe,ua)).map(ua=>({id:ua.id,title:ua.name,start:ua.startDate,end:ua.endDate,task:ua}))});}let ka=42-$e.length;for(let Ft=1;Ft<=ka;Ft++){let qe=new Date(M,H+1,Ft);$e.push({date:qe,isCurrentMonth:false,isToday:false,isWeekend:qe.getDay()===0||qe.getDay()===6,events:_e.filter(Yt=>Cl(qe,Yt)).map(Yt=>({id:Yt.id,title:Yt.name,start:Yt.startDate,end:Yt.endDate,task:Yt}))});}return $e},[w,e]),G=b==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Y=w.toLocaleDateString(b==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),ye=react.useCallback((M,H)=>{if(!v)return;let Me={...v,[M]:H};I(Me),a.onTaskUpdate?.(Me);},[v,a]),Ke=react.useCallback(M=>{if(!v)return;let H=v.progress||0;M==="completed"?H=100:M==="todo"&&(H=0);let Me={...v,status:M,progress:H};I(Me),a.onTaskUpdate?.(Me),A(false);},[v,a]),Be=react.useCallback((M,H)=>{if(!v)return;let Me={...v,startDate:M,endDate:H};I(Me),a.onTaskUpdate?.(Me);},[v,a]),U=react.useCallback(()=>{A(false),L(false),J(false),$(null),He(false),At(""),te(false);},[]),le=react.useCallback(async M=>{if(M.preventDefault(),M.stopPropagation(),ze(false),!v||!a.onUploadAttachments)return;let H=Array.from(M.dataTransfer.files);if(H.length!==0){nt(true);try{await a.onUploadAttachments(v.id,H);}finally{nt(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){nt(true);try{await a.onUploadAttachments(v.id,H);}finally{nt(false);}M.target.value="";}},[v,a]),Nt=react.useCallback(M=>{M.preventDefault(),M.stopPropagation(),ze(true);},[]),ct=react.useCallback(M=>{M.preventDefault(),M.stopPropagation(),ze(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",m?"bg-[#0F1117]":"bg-white",n),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:d("text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:[x.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",m?"bg-[#0F1117]":"bg-white",n),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:d("text-lg font-semibold mb-2",m?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:d("text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:d("flex-1 flex items-center justify-center",m?"bg-[#0F1117]":"bg-white",n),style:c,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:d("text-lg font-semibold mb-2",m?"text-white":"text-gray-900"),children:x.labels.noEvents}),jsxRuntime.jsx("p",{className:d("text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:x.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:d("flex-1 flex flex-col w-full h-full overflow-auto",m?"bg-[#0F1117]":"bg-white",n),style:c,children:[jsxRuntime.jsx("div",{className:d("flex-shrink-0 px-6 py-4 border-b",m?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:d("text-xl font-semibold capitalize",m?"text-white":"text-gray-900"),children:Y}),jsxRuntime.jsx("button",{onClick:Oe,className:d("px-3 py-1.5 text-sm rounded-lg transition-colors",m?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:x.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:we,className:d("p-2 rounded-lg transition-colors",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:d("w-5 h-5",m?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:We,className:d("p-2 rounded-lg transition-colors",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:d("w-5 h-5",m?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:G.map(M=>jsxRuntime.jsx("div",{className:d("py-2 text-center text-xs font-medium uppercase",m?"text-[#9CA3AF]":"text-gray-500"),children:M},M))}),jsxRuntime.jsx("div",{className:d("grid grid-cols-7 auto-rows-min gap-px rounded-lg",m?"bg-[#2D2D2D]":"bg-gray-300"),children:tt.map((M,H)=>{let Me=M.date.getDay()===0||M.date.getDay()===6;return jsxRuntime.jsxs("div",{className:d("min-h-[120px] p-2 transition-colors flex flex-col relative group",m?Me?"bg-[#1C1F26]":M.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Me?"bg-gray-100":M.isCurrentMonth?"bg-white":"bg-gray-50",M.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ae=se[H]||xe,Ut=M.events.slice(0,Ae),me=M.events.length-Ae;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?m?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":m?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(kp,{task:_e.task}),jsxRuntime.jsx("span",{className:"truncate",children:_e.title})]})},_e.id)),me>0&&jsxRuntime.jsxs("button",{onClick:_e=>{_e.stopPropagation(),oe(ht=>({...ht,[H]:Ae+he}));},className:d("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",m?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",me," ",b==="es"?"M\xC1S":"MORE"]}),Ae>xe&&M.events.length>xe&&jsxRuntime.jsx("button",{onClick:_e=>{_e.stopPropagation(),oe(ht=>({...ht,[H]:xe}));},className:d("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",m?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:b==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ae=H>=28,Ut=H%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:me=>{me.stopPropagation(),pe===H?Ie(null):(Ie(H),Xe(""),Je(void 0),yt(null),B(null),xt(false),Tt(false),Pe(false),_(M.date));},className:d("w-5 h-5 rounded flex items-center justify-center transition-all",pe===H?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",m?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:d("w-3.5 h-3.5 transition-transform",pe===H&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:pe===H&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ie(null),Xe(""),Je(void 0),yt(null),B(null),xt(false),Tt(false),Pe(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Ae?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ae?-5:5,scale:.95},transition:{duration:.12},className:d("absolute w-[320px] rounded-lg shadow-2xl z-50",Ae?"bottom-full mb-1":"top-full mt-1",Ut?"right-0":"left-0",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:me=>{me.stopPropagation(),xt(false),Tt(false),Pe(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Q,onChange:me=>Xe(me.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",m?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:me=>{if(me.key==="Enter"&&Q.trim()){let _e=t.availableUsers?.find($e=>$e.id===dt),ht=Ye||M.date;a.onTaskCreate?.({name:Q.trim(),startDate:ht,endDate:ht,priority:Ne,assignees:_e?[_e]:void 0}),Xe(""),Je(void 0),yt(null),B(null),Ie(null);}me.key==="Escape"&&(Ie(null),Xe(""),Je(void 0),yt(null),B(null));}})}),jsxRuntime.jsxs("div",{className:d("px-2.5 py-2 flex items-center justify-between border-t",m?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:me=>{me.stopPropagation(),xt(!Qe),Tt(false);},className:d("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":m?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Qe&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:me=>me.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(me=>jsxRuntime.jsxs("button",{onClick:()=>{Je(me.id),xt(false);},className:d("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",Ne===me.id&&(m?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",me.color)}),jsxRuntime.jsx("span",{className:m?"text-white":"text-gray-900",children:me.label})]},me.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:me=>{me.stopPropagation(),Pe(!ne),xt(false),Tt(false),_(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]":m?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(Ye||M.date).toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ne&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:me=>me.stopPropagation(),children:[jsxRuntime.jsx("div",{className:d("w-40 py-2 border-r",m?"border-white/10":"border-gray-200"),children:(()=>{let me=new Date,_e=new Date(me);_e.setDate(me.getDate()+1);let ht=new Date(me);ht.setDate(me.getDate()+((6-me.getDay()+7)%7||7));let $e=new Date(me);$e.setDate(me.getDate()+((1-me.getDay()+7)%7||7));let ut=new Date(me);ut.setDate(me.getDate()+14);let ya=new Date(me);return ya.setDate(me.getDate()+28),[{label:b==="es"?"Hoy":"Today",date:me,display:me.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:ht,display:b==="es"?"s\xE1b.":"sat."},{label:b==="es"?"Pr\xF3xima semana":"Next week",date:$e,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:ya,display:ya.toLocaleDateString(b==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ft,qe)=>jsxRuntime.jsxs("button",{className:d("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",m?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{B(Ft.date),Pe(false);},children:[jsxRuntime.jsx("span",{children:Ft.label}),jsxRuntime.jsx("span",{className:d("text-[10px]",m?"text-[#6B7280]":"text-gray-400"),children:Ft.display})]},qe))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:d("text-xs font-medium",m?"text-white":"text-gray-900"),children:Ue.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:()=>_(new Date),className:d("px-1.5 py-0.5 rounded text-[10px] transition-colors",m?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:b==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>_(new Date(Ue.getFullYear(),Ue.getMonth()-1)),className:d("p-0.5 rounded",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>_(new Date(Ue.getFullYear(),Ue.getMonth()+1)),className:d("p-0.5 rounded",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(b==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(me=>jsxRuntime.jsx("div",{className:d("w-6 h-6 flex items-center justify-center text-[10px]",m?"text-[#6B7280]":"text-gray-400"),children:me},me))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let me=Ue.getFullYear(),_e=Ue.getMonth(),ht=new Date(me,_e,1).getDay(),$e=new Date(me,_e+1,0).getDate(),ut=new Date(me,_e,0).getDate(),ya=new Date,ka=[];for(let qe=ht-1;qe>=0;qe--)ka.push({dayNum:ut-qe,isCurrentMonth:false,date:new Date(me,_e-1,ut-qe)});for(let qe=1;qe<=$e;qe++)ka.push({dayNum:qe,isCurrentMonth:true,date:new Date(me,_e,qe)});let Ft=42-ka.length;for(let qe=1;qe<=Ft;qe++)ka.push({dayNum:qe,isCurrentMonth:false,date:new Date(me,_e+1,qe)});return ka.map((qe,Yt)=>{let ua=qe.date.toDateString()===ya.toDateString(),Lr=(Ye||M.date).toDateString()===qe.date.toDateString();return jsxRuntime.jsx("button",{className:d("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!qe.isCurrentMonth&&(m?"text-[#4B5563]":"text-gray-300"),qe.isCurrentMonth&&(m?"text-white":"text-gray-900"),ua&&"ring-1 ring-[#3B82F6]",Lr&&"bg-[#7C3AED] text-white",!Lr&&(m?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{B(qe.date),Pe(false);},children:qe.dayNum},Yt)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:me=>{me.stopPropagation(),Tt(!Pt),xt(false);},className:d("p-1 rounded transition-colors",dt?"text-[#7C3AED] bg-[#7C3AED]/20":m?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:dt?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(me=>me.id===dt)?.color||"#7C3AED"},children:t.availableUsers?.find(me=>me.id===dt)?.initials||t.availableUsers?.find(me=>me.id===dt)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Pt&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:me=>me.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{yt(null),Tt(false);},className:d("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",!dt&&(m?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:d("w-5 h-5 rounded-full flex items-center justify-center",m?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:m?"text-[#9CA3AF]":"text-gray-500",children:b==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(me=>jsxRuntime.jsxs("button",{onClick:()=>{yt(me.id),Tt(false);},className:d("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",dt===me.id&&(m?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:me.color||"#7C3AED"},children:me.initials||me.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:m?"text-white":"text-gray-900",children:me.name})]},me.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:d("px-3 py-2 text-xs",m?"text-[#6B7280]":"text-gray-400"),children:b==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Q.trim()){let me=t.availableUsers?.find(ht=>ht.id===dt),_e=Ye||M.date;a.onTaskCreate?.({name:Q.trim(),startDate:_e,endDate:_e,priority:Ne,assignees:me?[me]:void 0}),Xe(""),Je(void 0),yt(null),B(null),Ie(null);}},disabled:!Q.trim(),className:d("px-2.5 py-1 rounded text-xs font-medium transition-colors",Q.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":m?"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?m?"text-white":"text-gray-900":m?"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),Te("");},className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:d("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",m?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:d("px-6 py-3 border-b flex items-center gap-3",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:d("w-4 h-4",m?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:d("text-xs px-2 py-0.5 rounded",m?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[b==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:d("text-xs font-mono",m?"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",m?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:d("p-1.5 rounded transition-colors",m?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:d("p-1.5 rounded transition-colors",m?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>{I(null),Te("");},className:d("p-1.5 rounded transition-colors",m?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let M=v.progress===100?0:100,Me={...v,progress:M,status:M===100?"completed":"todo"};I(Me),a.onTaskUpdate?.(Me);},className:d("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",v.progress===100?"bg-green-500 border-green-500":m?"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]":m?"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",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{U(),A(!Re);},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":m?"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:Re&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>A(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label: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",m?"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")&&(m?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",M.id==="completed"?"bg-green-500":M.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:m?"text-white":"text-gray-900",children:M.label})]},M.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:d("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{A(false),L(false),$(null),J(!j);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",m?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[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",m?"text-[#6B7280]":"text-gray-400"),children:["+",v.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:d("text-sm",m?"text-[#6B7280]":"text-gray-400"),children:b==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:d("w-3 h-3",m?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:j&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>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",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(M=>{let H=v.assignees?.some(Me=>Me.name===M.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Me=v.assignees||[],Ae;H?Ae=Me.filter(Ut=>Ut.name!==M.name):Ae=[...Me,{name:M.name,avatar:M.avatar,initials:M.initials||M.name.slice(0,2).toUpperCase(),color:M.color||"#8B5CF6"}],ye("assignees",Ae);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",m?"hover:bg-white/5":"hover:bg-gray-50",H&&(m?"bg-white/5":"bg-gray-50")),children:[M.avatar?jsxRuntime.jsx("img",{src:M.avatar,alt:M.name,className:"w-6 h-6 rounded-full object-cover"}):jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:M.color||"#8B5CF6"},children:M.initials||M.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:d("flex-1 text-left",m?"text-white":"text-gray-900"),children:M.name}),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",m?"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",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{$(z?null:"start"),ae(v.startDate||new Date);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",m?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[v.startDate?.toLocaleDateString(b==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(b==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:d("mx-1",m?"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:z&&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",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:M=>M.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:d("w-44 py-2 border-r",m?"border-white/10":"border-gray-200"),children:[(()=>{let M=new Date,H=new Date(M);H.setDate(M.getDate()+1);let Me=new Date(M);Me.setDate(M.getDate()+((6-M.getDay()+7)%7||7));let Ae=new Date(M);Ae.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 me=new Date(M);me.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:Me,display:b==="es"?"s\xE1b.":"sat."},{label:b==="es"?"Pr\xF3xima semana":"Next week",date:Ae,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:me,display:me.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(($e,ut)=>jsxRuntime.jsxs("button",{className:d("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",m?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(z==="start"){let ya=v.endDate&&$e.date>v.endDate?$e.date:v.endDate;Be($e.date,ya),$("end");}else {let ya=v.startDate&&$e.date<v.startDate?$e.date:v.startDate;Be(ya,$e.date),$(null);}},children:[jsxRuntime.jsx("span",{children:$e.label}),jsxRuntime.jsx("span",{className:d("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:$e.display})]},ut))})(),jsxRuntime.jsx("div",{className:d("border-t mt-2 pt-2",m?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Be(void 0,void 0),$(null);},className:d("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",m?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children: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",m?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:z==="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",m?"text-white":"text-gray-900"),children:K.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:()=>ae(new Date),className:d("p-1 rounded text-sm transition-colors",m?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:b==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>ae(new Date(K.getFullYear(),K.getMonth()-1)),className:d("p-1 rounded",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>ae(new Date(K.getFullYear(),K.getMonth()+1)),className:d("p-1 rounded",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(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",m?"text-[#6B7280]":"text-gray-400"),children:M},M))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let M=K.getFullYear(),H=K.getMonth(),Me=new Date(M,H,1).getDay(),Ae=new Date(M,H+1,0).getDate(),Ut=new Date(M,H,0).getDate(),me=new Date,_e=[];for(let $e=Me-1;$e>=0;$e--)_e.push({day:Ut-$e,isCurrentMonth:false,date:new Date(M,H-1,Ut-$e)});for(let $e=1;$e<=Ae;$e++)_e.push({day:$e,isCurrentMonth:true,date:new Date(M,H,$e)});let ht=42-_e.length;for(let $e=1;$e<=ht;$e++)_e.push({day:$e,isCurrentMonth:false,date:new Date(M,H+1,$e)});return _e.map(($e,ut)=>{let ya=$e.date.toDateString()===me.toDateString(),ka=v.startDate?.toDateString()===$e.date.toDateString(),Ft=v.endDate?.toDateString()===$e.date.toDateString(),qe=ka||Ft,Yt=v.startDate&&v.endDate&&$e.date>=v.startDate&&$e.date<=v.endDate;return jsxRuntime.jsx("button",{className:d("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!$e.isCurrentMonth&&(m?"text-[#4B5563]":"text-gray-300"),$e.isCurrentMonth&&(m?"text-white":"text-gray-900"),ya&&"ring-2 ring-[#3B82F6]",ka&&"bg-[#3B82F6] text-white",Ft&&!ka&&"bg-[#7C3AED] text-white",Yt&&!qe&&(m?"bg-[#7C3AED]/20":"bg-purple-100"),!qe&&(m?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let ua=new Date($e.date);if(z==="start"){let Lr=v.endDate&&ua>v.endDate?ua:v.endDate;Be(ua,Lr),$("end");}else {let Lr=v.startDate&&ua<v.startDate?ua:v.startDate;Be(Lr,ua),$(null);}},children:$e.day},ut)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:d("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{U(),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":m?"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]",m?"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:()=>{ye("priority",M.id),L(false);},className:d("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",v.priority===M.id&&(m?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:d("w-2 h-2 rounded-full",M.color)}),jsxRuntime.jsx("span",{className:m?"text-white":"text-gray-900",children:M.label})]},M.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:d("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:d("text-sm",m?"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",m?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[de?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:v.progress||0,onChange:M=>{let H=parseInt(M.target.value),Me=v.status;H===100?Me="completed":H>0?Me="in-progress":Me="todo";let Ae={...v,progress:H,status:Me};I(Ae),a.onTaskUpdate?.(Ae);},onBlur:()=>be(false),className:d("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",m?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>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",m?"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]",m?"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",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(hr,{selectedTags:v.tags||[],availableTags:g,onChange:M=>{ye("tags",M);},onCreateTag:i,theme:N})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:d("w-4 h-4 mt-1.5",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24 mt-1",m?"text-[#9CA3AF]":"text-gray-500"),children: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(Me=>Me.id===M);return jsxRuntime.jsxs("span",{className:d("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",m?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[H?.name||M.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let Me=(v.dependencies||[]).filter(Ae=>Ae!==M);ye("dependencies",Me);},className:d("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},M)})}),jsxRuntime.jsxs("button",{onClick:()=>{U(),He(!et);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",m?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:d("text-sm",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:et&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{He(false),At("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:d("p-2 border-b",m?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:Mt,onChange:M=>At(M.target.value),placeholder:b==="es"?"Buscar tarea...":"Search task...",className:d("w-full px-3 py-2 rounded-md text-sm outline-none",m?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:e.length>0?e.filter(M=>M.id!==v.id).filter(M=>Mt===""||M.name.toLowerCase().includes(Mt.toLowerCase())).map(M=>{let H=v.dependencies?.includes(M.id);return jsxRuntime.jsxs("button",{onClick:()=>{let Me=v.dependencies||[],Ae;H?Ae=Me.filter(Ut=>Ut!==M.id):Ae=[...Me,M.id],ye("dependencies",Ae);},className:d("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",H&&(m?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:d("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",H?"bg-blue-500 border-blue-500":m?"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",m?"text-white":"text-gray-900"),children:M.name}),jsxRuntime.jsx("span",{className:d("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:M.id.slice(0,8)})]})]},M.id)}):jsxRuntime.jsx("div",{className:d("px-3 py-4 text-sm text-center",m?"text-[#6B7280]":"text-gray-500"),children: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",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{U(),te(!Ze);},className:d("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",m?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:v.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:d("text-sm",m?"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",m?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ze&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>te(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:d("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:yr.map(M=>{let H=v.color===M.value;return jsxRuntime.jsx("button",{onClick:()=>{ye("color",M.value),te(false);},className:d("w-7 h-7 rounded-full flex items-center justify-center transition-all",H&&"ring-2 ring-offset-2",m?"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",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:d("text-sm w-24",m?"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=>ye("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":m?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:d("text-sm",m?"text-white":"text-gray-900"),children:b==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:d("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:d("text-sm font-semibold",m?"text-white":"text-gray-900"),children:b==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:v.description||"",onChange:M=>ye("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",m?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:d("flex items-center gap-2 text-sm mt-2 transition-colors",m?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),b==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:d("text-sm font-semibold mb-3",m?"text-white":"text-gray-900"),children: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",m?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),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",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:d("text-sm font-semibold mb-3",m?"text-white":"text-gray-900"),children: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":m?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:M.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:d("text-sm",M.progress===100?"line-through text-[#6B7280]":m?"text-white":"text-gray-900"),children:M.name})]},M.id))}),jsxRuntime.jsxs("button",{className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",m?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),b==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:d("text-sm font-semibold",m?"text-white":"text-gray-900"),children:b==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:d("p-1 rounded transition-colors",m?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",m?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),b==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:d("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:d("text-sm font-semibold mb-3",m?"text-white":"text-gray-900"),children:[b==="es"?"Adjuntos":"Attachments",Ua.length>0&&jsxRuntime.jsxs("span",{className:d("ml-2 text-xs font-normal",m?"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),Me=M.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:d("flex items-center gap-3 p-2 rounded-lg group transition-colors",m?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Me&&M.thumbnailUrl?jsxRuntime.jsx("img",{src:M.thumbnailUrl,alt:M.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:d("w-10 h-10 rounded flex items-center justify-center",m?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(H,{className:d("w-5 h-5",m?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:M.url,target:"_blank",rel:"noopener noreferrer",className:d("text-sm font-medium truncate block hover:underline",m?"text-white":"text-gray-900"),children:M.name}),jsxRuntime.jsx("p",{className:d("text-xs",m?"text-[#6B7280]":"text-gray-400"),children: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",m?"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:Nt,onDragLeave:ct,onDrop:le,className:d("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",ue?m?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":m?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",ce&&"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||ce}),ce?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:d("text-sm",m?"text-[#9CA3AF]":"text-gray-500"),children:b==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:d("w-6 h-6 mx-auto mb-2",ue?"text-blue-500":m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:d("text-sm",m?"text-[#9CA3AF]":"text-gray-500"),children:ue?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",m?"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",m?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:d("px-4 py-3 border-b",m?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:d("text-sm font-semibold",m?"text-white":"text-gray-900"),children:[b==="es"?"Actividad":"Activity",l&&l.length>0&&jsxRuntime.jsxs("span",{className:d("ml-2 text-xs font-normal",m?"text-[#6B7280]":"text-gray-400"),children:["(",l.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:l&&l.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:l.map(M=>{let H=(()=>{let Me=new Date,Ae=new Date(M.createdAt),Ut=Me.getTime()-Ae.getTime(),me=Math.floor(Ut/6e4),_e=Math.floor(me/60),ht=Math.floor(_e/24);return me<1?b==="es"?"ahora":"now":me<60?b==="es"?`hace ${me}m`:`${me}m ago`:_e<24?b==="es"?`hace ${_e}h`:`${_e}h ago`:b==="es"?`hace ${ht}d`:`${ht}d ago`})();return jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:"#8B5CF6"},children:M.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:d("text-sm font-medium",m?"text-white":"text-gray-900"),children:M.user?.name||(b==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:d("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:H})]}),jsxRuntime.jsx("p",{className:d("text-sm break-words",m?"text-[#9CA3AF]":"text-gray-600"),children:M.content})]})]},M.id)})}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:d("w-10 h-10 mb-3",m?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:d("text-sm",m?"text-[#6B7280]":"text-gray-500"),children:b==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:d("p-4 border-t",m?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[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",m?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",value:S,onChange:M=>Te(M.target.value),onKeyDown:async M=>{if(M.key==="Enter"&&!M.shiftKey&&v&&S.trim()&&f){M.preventDefault(),Ce(true);try{await f(v.id,S.trim()),Te("");}finally{Ce(false);}}},placeholder:b==="es"?"Escribe un comentario...":"Write a comment...",disabled:X||!f,className:d("flex-1 bg-transparent text-sm outline-none",m?"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){Ce(true);try{await f(v.id,S.trim()),Te("");}finally{Ce(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":m?"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:()=>T(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:d("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",m?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:d("px-4 py-3 border-b flex items-center justify-between",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:d("font-medium",m?"text-white":"text-gray-900"),children:F.date.toLocaleDateString(b==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>T(null),className:d("p-1 rounded",m?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:F.events.map(M=>jsxRuntime.jsxs("button",{onClick:()=>{T(null),I(M.task),C?.(M.task.id);},className:d("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",m?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(kp,{task:M.task}),jsxRuntime.jsx("span",{className:d("text-sm truncate flex-1",m?"text-white":"text-gray-900"),children:M.title}),M.task.priority==="high"||M.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},M.id))})]})]})})]})}var 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 Tp(e){return xs[e]||xs.dark}function Fv({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:c}){let[g,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,k=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:k,priorities:C,labels:h}},[p]),f=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:d("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick: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"]})]}),g&&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:k=>{k.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 Dp={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 Sp(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 Ep({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:c}){let g=react.useMemo(()=>({...Dp,...n}),[n]),[i,p]=react.useState(new Set),l=react.useRef(null),f=react.useMemo(()=>{if(!g.groupByDay)return [{date:null,events:e}];let u=new Map;return e.forEach(x=>{let m=x.timestamp.toISOString().split("T")[0],N=u.get(m);N?N.push(x):u.set(m,[x]);}),Array.from(u.entries()).sort((x,m)=>m[0].localeCompare(x[0])).map(([x,m])=>({date:new Date(x),events:m.sort((N,w)=>w.timestamp.getTime()-N.timestamp.getTime())}))},[e,g.groupByDay]),{uniqueUsers:y,uniqueTypes:k}=react.useMemo(()=>{let u=new Set,x=new Set;return e.forEach(m=>{u.add(m.userId),x.add(m.type);}),{uniqueUsers:Array.from(u),uniqueTypes:Array.from(x)}},[e]),C=u=>{p(x=>{let m=new Set(x);return m.has(u)?m.delete(u):m.add(u),m});},h=u=>{let m=new Date().getTime()-u.getTime(),N=Math.floor(m/6e4),w=Math.floor(m/36e5),R=Math.floor(m/864e5);return N<1?"just now":N<60?`${N}m ago`:w<24?`${w}h ago`:R<7?`${R}d ago`:u.toLocaleDateString()},b=react.useMemo(()=>{let u=0;return t.types&&t.types.length>0&&u++,t.users&&t.users.length>0&&u++,t.dateRange&&u++,t.searchTerm&&u++,u},[t]);return react.useEffect(()=>{if(s&&l.current){let u=l.current.querySelector(`[data-event-id="${s}"]`);u&&u.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:d("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:d("history-timeline",g.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:u=>{let x=u.target.value;a({...t,types:x?[x]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),k.map(u=>jsxRuntime.jsxs("option",{value:u,children:[pn(u)," ",u.replace("_"," ")]},u))]}),y.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:u=>{let x=u.target.value;a({...t,users:x?[x]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),y.map(u=>jsxRuntime.jsx("option",{value:u,children:u},u))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:u=>a({...t,searchTerm:u.target.value})})]}),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(u=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[g.groupByDay&&u.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:u.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[u.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:u.events.map((x,m)=>{let N=i.has(x.id),w=s===x.id,R=Sp(x.type);return jsxRuntime.jsxs("div",{"data-event-id":x.id,className:d("history-timeline-event",N&&"expanded",w&&"selected"),onClick:()=>o?.(x),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:R},children:g.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:pn(x.type)})}),m<u.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:[g.showAvatars&&x.userAvatar&&jsxRuntime.jsx("img",{src:x.userAvatar,alt:x.userName||x.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:x.userName||x.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:mn(x)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:g.useRelativeTime?h(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:v=>{v.stopPropagation(),C(x.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([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)),x.metadata&&Object.keys(x.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(x.metadata).map(([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))]})]})]})]},x.id)})})]},u.date?.toISOString()||"all"))})]})}function Mp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:c,onSpeedChange:g,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=>c(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,k)=>jsxRuntime.jsx("div",{className:d("history-replay-progress-marker",k===e.currentIndex&&"active"),style:{left:`${k/(e.totalEvents-1)*100}%`},onClick:()=>c(k),title: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:()=>g(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 Ap(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 Fp(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(g=>({...g,x:g.x??a/2+Math.random()*100-50,y:g.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(n.map(g=>[g.id,g]));for(let g=0;g<s;g++){let i=1-g/s;n.forEach(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 k=p.x-y.x,C=p.y-y.y,h=Math.sqrt(k*k+C*C)||1,b=o.chargeStrength*i/(h*h);p.vx+=k/h*b,p.vy+=C/h*b;});}),t.forEach(p=>{let l=c.get(typeof p.source=="string"?p.source:p.source.id),f=c.get(typeof p.target=="string"?p.target:p.target.id);if(!l||!f)return;let y=f.x-l.x,k=f.y-l.y,C=Math.sqrt(y*y+k*k)||1,h=(C-o.linkDistance)/C*o.forceStrength*i;l.vx+=y*h,l.vy+=k*h,f.vx-=y*h,f.vy-=k*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 Lp({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:c,className:g}){let i=react.useRef(null),[p,l]=react.useState([]),[f,y]=react.useState(null),[k,C]=react.useState(null),[h,b]=react.useState(null),[u,x]=react.useState(1),[m,N]=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(($,K)=>{a.enableDragging&&(K.stopPropagation(),y($));},[a.enableDragging]),R=react.useCallback($=>{if(!f||!i.current)return;let ae=i.current.getBoundingClientRect(),se=($.clientX-ae.left-m.x)/u,oe=($.clientY-ae.top-m.y)/u;l(xe=>xe.map(he=>he.id===f?{...he,x:se,y:oe,fx:se,fy:oe}:he));},[f,u,m]),v=react.useCallback(()=>{y(null);},[]),I=react.useCallback(($,K)=>{K.stopPropagation(),c?.({type:"node-click",node:$,position:{x:K.clientX,y:K.clientY}});},[c]),F=react.useCallback(($,K)=>{K.stopPropagation(),c?.({type:"edge-click",edge:$,position:{x:K.clientX,y:K.clientY}});},[c]),T=react.useCallback($=>{let K=p.find(ae=>ae.id===$);return K?{x:K.x,y:K.y}:{x:0,y:0}},[p]),z=react.useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let K=$.card.priority;return K==="URGENT"?"#ef4444":K==="HIGH"?"#f59e0b":K==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:d("relationships-graph-empty",g),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:d("relationships-graph",g),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x($=>Math.min($+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(u*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x($=>Math.max($-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{x(1),N({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.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:[Ap($)," ",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(${m.x}, ${m.y}) scale(${u})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let K=T(typeof $.source=="string"?$.source:$.source.id),ae=T(typeof $.target=="string"?$.target:$.target.id),se=Fp($.type),oe=h===$.id,xe=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:d("relationships-graph-edge",oe&&"hovered",xe&&"critical"),onMouseEnter:()=>b($.id),onMouseLeave:()=>b(null),onClick:he=>F($,he),children:[jsxRuntime.jsx("line",{x1:K.x,y1:K.y,x2:ae.x,y2:ae.y,stroke:Sl($.type),strokeWidth:xe?a.edgeWidth*2:a.edgeWidth,strokeOpacity:oe?1:.6,markerEnd:se?"url(#arrowhead)":void 0}),a.showEdgeLabels&&oe&&jsxRuntime.jsx("text",{x:(K.x+ae.x)/2,y:(K.y+ae.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:El($.type)})]},$.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map($=>{let K=k===$.id,ae=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:d("relationships-graph-node",K&&"hovered",ae&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:se=>w($.id,se),onMouseEnter:()=>C($.id),onMouseLeave:()=>C(null),onClick:se=>I($,se),children:[jsxRuntime.jsx("circle",{r:ae?a.nodeSize*1.2:a.nodeSize,fill:z($),stroke:ae?"#fbbf24":"#ffffff",strokeWidth:ae?3:2,opacity:K?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:$.card.title.length>20?$.card.title.substring(0,20)+"...":$.card.title})]},$.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Rp({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[c,g]=react.useState(false),[i,p]=react.useState(null),[l,f]=react.useState(null),y=react.useRef(null),k=c||o;react.useEffect(()=>{e&&y.current&&y.current.focus();},[e]),react.useEffect(()=>{let u=x=>{x.key==="Escape"&&!k&&C();};if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,k]);let C=()=>{k||(n(""),p(null),f(null),t());},h=async()=>{if(!(!s.trim()||k)){g(true),p(null),f(null);try{let u=await r(s.trim());f(u);}catch(u){p(u instanceof Error?u.message:"Failed to generate plan");}finally{g(false);}}},b=()=>{l&&(a(l),C());};return e?jsxRuntime.jsxs(gt,{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:u=>u.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:C,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((u,x)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:u.title},x))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((u,x)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:u.title}),u.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:u.description})]}),u.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${u.priority==="URGENT"?"bg-red-500/20 text-red-400":u.priority==="HIGH"?"bg-orange-500/20 text-orange-400":u.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:u.priority})]})},x)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:y,value:s,onChange:u=>n(u.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:k}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((u,x)=>jsxRuntime.jsx("button",{onClick:()=>n(u),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:u},x))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:k&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:C,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),l?jsxRuntime.jsx("button",{onClick: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()||k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:k?"Generating...":"Generate Plan"})]})]})]})})]}):null}var 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),c=a.filter(l=>l.success),g=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?g/r:0,successRate:r>0?c.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let c=this.operations.filter(p=>p.timestamp>=n).length,g=Math.max(0,o-c),i=c/o*100;return {used:c,limit:o,remaining:g,percentUsed:i,isExceeded:c>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},bo=new Ml;function Up({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 g=setInterval(()=>{o(bo.getStats()),n(bo.checkLimit(a));},1e3);return ()=>clearInterval(g)},[e,a]),react.useEffect(()=>{let g=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]),!e)return null;let c=bo.getRecentOperations(5);return jsxRuntime.jsxs(gt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:g=>g.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children: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(([g,i])=>{let p=r.costsByFeature[g]||0,l=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:g.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children: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}%`}})})]},g)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(g=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:g.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(g.timestamp).toLocaleTimeString()," \u2022"," ",g.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[g.inputTokens+g.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:un(g.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${g.success?"bg-green-400":"bg-red-400"}`})]})]},g.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function Wp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,c]=react.useState(""),[g,i]=react.useState(""),[p,l]=react.useState(""),[f,y]=react.useState(false),[k,C]=react.useState(null),[h,b]=react.useState(null),[u,x]=react.useState(null),m=react.useRef(null),N=f||o;react.useEffect(()=>{e&&m.current&&m.current.focus();},[e]),react.useEffect(()=>{let F=T=>{T.key==="Escape"&&!N&&w();};if(e)return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[e,N]);let w=()=>{N||(c(""),i(""),l(""),C(null),b(null),x(null),t());},R=async()=>{if(!(!n.trim()||N)){y(true),C(null),b(null),x(null);try{let F=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:g||void 0,endDate:p||void 0});b(F.tasks.tasks),x({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=u?.similarity?((u.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(gt,{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:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[u?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),u?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",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:[u?.tokens_used||0," tokens"]}),u?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[u.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((F,T)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",T+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children: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:m,value:n,onChange:F=>c(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:N}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:g,onChange: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:N})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange: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:N})]})]}),k&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:k}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((F,T)=>jsxRuntime.jsx("button",{onClick:()=>c(F),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:F},T))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:N&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:w,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.jsx("button",{onClick: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()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function 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,u,x)=>{console.warn(`Retry attempt ${u} after ${x}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,u)=>{r(x=>{let m=x.cards.find(F=>F.id===h);if(!m)return x;let N=m.columnId,w={...m,columnId:b,position:u},R=x.cards.map(F=>F.id===h?w:F),v=x.columns.map(F=>{if(F.id===N)return {...F,cardIds:F.cardIds.filter(T=>T!==h)};if(F.id===b){let T=R.filter(z=>z.columnId===b).sort((z,$)=>z.position-$.position);return {...F,cardIds:T.map(z=>z.id)}}return F}),I={...x,cards:R,columns:v};return o(I),I});},[o]),n=react.useCallback(async(h,b)=>{r(u=>{let x=u.cards.map(N=>N.id===h?{...N,...b}:N),m={...u,cards:x};return o(m),m});},[o]),c=react.useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(u=>{let x={...h,id:b},m=u.columns.map(w=>w.id===h.columnId?{...w,cardIds:[...w.cardIds,b]}:w),N={...u,cards:[...u.cards,x],columns:m};return o(N),N});},[o]),g=react.useCallback(async h=>{r(b=>{let u=b.cards.find(w=>w.id===h);if(!u)return b;let x=b.cards.filter(w=>w.id!==h),m=b.columns.map(w=>w.id===u.columnId?{...w,cardIds:w.cardIds.filter(R=>R!==h)}:w),N={...b,cards:x,columns:m};return o(N),N});},[o]),i=react.useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(u=>{let x={...h,id:b,cardIds:[]},m={...u,columns:[...u.columns,x]};return o(m),m});},[o]),p=react.useCallback(async(h,b)=>{r(u=>{let x=u.columns.map(N=>N.id===h?{...N,...b}:N),m={...u,columns:x};return o(m),m});},[o]),l=react.useCallback(async h=>{r(b=>{let u=b.cards.filter(N=>N.columnId!==h),x=b.columns.filter(N=>N.id!==h),m={...b,cards:u,columns:x};return o(m),m});},[o]),f=react.useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(h),b},[c]),y=react.useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),k=react.useCallback(()=>{r(h=>{let b={...h,cards:[],columns:[]};return o(b),b});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:c,onCardDelete:g,onColumnCreate:i,onColumnUpdate:p,onColumnDelete:l},setBoard:r,helpers:{addCard:f,addColumn:y,deleteCard:g,deleteColumn:l,clearBoard:k}}}function _p({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Cs({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(g,i,p={})=>{s.addCard({title:i,columnId:g,position:r.cards.filter(l=>l.columnId===g).length,...p});},addColumn:(g,i)=>{let p=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:g,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:""},jp={by:"none",order:"asc"};function Kp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...gn,...e}),[s,n]=react.useState({...jp,...t}),c=react.useCallback(C=>{o(h=>({...h,...C}));},[]),g=react.useCallback(C=>{n(h=>({...h,...C}));},[]),i=react.useCallback(()=>{o(gn),n(jp);},[]),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]),k=react.useCallback(C=>{let h=[...C];if(r.search){let b=r.search.toLowerCase();h=h.filter(u=>u.title.toLowerCase().includes(b)||u.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,u=b.getFullYear(),x=String(b.getMonth()+1).padStart(2,"0"),m=String(b.getDate()).padStart(2,"0"),N=`${u}-${x}-${m}`;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"),T=String(R.getUTCDate()).padStart(2,"0");v=`${I}-${F}-${T}`;}switch(r.dateFilter){case "overdue":return v<N;case "today":return v===N;case "this-week":let I=new Date(N+"T00:00:00"),F=new Date(v+"T00:00:00"),T=new Date(I);return T.setDate(T.getDate()+7),F>=I&&F<=T;case "custom":if(r.dateRange){let z=typeof R=="string"?new Date(R):R;return z>=r.dateRange.start&&z<=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(x=>r.assignees.includes(x)))),r.labels.length>0&&(h=h.filter(b=>b.labels&&b.labels.some(u=>r.labels.includes(u)))),r.columns.length>0&&(h=h.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&h.sort((b,u)=>{let x=0;switch(s.by){case "created":let m=b.createdAt?new Date(b.createdAt).getTime():0,N=u.createdAt?new Date(u.createdAt).getTime():0;x=m-N;break;case "priority":let w={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},R=w[b.priority||"LOW"],v=w[u.priority||"LOW"];x=R-v;break;case "dueDate":let I=b.endDate||b.dueDate,F=u.endDate||u.dueDate;if(!I)return 1;if(!F)return -1;let T=typeof I=="string"?new Date(I).getTime():I.getTime(),z=typeof F=="string"?new Date(F).getTime():F.getTime();x=T-z;break;case "title":x=b.title.localeCompare(u.title);break;case "estimate":let $=b.estimatedTime||0,K=u.estimatedTime||0;x=$-K;break;default:x=0;}return s.order==="asc"?x:-x}),h},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:g,resetFilters:i,filterMyTasks:p,filterOverdue:l,filterHighPriority:f,applyFilters:k,hasActiveFilters:y}}var qp,Xp;if(typeof window<"u")try{let e=xn("ai");qp=e.generateObject,Xp=e.generateText;}catch{}function Jp(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(qp&&Xp&&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]),c=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(f){let y=f instanceof Error?f:new Error("Failed to suggest assignee");throw o(y),y}finally{a(false);}},[s]),g=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(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:c,onPredictRisks:g,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 Zp(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,k=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(k&&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),u=b.findIndex(v=>v.id===a.lastSelectedCardId),x=b.findIndex(v=>v.id===l),[m,N]=u<x?[u,x]:[x,u],w=b.slice(m,N+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]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),g=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),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:c,selectAll:g,toggleCard:i,getSelectedCards:p}}var Qp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function eu(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Qp,...a}),[a]),[s,n]=react.useState([]),c=react.useCallback((C,h,b,u,x)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let m={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:C,cardIds:h,columnId:b,strategy:u,color:x,isExpanded:true,position:s.filter(N=>N.columnId===b).length,createdAt:new Date};n(N=>[...N,m]);},[o.minCardsPerStack,s]),g=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(u=>u.id===C&&!u.cardIds.includes(h)?{...u,cardIds:[...u.cardIds,h]}:u));},[]),l=react.useCallback((C,h)=>{n(b=>b.map(u=>{if(u.id===C){let x=u.cardIds.filter(m=>m!==h);return x.length<o.minCardsPerStack?null:{...u,cardIds:x}}return u}).filter(u=>u!==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(N=>N.columnId===C);if(h.length<o.minCardsPerStack*2)return [];let b=[],u=new Map;h.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(w=>{u.has(w)||u.set(w,[]),u.get(w).push(N);});}),u.forEach((N,w)=>{N.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${w}`,cardIds:N.map(R=>R.id),columnId:C,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${w}"`,confidence:.85});});let x=new Map;h.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(w=>{x.has(w)||x.set(w,[]),x.get(w).push(N);});}),x.forEach((N,w)=>{N.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${w.slice(-4)}`,cardIds:N.map(R=>R.id),columnId:C,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let m=new Map;if(h.forEach(N=>{N.priority&&(m.has(N.priority)||m.set(N.priority,[]),m.get(N.priority).push(N));}),m.forEach((N,w)=>{if(N.length>=o.minCardsPerStack){let R={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[w.toLowerCase()]||"\u26AA";b.push({stack:{title:`${R} ${w} Priority`,cardIds:N.map(v=>v.id),columnId:C,strategy:"priority",color:w==="high"||w==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${w} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of h){let R=(await r.findSimilar(N,h)).filter(v=>v.similarity>=o.autoStackConfidenceThreshold);if(R.length>=o.minCardsPerStack-1){let v=[N.id,...R.map(F=>F.card.id)],I=R.reduce((F,T)=>F+T.similarity,0)/R.length;b.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.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(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,w)=>w.confidence-N.confidence).slice(0,5)},[t,o,r]),k=react.useCallback(C=>{c(C.stack.title,C.stack.cardIds,C.stack.columnId,C.stack.strategy,C.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await y(h),u=b[0];b.length>0&&u&&u.confidence>=.9&&k(u);});},[]),{stacks:s,createStack:c,deleteStack:g,toggleStack:i,addToStack:p,removeFromStack:l,getStacksForColumn:f,getSuggestions:y,applySuggestion:k,config:o}}var tu=react.createContext(null);function au({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(g=>{let{Column:i}=xn("@libxai/core");s.set(g.id,new i(g));}),t?.cards?.forEach(g=>{let{Card:i}=xn("@libxai/core");n.set(g.id,new i(g));});let c=null;if(t?.board){let{Board:g}=xn("@libxai/core");c=new g(t.board);}r.current=new core.BoardStore({board:c,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(tu.Provider,{value:{store:o},children:e})}function Ts(){let e=react.useContext(tu);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 c=react.useCallback(u=>{e.updateBoard(u);},[e]),g=react.useCallback(u=>{e.addColumn(u);},[e]),i=react.useCallback((u,x)=>{e.updateColumn(u,x);},[e]),p=react.useCallback(u=>{e.deleteColumn(u);},[e]),l=react.useCallback(u=>e.getColumn(u),[e]),f=react.useCallback(u=>{e.addCard(u);},[e]),y=react.useCallback((u,x)=>{e.updateCard(u,x);},[e]),k=react.useCallback(u=>{e.deleteCard(u);},[e]),C=react.useCallback((u,x,m)=>{e.moveCard(u,x,m);},[e]),h=react.useCallback(u=>e.getCard(u),[e]),b=react.useCallback(u=>e.getCardsByColumn(u),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:g,updateColumn:i,deleteColumn:p,getColumn:l,addCard:f,updateCard:y,deleteCard:k,moveCard:C,getCard:h,getCardsByColumn:b}}function ou(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 nu(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 c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},g=o.priority?c[o.priority]:0,i=s.priority?c[s.priority]:0;n=g-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var 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 c=await Promise.resolve(n.apply(s,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},nx=new Ns;function iu({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:c=0,getItemKey:g}){let i=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:c}),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(k=>{let C=e[k.index];if(!C)return null;let h=g?g(C,k.index):k.index,b={position:"absolute",top:n?0:k.start,left:n?k.start:0,width:n?k.size:"100%",height:n?"100%":k.size};return jsxRuntime.jsx("div",{style:b,"data-index":k.index,children:r(C,k.index)},h)})})})}function lu(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 cu({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:c=16,getItemKey:g,horizontal:i=true}){let p=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:n,gap:c}),f=l.getVirtualItems(),y={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},k={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:y,className:s,children:jsxRuntime.jsx("div",{style:k,children:f.map(C=>{let h=e[C.index];if(!h)return null;let b=g?g(h,C.index):C.index,u={position:"absolute",top:0,left:C.start,width:C.size,height:"100%"};return jsxRuntime.jsx("div",{style:u,"data-index":C.index,children:o(h,C.index)},b)})})})}function mu(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 pu(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 uu(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 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 {
390
390
  ${a.join(`
391
391
  `)}
392
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 {
@@ -394,7 +394,7 @@ ${a.join(`
394
394
  `)}
395
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}
396
396
 
397
- ${r}`}function gu(){return `/**
397
+ ${r}`}function bu(){return `/**
398
398
  * ASAKAA Design Tokens
399
399
  * Auto-generated from design-tokens.ts
400
400
  * Do not edit this file directly
@@ -415,6 +415,6 @@ ${hn(Jl,"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 fu({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,c])=>{let g=n,i=g===r;return jsxRuntime.jsxs("button",{onClick:()=>o(g),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":i,title:c.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(dx,{theme:g})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:c.displayName})]},g)})})}
419
- Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=Up;exports.AI_FEATURES=Hv;exports.AI_MODELS=Pl;exports.AddCardButton=ri;exports.AddColumnButton=ai;exports.AttachmentUploader=kr;exports.BoardProvider=au;exports.BulkOperationsToolbar=On;exports.BurnDownChart=fi;exports.CUSTOM_FIELD_TYPES=up;exports.CalendarBoard=Cp;exports.Card=Sr;exports.CardDetailModal=di;exports.CardDetailModalV2=pi;exports.CardHistoryReplay=Mp;exports.CardHistoryTimeline=Ep;exports.CardRelationshipsGraph=Lp;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=mp;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=Wp;exports.GeneratePlanModal=Rp;exports.GroupBySelector=vi;exports.KanbanBoard=Hr;exports.KanbanToolbar=ei;exports.KanbanViewAdapter=Xo;exports.KeyboardShortcutsHelp=xi;exports.ListView=cp;exports.MenuIcons=_t;exports.PluginManager=Ns;exports.PrioritySelector=ro;exports.RATE_LIMITS=zv;exports.STANDARD_FIELDS=pp;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=fu;exports.Timeline=as;exports.UserAssignmentSelector=no;exports.VelocityChart=gi;exports.VirtualGrid=cu;exports.VirtualList=iu;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=Uu;exports.darkTheme=Si;exports.darkTokenTheme=Ss;exports.defaultTheme=Un;exports.designTokens=Ds;exports.duration=Wl;exports.easing=Gl;exports.exportTokensToCSS=gu;exports.findTaskByName=Fr;exports.fontSize=$l;exports.fontWeight=Ul;exports.formatCost=un;exports.ganttEnTranslations=Hn;exports.ganttEsTranslations=Lc;exports.ganttTaskToCardUpdate=Cm;exports.ganttThemes=at;exports.ganttTokens=Kl;exports.ganttTranslations=Ai;exports.ganttUtils=ve;exports.generateCSSVariables=ql;exports.generateCompleteCSS=Zl;exports.generateInitialPositions=Bu;exports.generateTasksContext=ym;exports.generateThemeVariables=hn;exports.getCalendarTheme=Tp;exports.getCalendarTranslations=ln;exports.getListViewTheme=gp;exports.getListViewTranslations=nl;exports.getMonthNames=fp;exports.getToken=uu;exports.getTranslations=Ic;exports.getWeekdayNames=bp;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=$u;exports.retryWithBackoff=Cn;exports.shadows=_l;exports.shouldVirtualizeGrid=pu;exports.spacing=Rl;exports.themes=po;exports.useAI=Jp;exports.useBoard=_p;exports.useBoardCore=bn;exports.useBoardStore=Ts;exports.useCardStacking=eu;exports.useDragState=Zs;exports.useFilteredCards=ou;exports.useFilters=Kp;exports.useGanttI18n=jr;exports.useKanbanState=Cs;exports.useKeyboardShortcuts=Ec;exports.useMultiSelect=Zp;exports.useSelectionState=Fl;exports.useSortedCards=nu;exports.useTheme=Ao;exports.useVirtualGrid=mu;exports.useVirtualList=lu;exports.validateAIResponse=wm;exports.withErrorBoundary=oi;exports.wouldCreateCircularDependency=Nn;exports.zIndex=Hl;//# sourceMappingURL=index.cjs.map
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
420
420
  //# sourceMappingURL=index.cjs.map