@libxai/board 0.17.366 → 0.17.367

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
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'),kc=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),Vu=require('react-markdown'),ju=require('remark-gfm'),Ku=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var kc__default=/*#__PURE__*/_interopDefault(kc);var Vu__default=/*#__PURE__*/_interopDefault(Vu);var ju__default=/*#__PURE__*/_interopDefault(ju);var Ku__default=/*#__PURE__*/_interopDefault(Ku);var Zo=(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 en=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 [en.Translate.toString(e),en.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function f(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function tn(e,t){return e===null&&t===null?1e3:e===null&&t!==null?t/2:e!==null&&t===null?e+1e3:e!==null&&t!==null?(e+t)/2:1e3}function op(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function ns(e,t){return e.length===0?1e3:t===0?tn(null,e[0].position):t>=e.length?tn(e[e.length-1].position,null):tn(e[t-1].position,e[t].position)}function Cl(e,t=100){return e>t}var np=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 sp(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 an(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=np,onRetry:p}=t,m,i=0;for(let u=1;u<=a;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(m=d,u===a||!n(m,u))return {error:m,attempts:i,success:false};let h=sp(u,r,o,s);if(p)try{p(m,u,h);}catch(C){console.error("Error in retry callback:",C);}await new Promise(C=>setTimeout(C,h));}}return {error:m||new Error("Unknown error"),attempts:i,success:false}}function ip(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 lp(e,t={}){return async(...a)=>an(()=>e(...a),t)}var ss=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 Tl=(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))(Tl||{}),Or=class Or{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,p=`[${a}] [${r}] [${s}]`,m=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(p,o,m?n:"");break;case "INFO":console.info(p,o,m?n:"");break;case "WARN":console.warn(p,o,m?n:"");break;case "ERROR":console.error(p,o,m?n:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Or.globalOptions};}static configure(t){Or.globalOptions={...Or.globalOptions,...t};}child(t){return new Or({...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 rn((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new rn(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Tl[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Or.globalOptions={};var is=Or,rn=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}},Nl=new is;function cp(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 mp(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(p=>p.id===s.columnId);return [s.id,ls(s.title),ls(s.description||""),ls(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
2
  `)}async function pp(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 kc__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),p=n.toDataURL("image/png"),m=297,i=210,u=n.width/n.height,d=m-20,g=d/u;g>i-20&&(g=i-20,d=g*u);let h=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});h.setFontSize(16),h.setTextColor(255,255,255),h.setFillColor(10,10,10),h.rect(0,0,m,15,"F"),h.text(e.title||"Kanban Board",10,10);let C=(m-d)/2;return h.addImage(p,"PNG",C,20,d,g),h}catch(n){console.error("Error capturing board:",n);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let p=e.cards.filter(m=>m.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,p.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):p.forEach(m=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(m.title,25,s),s+=6,m.description){o.setFontSize(9),o.setFont("helvetica","normal");let u=o.splitTextToSize(m.description,160);o.text(u,25,s),s+=u.length*5;}let i=[];if(m.priority&&i.push(`Priority: ${m.priority}`),m.labels&&m.labels.length>0&&i.push(`Labels: ${m.labels.join(", ")}`),m.assignedUserIds&&m.assignedUserIds.length>0&&i.push(`Assigned: ${m.assignedUserIds.length} user(s)`),m.startDate||m.endDate){let u=[];m.startDate&&u.push(`Start: ${m.startDate}`),m.endDate&&u.push(`End: ${m.endDate}`),i.push(u.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function ls(e){return e.includes(",")||e.includes('"')||e.includes(`
3
3
  `)?`"${e.replace(/"/g,'""')}"`:e}async function Sl(e,t,a,r){switch(t){case "json":return cp(e,r);case "csv":return mp(e);case "pdf":return await pp(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function El(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${r}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},p=new Blob([e],{type:n[t]}),m=URL.createObjectURL(p),i=document.createElement("a");i.href=m,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(m);}function up(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 gp(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=Pl(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let p=Pl(t[n]||"");if(p.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-p.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${p.length})`);continue}for(;p.length<a.length;)p.push("");let i={};a.forEach((h,C)=>{i[h]=p[C]||"";});let u=i.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let d=o.get(u),g={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(g),d.cardIds.push(g.id);}catch(p){s.push(`Line ${n+1}: ${p instanceof Error?p.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Pl(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 Ml(e,t){switch(t){case "json":return up(e);case "csv":return gp(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Al(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 ds=react.createContext(null);function Fl(){return react.useContext(ds)}var Ll=react.createContext(null);function Il({children:e,themeName:t}){return jsxRuntime.jsx(Ll.Provider,{value:{themeName:t},children:e})}function oo(){return react.useContext(Ll)}function dt({children:e,container:t}){let[a,r]=react.useState(false),o=Fl(),s=oo();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:p,themeName:m}=o,i={"--asakaa-color-background-primary":p.bgPrimary,"--asakaa-color-background-secondary":p.bgSecondary,"--asakaa-color-background-card":p.bgGrid,"--asakaa-color-background-hover":p.hoverBg,"--asakaa-color-text-primary":p.textPrimary,"--asakaa-color-text-secondary":p.textSecondary,"--asakaa-color-text-tertiary":p.textTertiary,"--asakaa-color-text-inverse":p.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":p.border,"--asakaa-color-border-hover":p.borderLight,"--asakaa-color-border-subtle":p.borderLight,"--asakaa-color-interactive-primary":p.accent,"--asakaa-color-interactive-primaryHover":p.accentHover,"--asakaa-color-interactive-primaryBorder":`${p.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${p.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${p.accent}33`,"--asakaa-color-status-success":p.statusCompleted,"--asakaa-color-status-warning":p.milestone,"--asakaa-color-status-error":p.criticalPath,"--asakaa-color-danger":p.criticalPath,"--asakaa-color-danger-border":`${p.criticalPath}4D`,"--asakaa-color-danger-background":`${p.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${p.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":m,"data-gantt-portal":"true",style: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 zl={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},wp="#BDC3C7",Cp=({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 zr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),p=react.useRef(null),m=react.useRef(null),i=()=>{if(!m.current)return;let h=m.current.getBoundingClientRect(),C=window.innerHeight,T=window.innerWidth,c=160,b=220,y=4,l=h.right-c;l<10&&(l=h.left),l+c>T-10&&(l=T-c-10);let x=C-h.bottom,v=h.top,D;x>=b+y?D=h.bottom+y:v>=b+y?D=h.top-b-y:D=x>=v?h.bottom+y:Math.max(10,h.top-b-y),n({top:D,left:l}),o(true);};react.useEffect(()=>{let h=C=>{p.current&&!p.current.contains(C.target)&&!m.current?.contains(C.target)&&o(false);};if(r)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[r]),react.useEffect(()=>{let h=C=>{C.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[r]);let u=h=>{t(h),o(false);},d=e?zl[e]:null,g=d?.color||wp;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${g}10`:"transparent",boxShadow:e?`0 0 0 2px ${g}30 inset`:"none"},title:d?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:g,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:g,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(dt,{children:jsxRuntime.jsxs("div",{ref:p,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(zl).map(([h,C])=>jsxRuntime.jsxs("button",{onClick:()=>u(h),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:C.color,background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:T=>{T.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Cp,{color:C.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:C.label}),e===h&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Tp=[{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 To({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,p]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),g=(oo()?.themeName||"dark")==="dark",h=()=>{if(!i.current)return;let l=i.current.getBoundingClientRect(),x=window.innerHeight,v=window.innerWidth,D=320,k=380,w=4,R=l.left;R+D>v-10&&(R=v-D-10),R<10&&(R=10);let M=x-l.bottom,N=l.top,I;M>=k+w?I=l.bottom+w:N>=k+w?I=l.top-k-w:I=M>=N?l.bottom+w:Math.max(10,l.top-k-w),p({top:I,left:R}),s(true);};react.useEffect(()=>{let l=x=>{m.current&&!m.current.contains(x.target)&&!i.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[o]),react.useEffect(()=>{let l=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[o]);let C=l=>{let x=new Date,v=R=>{let M=R.getFullYear(),N=String(R.getMonth()+1).padStart(2,"0"),I=String(R.getDate()).padStart(2,"0");return `${M}-${N}-${I}`},D=v(x),k=new Date(x);k.setDate(k.getDate()+l);let w=v(k);a(D,w),s(false);},T=()=>{if(!e||!t)return "Set date";let l=k=>{if(k instanceof Date)return k;if(typeof k!="string"||!k.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=k.split("-").map(Number);if(w.length!==3||w.some(I=>isNaN(I)))return null;let R=w[0],M=w[1],N=w[2];return R===void 0||M===void 0||N===void 0?null:new Date(R,M-1,N)},x=l(e),v=l(t);if(!x||!v||isNaN(x.getTime())||isNaN(v.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[x.getMonth()]} ${x.getDate()} \u2013 ${D[v.getMonth()]} ${v.getDate()}`},c=e&&t,y=(()=>{if(!t)return false;let l=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),l<x})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):h(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${y?"asakaa-date-overdue":"asakaa-date"}`,title:c?`${T()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:T()})]}),o&&jsxRuntime.jsx(dt,{children:jsxRuntime.jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:g?"#1A1D25":"#FFFFFF",border:`1px solid ${g?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:g?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:g?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:g?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:Tp.map(l=>jsxRuntime.jsx("button",{onClick:()=>C(l.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:l.label},l.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:g?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:l=>a(l.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:l=>a(e,l.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:l=>{l.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:l=>{l.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Hr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[p,m]=react.useState(""),[i,u]=react.useState({top:0,left:0}),d=react.useRef(null),g=react.useRef(null),h=()=>{if(!g.current)return;let y=g.current.getBoundingClientRect(),l=window.innerHeight,x=window.innerWidth,v=300,D=380,k=4,w=y.right-v;w<10&&(w=y.left),w+v>x-10&&(w=x-v-10);let R=l-y.bottom,M=y.top,N;R>=D+k?N=y.bottom+k:M>=D+k?N=y.top-D-k:N=R>=M?y.bottom+k:Math.max(10,y.top-D-k),u({top:N,left:w}),n(true);};react.useEffect(()=>{let y=l=>{d.current&&!d.current.contains(l.target)&&!g.current?.contains(l.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),react.useEffect(()=>{let y=l=>{l.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let C=y=>{let l=e.some(x=>x.id===y.id);a(l?e.filter(x=>x.id!==y.id):[...e,y]);},T=t.filter(y=>y.name.toLowerCase().includes(p.toLowerCase())),c=e.slice(0,o),b=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:g,onClick:()=>s?n(false):h(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[c.map(y=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:y.name,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"asakaa-avatar-img"}):y.initials},y.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(dt,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:p,onChange:y=>m(y.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:T.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):T.map(y=>{let l=e.some(x=>x.id===y.id);return jsxRuntime.jsxs("button",{onClick:()=>C(y),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:y.color,color:"#fff"},children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.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:y.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:l?"#3b82f6":"transparent"},children:l?"\u2713":""})]},y.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 on(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let i=m.dependencies.map(u=>{if(typeof u=="string")return u;let d=u;return d.taskId||d.targetId||""}).filter(Boolean);r.set(m.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,p=m=>{if(!s.has(m)){s.add(m),n.add(m);let i=r.get(m)||[];for(let u of i){if(!s.has(u)&&p(u))return true;if(n.has(u))return true}}return n.delete(m),false};return p(a)}function Do({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[p,m]=react.useState(false),[i,u]=react.useState(""),[d,g]=react.useState(t.length>0),[h,C]=react.useState({top:0,left:0}),[T,c]=react.useState(null),b=react.useRef(null),y=react.useRef(null),l=()=>{if(!y.current)return;let w=y.current.getBoundingClientRect(),R=window.innerHeight,M=window.innerWidth,N=300,I=d?380:120,B=4,K=w.right-N;K<10&&(K=w.left),K+N>M-10&&(K=M-N-10);let te=R-w.bottom,se=w.top,le;te>=I+B?le=w.bottom+B:se>=I+B?le=w.top-I-B:le=te>=se?w.bottom+B:Math.max(10,w.top-I-B),C({top:le,left:K}),m(true);};react.useEffect(()=>{if(!p||!y.current)return;let w=y.current.getBoundingClientRect(),R=window.innerHeight,M=window.innerWidth,N=300,I=d?380:120,B=4,K=w.right-N;K<10&&(K=w.left),K+N>M-10&&(K=M-N-10);let te=R-w.bottom,se=w.top,le;te>=I+B?le=w.bottom+B:se>=I+B?le=w.top-I-B:le=te>=se?w.bottom+B:Math.max(10,w.top-I-B),C({top:le,left:K});},[d,p]),react.useEffect(()=>{let w=R=>{b.current&&!b.current.contains(R.target)&&!y.current?.contains(R.target)&&(m(false),u(""));};if(p)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[p]),react.useEffect(()=>{let w=R=>{R.key==="Escape"&&(m(false),u(""));};if(p)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[p]);let x=w=>{let R=t.includes(w),M=a.find(N=>N.id===w);if(c(null),R){let N=t.filter(I=>I!==w);r(N),N.length===0&&g(false);}else {if(s&&on(a,w,e)){let I=`Cannot add "${M?.title||w}" as dependency - would create circular reference`;c(I),n?.(w,M?.title||w),setTimeout(()=>c(null),3e3);return}r([...t,w]),g(true);}},v=()=>{let w=!d;g(w),w||r([]);},D=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),k=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:y,onClick:()=>p?m(false):l(),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:k,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:k},children:t.length})]}),p&&jsxRuntime.jsx(dt,{children:jsxRuntime.jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${h.top}px`,left:`${h.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[T&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:T})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:v,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:w=>u(w.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:D.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):D.map(w=>{let R=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>x(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:M=>{M.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:M=>{M.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:R?"#3b82f6":"transparent",borderColor:R?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:R&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:w.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),g(false),m(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var ur=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:p=[],allCards:m=[]})=>{let{attributes:i,listeners:u,setNodeRef:d,transform:g,transition:h,isDragging:C}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),T={transform:en.Transform.toString(g),transition:h};if(t)return jsxRuntime.jsx("div",{ref:d,style:T,...i,...u,onClick:()=>a?.(e),children:t(e)});let c=p.filter(x=>e.assignedUserIds?.includes(x.id)),b=e.progress===100,y=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),l={...T,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:l,className:f("asakaa-card",C&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:x=>{x.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:x=>{x.currentTarget.style.display="none";}})}),y.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:y.length===1&&y[0]?jsxRuntime.jsx("img",{src:y[0].url,alt:y[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:y.slice(0,4).map((x,v)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:D=>{D.currentTarget.style.display="none";}}),v===3&&y.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:["+",y.length-4]})})]},x.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:x=>x.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(zr,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(To,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(x,v)=>n?.(e.id,{startDate:x,endDate:v})})}),p.length>0&&jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Hr,{assignedUsers:c,availableUsers:p,onChange:x=>n?.(e.id,{assignedUserIds:x.map(v=>v.id)})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Do,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:m,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsxRuntime.jsx("span",{className:"asakaa-label",children:x},x))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));ur.displayName="Card";var nn={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"}},ql=({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 Xl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,p]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),u=[...Object.entries(nn).map(([c,b])=>({id:c,label:b.label,color:b.color,icon:b.icon})),...r.filter(c=>!Object.keys(nn).includes(c.id)).map(c=>({id:c.id,label:c.title,color:c.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let c=nn[e];if(c)return {...c,id:e};let b=r.find(y=>y.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...nn.todo,id:"todo"}},g=()=>{if(!i.current)return;let c=i.current.getBoundingClientRect(),b=window.innerHeight,y=window.innerWidth,l=180,x=280,v=4,D=c.right-l;D<10&&(D=c.left),D+l>y-10&&(D=y-l-10);let k=b-c.bottom,w=c.top,R;k>=x+v?R=c.bottom+v:w>=x+v?R=c.top-x-v:R=k>=w?c.bottom+v:Math.max(10,c.top-x-v),p({top:R,left:D}),s(true);};react.useEffect(()=>{let c=b=>{m.current&&!m.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(o)return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[o]),react.useEffect(()=>{let c=b=>{b.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[o]);let h=c=>{t(c),s(false);},C=d(),T=C.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):g(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${T}10`,boxShadow:`0 0 0 2px ${T}30 inset`},title:C.label,children:jsxRuntime.jsx(ql,{icon:C.icon,color:T})}),o&&jsxRuntime.jsx(dt,{children:jsxRuntime.jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:u.map(c=>jsxRuntime.jsxs("button",{onClick:()=>h(c.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:c.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(ql,{icon:c.icon,color:c.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:c.label}),e===c.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"})})]},c.id))})]})})]})}function Jl({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[p,m]=react.useState(false),[i,u]=react.useState(e),[d,g]=react.useState({top:0,left:0}),h=react.useRef(null),C=react.useRef(null),T=react.useRef(null);react.useEffect(()=>{if(s&&C.current){let l=C.current.getBoundingClientRect();g({top:l.bottom+window.scrollY+8,left:l.left+window.scrollX});}},[s]),react.useEffect(()=>{let l=x=>{h.current&&!h.current.contains(x.target)&&!C.current?.contains(x.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]),react.useEffect(()=>{let l=x=>{x.key==="Escape"&&(n(false),m(false),u(e));};if(s)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[s,e]),react.useEffect(()=>{p&&T.current&&(T.current.focus(),T.current.select());},[p]);let c=()=>{m(true),u(e);},b=()=>{let l=i.trim();l&&l!==e&&t(l),m(false),n(false),u(e);},y=l=>{l.key==="Enter"?b():l.key==="Escape"&&(m(false),u(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:C,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsxRuntime.jsx(dt,{children:jsxRuntime.jsx("div",{ref:h,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:p?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:T,type:"text",value:i,onChange:l=>u(l.target.value),onKeyDown:y,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:c,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 io=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:p,availableUsers:m,allCards:i,enableVirtualization:u,cardHeight:d=120,isCollapsed:g,onToggleCollapse:h,onColumnRename:C,onColumnDelete:T,isDeletable:c=false,className:b})=>{let{setNodeRef:y,isOver:l}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),x=react.useRef(null),v=u??Cl(t.length),D=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>d,enabled:v});if(a)return jsxRuntime.jsx("div",{ref:y,className:b,children:a(e,t)});let w=(()=>{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}})(),R=w.state==="exceeded",M=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:y,className:f("asakaa-column",l&&"ring-2 ring-asakaa-accent-blue",R&&"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:f(M()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&w.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${w.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[w.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),w.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),w.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),w.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(C||T)&&jsxRuntime.jsx(Jl,{columnTitle:e.title,onRename:N=>C?.(e.id,N),onDelete:T?()=>T(e.id):void 0,isDeletable:c}),h&&jsxRuntime.jsx("button",{onClick:h,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":g?"Expand column":"Collapse column",children:g?"\u25B6":"\u25BC"})]})]}),!g&&jsxRuntime.jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:v?"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"})}):v?jsxRuntime.jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(N=>{let I=t[N.index];return I?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${N.start}px)`},children:jsxRuntime.jsx(ur,{card:I,render:r,onClick:n,onUpdate:p,availableUsers:m,allCards:i})},I.id):null})}):t.map(N=>jsxRuntime.jsx(ur,{card:N,render:r,onClick:n,onUpdate:p,availableUsers:m,allCards:i},N.id))})})]})});io.displayName="Column";function gs({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),p=react.useRef(null);react.useEffect(()=>{r&&p.current&&(p.current.focus(),p.current.select());},[r]);let m=()=>{let u=s.trim();u&&u!==e?t(u):n(e),o(false);},i=u=>{u.key==="Enter"?m():u.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:p,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:m,onKeyDown:i,className:f("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:f("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}var cn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function nr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[p,m]=react.useState(false),[i,u]=react.useState(""),[d,g]=react.useState(false),[h,C]=react.useState(cn[10]||"#3B82F6"),[T,c]=react.useState({top:0,left:0}),b=react.useRef(null),y=react.useRef(null),l=react.useRef(null),x=react.useRef(null),v=t.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),D=t.some(N=>N.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(p&&y.current){let N=y.current.getBoundingClientRect();c({top:N.bottom+6,left:N.left});}},[p]),react.useEffect(()=>{let N=I=>{let B=I.target,K=b.current?.contains(B),te=l.current?.contains(B);!K&&!te&&(m(false),u(""),g(false));};if(p)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[p]),react.useEffect(()=>{p&&x.current&&x.current.focus();},[p]);let k=N=>{let I=e.some(B=>B.id===N.id);a(I?e.filter(B=>B.id!==N.id):[...e,N]);},w=async()=>{if(!(!r||!i.trim())){g(true);try{let N=await r(i.trim(),h);N&&(a([...e,N]),u(""),C(cn[Math.floor(Math.random()*cn.length)]||"#3B82F6"));}finally{g(false);}}},R=(N,I)=>{I.stopPropagation(),a(e.filter(B=>B.id!==N));},M={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:y,type:"button",onClick:()=>!s&&m(!p),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:M,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(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:p&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:l,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:T.top,left:T.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:x,type:"text",value:i,onChange:N=>u(N.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:N=>{N.key==="Enter"&&i.trim()&&!D&&r&&w();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(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:I=>R(N.id,I),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:v.length>0?v.map(N=>{let I=e.some(B=>B.id===N.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>k(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:I?`${N.color}15`:"transparent",color:o.textPrimary},onMouseEnter:B=>{I||(B.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:B=>{I||(B.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}),I&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:N.color}})]},N.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!D&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:cn.map(N=>jsxRuntime.jsx("button",{type:"button",onClick:()=>C(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:h===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxRuntime.jsxs("button",{type:"button",onClick:w,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:h,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function hs({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 td({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(hs,{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 sr=[{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 sd(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 cu(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 _r({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:p=[],availableTags:m=[],onCreateTag:i,attachments:u=[],onUploadAttachments:d,onDeleteAttachment:g,availableTasks:h=[],comments:C=[],onAddComment:T,currentUser:c}){let b=s==="dark",y={textTertiary:b?"#6B7280":"#9CA3AF",textSecondary:b?"#9CA3AF":"#6B7280",textPrimary:b?"#FFFFFF":"#111827",borderLight:b?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:b?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:b?"#1A1D25":"#FFFFFF",bgSecondary:b?"#0F1117":"#F9FAFB",hoverBg:b?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},l=e&&"title"in e&&!("name"in e),x=e,[v,D]=react.useState(e?sd(e,p):null),[k,w]=react.useState(false),[R,M]=react.useState(false),[N,I]=react.useState(false),[B,K]=react.useState(null),[te,se]=react.useState(new Date),[le,ye]=react.useState(false),[$,Q]=react.useState(false),[U,G]=react.useState(""),[A,Z]=react.useState(false),[J,H]=react.useState(false),[Te,Me]=react.useState(false),[Oe,xe]=react.useState(""),Ye=react.useRef(null),[We,tt]=react.useState(""),xt=react.useRef(null),[At,pt]=react.useState(""),[O,ie]=react.useState(false);react.useEffect(()=>{if(e){let S=sd(e,p);D(S),xe(S.description||""),tt(S.name||"");}},[e?.id,p]),react.useEffect(()=>()=>{Ye.current&&clearTimeout(Ye.current),xt.current&&clearTimeout(xt.current);},[]);let ke=react.useCallback(S=>{D(S),l&&o&&x?o(cu(S,x)):r&&r(S);},[l,x,o,r]),Pe=react.useCallback(()=>{w(false),M(false),I(false),K(null),Q(false),G(""),Z(false);},[]),Ue=react.useCallback((S,q)=>{if(!v)return;let be={...v,[S]:q};ke(be);},[v,ke]),rt=react.useCallback(S=>{xe(S),Ye.current&&clearTimeout(Ye.current),Ye.current=setTimeout(()=>{if(v){let q={...v,description:S};ke(q);}},800);},[v,ke]),Pt=react.useCallback(S=>{tt(S),xt.current&&clearTimeout(xt.current),xt.current=setTimeout(()=>{if(v&&S.trim()){let q={...v,name:S.trim()};ke(q);}},800);},[v,ke]),Fe=react.useCallback(async()=>{if(!(!v||!At.trim()||!T)){ie(true);try{await T(v.id,At.trim()),pt("");}finally{ie(false);}}},[v,At,T]),Jt=react.useCallback(S=>{let q=typeof S=="string"?new Date(S):S,Le=new Date().getTime()-q.getTime(),ze=Math.floor(Le/6e4),je=Math.floor(Le/36e5),Re=Math.floor(Le/864e5);return ze<1?n==="es"?"Ahora":"Just now":ze<60?n==="es"?`Hace ${ze} min`:`${ze}m ago`:je<24?n==="es"?`Hace ${je}h`:`${je}h ago`:Re<7?n==="es"?`Hace ${Re}d`:`${Re}d ago`:q.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),zt=react.useCallback(S=>{if(!v)return;let q=v.progress||0;S==="completed"?q=100:S==="in-progress"&&q===0?q=10:S==="todo"&&(q=0);let be={...v,status:S,progress:q};ke(be),w(false);},[v,ke]),Dt=react.useCallback((S,q)=>{if(!v)return;let be={...v,startDate:S,endDate:q};ke(be);},[v,ke]),mt=react.useCallback(()=>{let S=te.getFullYear(),q=te.getMonth(),be=new Date(S,q,1),ze=new Date(S,q+1,0).getDate(),je=be.getDay(),Re=[],at=new Date(S,q,0).getDate();for(let _=je-1;_>=0;_--)Re.push({date:new Date(S,q-1,at-_),isCurrentMonth:false});for(let _=1;_<=ze;_++)Re.push({date:new Date(S,q,_),isCurrentMonth:true});let st=42-Re.length;for(let _=1;_<=st;_++)Re.push({date:new Date(S,q+1,_),isCurrentMonth:false});return Re},[te]),Qt=react.useCallback(async S=>{if(S.preventDefault(),S.stopPropagation(),H(false),!v||!d)return;let q=Array.from(S.dataTransfer.files);if(q.length!==0){Me(true);try{await d(v.id,q);}finally{Me(false);}}},[v,d]),Ea=react.useCallback(async S=>{if(!v||!d||!S.target.files)return;let q=Array.from(S.target.files);if(q.length!==0){Me(true);try{await d(v.id,q);}finally{Me(false);}S.target.value="";}},[v,d]),oe=react.useCallback(S=>{S.preventDefault(),S.stopPropagation(),H(true);},[]),pe=react.useCallback(S=>{S.preventDefault(),S.stopPropagation(),H(false);},[]),ua=react.useCallback(S=>S<1024?`${S} B`:S<1024*1024?`${(S/1024).toFixed(1)} KB`:`${(S/(1024*1024)).toFixed(1)} MB`,[]),ue=react.useCallback(S=>S.startsWith("image/")?lucideReact.Image:S.includes("pdf")||S.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!v?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",b?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:f("w-4 h-4",b?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",b?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:f("text-xs font-mono",b?"text-[#6B7280]":"text-gray-400"),children:v.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",b?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:a,className:f("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let S=v.progress===100?0:100,be={...v,progress:S,status:S===100?"completed":"todo"};ke(be);},className:f("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",v.progress===100?"bg-green-500 border-green-500":b?"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("input",{type:"text",value:We,onChange:S=>Pt(S.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:f("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",v.progress===100?"line-through text-[#6B7280]":b?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Pe(),w(!k);},className:f("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":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:v.progress===100||v.status==="completed"?n==="es"?"COMPLETADO":"DONE":v.progress&&v.progress>0||v.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>w(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(S=>jsxRuntime.jsxs("button",{onClick:()=>zt(S.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",v.status===S.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",S.color)}),jsxRuntime.jsx("span",{className:b?"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:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Pe(),I(!N);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[v.assignees&&v.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[v.assignees.slice(0,3).map((S,q)=>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()},q)),v.assignees.length>3&&jsxRuntime.jsxs("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:["+",v.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:f("text-sm",b?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",b?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&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:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:p.length>0?p.map(S=>{let q=v.assignees?.some(be=>be.name===S.name);return jsxRuntime.jsxs("button",{onClick:()=>{let be=v.assignees||[],Le;q?Le=be.filter(ze=>ze.name!==S.name):Le=[...be,S],Ue("assignees",Le);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",q&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:S.color||"#8B5CF6"},children:S.initials||S.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:f("flex-1",b?"text-white":"text-gray-900"),children:S.name}),q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},S.name)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{K(B?null:"start"),se(v.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[v.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:f("mx-1",b?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),v.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>K(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:f("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:f("w-44 py-2 border-r",b?"border-white/10":"border-gray-200"),children:[(()=>{let S=new Date,q=new Date(S);q.setDate(S.getDate()+1);let be=new Date(S);be.setDate(S.getDate()+((6-S.getDay()+7)%7||7));let Le=new Date(S);Le.setDate(S.getDate()+((1-S.getDay()+7)%7||7));let ze=new Date(S);ze.setDate(S.getDate()+(6-S.getDay()+7)%7+7);let je=new Date(S);je.setDate(S.getDate()+14);let Re=new Date(S);return Re.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:q,display:q.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:be,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Le,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ze,display:ze.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:je,display:je.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Re,display:Re.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((st,_)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",b?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(B==="start"){let ae=v.endDate&&st.date>v.endDate?st.date:v.endDate;Dt(st.date,ae),K("end");}else {let ae=v.startDate&&st.date<v.startDate?st.date:v.startDate;Dt(ae,st.date),K(null);}},children:[jsxRuntime.jsx("span",{children:st.label}),jsxRuntime.jsx("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:st.display})]},_))})(),jsxRuntime.jsx("div",{className:f("border-t mt-2 pt-2",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Dt(void 0,void 0),K(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",b?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:f("text-xs mb-3 px-2 py-1 rounded",b?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:B==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:f("font-medium",b?"text-white":"text-gray-900"),children:te.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>se(new Date),className:f("p-1 rounded text-sm transition-colors",b?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>se(new Date(te.getFullYear(),te.getMonth()-1)),className:f("p-1 rounded",b?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>se(new Date(te.getFullYear(),te.getMonth()+1)),className:f("p-1 rounded",b?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(S=>jsxRuntime.jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",b?"text-[#6B7280]":"text-gray-400"),children:S},S))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:mt().map((S,q)=>{let be=S.date.toDateString()===new Date().toDateString(),Le=v.startDate?.toDateString()===S.date.toDateString(),ze=v.endDate?.toDateString()===S.date.toDateString(),je=Le||ze,Re=v.startDate&&v.endDate&&S.date>=v.startDate&&S.date<=v.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let at=new Date(S.date);if(B==="start"){let st=v.endDate&&at>v.endDate?at:v.endDate;Dt(at,st),K("end");}else {let st=v.startDate&&at<v.startDate?at:v.startDate;Dt(st,at),K(null);}},className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!S.isCurrentMonth&&(b?"text-[#4B5563]":"text-gray-300"),S.isCurrentMonth&&(b?"text-white":"text-gray-900"),be&&"ring-2 ring-[#3B82F6]",Le&&"bg-[#3B82F6] text-white",ze&&!Le&&"bg-[#7C3AED] text-white",Re&&!je&&(b?"bg-[#7C3AED]/20":"bg-purple-100"),!je&&(b?"hover:bg-white/10":"hover:bg-gray-100")),children:S.date.getDate()},q)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Pe(),M(!R);},className:f("text-xs px-2 py-1 rounded font-medium 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":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:v.priority?v.priority==="high"||v.priority==="urgent"?n==="es"?"Alta":"High":v.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>M(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(S=>jsxRuntime.jsxs("button",{onClick:()=>{Ue("priority",S.id),M(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",v.priority===S.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",S.color)}),jsxRuntime.jsx("span",{className:b?"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:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:f("text-sm",b?"text-white":"text-gray-900"),children:v.startDate&&v.endDate?`${Math.ceil((v.endDate.getTime()-v.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full border-2",b?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[le?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:v.progress||0,onChange:S=>{let q=parseInt(S.target.value),be=v.status;q===100?be="completed":q>0?be="in-progress":be="todo";let Le={...v,progress:q,status:be};ke(Le);},onBlur:()=>ye(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",b?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>ye(true),className:f("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",b?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",v.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${v.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium min-w-[40px]",b?"text-white":"text-gray-900"),children:[v.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(nr,{selectedTags:v.tags||[],availableTags:m,onChange:S=>{Ue("tags",S);},onCreateTag:i,theme:y})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:f("w-4 h-4 mt-1.5",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24 mt-1",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="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(S=>{let q=h.find(be=>be.id===S);return jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",b?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[q?.name||S.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let be=(v.dependencies||[]).filter(Le=>Le!==S);Ue("dependencies",be);},className:f("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S)})}),jsxRuntime.jsxs("button",{onClick:()=>{Pe(),Q(!$);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:f("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Q(false),G("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("p-2 border-b",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:U,onChange:S=>G(S.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",b?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:h.length>0?h.filter(S=>S.id!==v.id).filter(S=>U===""||S.name.toLowerCase().includes(U.toLowerCase())).map(S=>{let q=v.dependencies?.includes(S.id);return jsxRuntime.jsxs("button",{onClick:()=>{let be=v.dependencies||[],Le;q?Le=be.filter(ze=>ze!==S.id):Le=[...be,S.id],Ue("dependencies",Le);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",q&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",q?"bg-blue-500 border-blue-500":b?"border-white/30":"border-gray-300"),children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:f("block truncate",b?"text-white":"text-gray-900"),children:S.name}),jsxRuntime.jsx("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:S.id.slice(0,8)})]})]},S.id)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Pe(),Z(!A);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:v.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:f("text-sm",b?"text-white":"text-gray-900"),children:sr.find(S=>S.value===v.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",b?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:A&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Z(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:sr.map(S=>{let q=v.color===S.value;return jsxRuntime.jsx("button",{onClick:()=>{Ue("color",S.value),Z(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",q&&"ring-2 ring-offset-2",b?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:S.value,outlineColor:q?S.value:void 0},title:S.name,children:q&&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:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:v.isMilestone||false,onChange:S=>Ue("isMilestone",S.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",v.isMilestone?"bg-purple-500 border-purple-500":b?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:f("text-sm",b?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",b?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:Oe,onChange:S=>rt(S.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:f("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",b?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-2 text-sm mt-2 transition-colors",b?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),v.subtasks&&v.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:v.subtasks.map(S=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",S.progress===100?"bg-green-500 border-green-500":b?"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:f("text-sm",S.progress===100?"line-through text-[#6B7280]":b?"text-white":"text-gray-900"),children:S.name})]},S.id))}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",b?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:f("p-1 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",b?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(S=>{let q=ue(S.type),be=S.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[be&&S.thumbnailUrl?jsxRuntime.jsx("img",{src:S.thumbnailUrl,alt:S.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",b?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(q,{className:f("w-5 h-5",b?"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:f("text-sm font-medium truncate block hover:underline",b?"text-white":"text-gray-900"),children:S.name}),jsxRuntime.jsx("p",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:ua(S.size)})]}),g&&jsxRuntime.jsx("button",{onClick:()=>g(S.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",b?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},S.id)})}),jsxRuntime.jsxs("div",{onDragOver:oe,onDragLeave:pe,onDrop:Qt,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",J?b?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":b?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",Te&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Ea,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||Te}),Te?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:f("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:f("w-6 h-6 mx-auto mb-2",J?"text-blue-500":b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:J?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsxRuntime.jsx("p",{className:f("text-xs mt-1",b?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:f("w-80 border-l flex flex-col",b?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold",b?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",C.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",b?"text-[#6B7280]":"text-gray-400"),children:["(",C.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:C.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:C.map(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:f("text-sm font-medium",b?"text-white":"text-gray-900"),children:S.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:Jt(S.createdAt)})]}),jsxRuntime.jsx("p",{className:f("text-sm break-words",b?"text-[#9CA3AF]":"text-gray-600"),children:S.content})]})]},S.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:f("w-10 h-10 mb-3",b?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:f("text-sm",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:f("p-4 border-t",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[c&&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:c.color||"#8B5CF6"},children:c.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:f("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",b?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",value:At,onChange:S=>pt(S.target.value),onKeyDown:S=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),Fe());},placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",disabled:O||!T,className:f("flex-1 bg-transparent text-sm outline-none",b?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(O||!T)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:Fe,disabled:O||!At.trim()||!T,className:f("p-1.5 rounded transition-colors",At.trim()&&T?"bg-blue-500 text-white hover:bg-blue-600":b?"text-[#6B7280]":"text-gray-400",O&&"opacity-50 cursor-not-allowed"),children:O?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]})]})})]})]})]})})}function ks(){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 Er({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:p,isLoading:m,error:i,children:u,availableTags:d=[],onCreateTag:g,attachmentsByCard:h,onUploadAttachments:C,onDeleteAttachment:T,comments:c,onAddComment:b,currentUser:y,onTaskOpen:l}){let[x,v]=ks(),[D,k]=react.useState(null),w=o?.theme||"dark",R=w==="dark"||w==="neutral",M=R?"dark":"",N=react.useCallback((A,Z)=>{t.onCardUpdate?.(A,Z);},[t]),I=react.useCallback((A,Z)=>{t.onColumnUpdate?.(A,{title:Z});},[t]),B=react.useCallback(A=>{t.onColumnDelete?.(A);},[t]),K=["todo","in-progress","completed"],te=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 A=new Map;return e.columns.forEach(Z=>{let J=Z.cardIds.map(H=>e.cards.find(Te=>Te.id===H)).filter(H=>H!==void 0).sort((H,Te)=>H.position-Te.position);A.set(Z.id,J);}),A},[e.cards,e.columns]),le=react.useMemo(()=>e.cards.map(A=>({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(),dependencies:Array.isArray(A.dependencies)?A.dependencies.map(Z=>typeof Z=="string"?Z:Z.taskId):[]})),[e.cards]),ye=react.useCallback(A=>{let{active:Z}=A,J=e.cards.find(H=>H.id===Z.id);J&&v({isDragging:true,draggedCardId:J.id,sourceColumnId:J.columnId,targetColumnId:J.columnId});},[e.cards,v]),$=react.useCallback(A=>{let{active:Z,over:J}=A;if(!J||!e.cards.find(Me=>Me.id===Z.id))return;let Te=null;J.data.current?.type==="column"?Te=J.id:J.data.current?.type==="card"&&(Te=e.cards.find(Oe=>Oe.id===J.id)?.columnId||null),Te&&Te!==x.targetColumnId&&v({...x,targetColumnId:Te});},[e.cards,x,v]),Q=react.useCallback(async A=>{let{active:Z,over:J}=A;if(v({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!J)return;let H=e.cards.find(xe=>xe.id===Z.id);if(!H)return;let Te,Me;if(J.data.current?.type==="column"){Te=J.id;let xe=se.get(Te)||[];Me=ns(xe,0);}else {let xe=e.cards.find(tt=>tt.id===J.id);if(!xe)return;Te=xe.columnId;let Ye=se.get(Te)||[],We=Ye.findIndex(tt=>tt.id===J.id);Me=ns(Ye,We);}let Oe=e.columns.find(xe=>xe.id===Te);if(Oe&&Oe.wipLimit&&Oe.wipLimitType==="hard"){let xe=se.get(Te)||[];if(H.columnId!==Te&&xe.length>=Oe.wipLimit){t.onWipLimitExceeded?.(Oe,H);return}}(H.columnId!==Te||H.position!==Me)&&await t.onCardMove?.(H.id,Te,Me);},[e.cards,e.columns,se,t,v]),U=react.useCallback(A=>{k(A),a?.(A),l?.(A.id);},[a,l]),G=react.useCallback(A=>{t.onCardUpdate?.(A.id,A),k(A);},[t]);return m?jsxRuntime.jsx("div",{className:f("asakaa-board",M,n),style:p,children:jsxRuntime.jsx(wu,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:f("asakaa-board",M,n),style:p,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(Il,{themeName:w,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:te,collisionDetection:core$1.closestCorners,onDragStart:ye,onDragOver:$,onDragEnd:Q,children:[jsxRuntime.jsxs("div",{className:f("asakaa-board",M,n),style:p,"data-theme":w,children:[e.columns.sort((A,Z)=>A.position-Z.position).map(A=>{let Z=se.get(A.id)||[],J=!K.includes(A.id);return jsxRuntime.jsx(io,{column:A,cards:Z,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:U,onCardUpdate:N,onColumnRename:I,onColumnDelete:B,isDeletable:J,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},A.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:x.draggedCardId?jsxRuntime.jsx(ur,{card:e.cards.find(A=>A.id===x.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(_r,{task:D,isOpen:!!D,onClose:()=>k(null),onCardUpdate:G,theme:R?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:g,attachments:D?h?.get(D.id)||[]:[],onUploadAttachments:C,onDeleteAttachment:T,availableTasks:le,comments:c,onAddComment:b,currentUser:y})]})}function wu({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 Su={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)"},Eu={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)"},Pu={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Mu={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Au({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),p=react.useRef(null);react.useEffect(()=>{let i=u=>{p.current&&!p.current.contains(u.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let m=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:p,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,u)=>i.position-u.position).map((i,u)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Fu({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[p,m]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let h=C=>{i.current&&!i.current.contains(C.target)&&n(false);};return s&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(h=>h.handler),g=async(h,C)=>{if(C){m(h);try{await C();}catch(T){console.error(`Export ${h} failed:`,T);}finally{m(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((h,C)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>g(h.id,h.handler),disabled:p!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:C<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:C*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:p===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 Lu({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 Cs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:p,onExportExcel:m,translations:i}){let u=r==="dark"?Su:Eu,d={...o==="es"?Pu:Mu,...i},g=n||p||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:u.bgGrid,borderColor:u.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Fu,{theme:u,t:d,onExportCSV:n,onExportJSON:p,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),t&&(s?jsxRuntime.jsx(Au,{columns:e,onSelect:t,theme:u,t:d,createTaskLabel:a}):jsxRuntime.jsx(Lu,{onClick:()=>t(),label:a||d.newTask}))]})})}function Ns({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[p,m]=react.useState(""),i=react.useCallback(()=>{let g=p.trim();g&&(e(g),m(""),n(false));},[p,e]),u=react.useCallback(g=>{g.key==="Enter"?(g.preventDefault(),i()):g.key==="Escape"&&(m(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{p.trim()||n(false);},150);},[p]);return s?jsxRuntime.jsx("div",{className:f("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:p,onChange:g=>m(g.target.value),onKeyDown:u,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!p.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{m(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:f("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Ds({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:p="dark",locale:m="es"}){let[i,u]=react.useState(false),[d,g]=react.useState(false),[h,C]=react.useState(""),[T,c]=react.useState([]),[b,y]=react.useState(""),[l,x]=react.useState(""),[v,D]=react.useState(""),[k,w]=react.useState(false),[R,M]=react.useState(false),[N,I]=react.useState(false),B=react.useRef(null),K=react.useRef(null),te={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},se=react.useCallback(()=>{C(""),c([]),y(""),x(""),D(""),w(false),M(false),I(false),u(false);},[]);react.useEffect(()=>{i&&B.current&&B.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let U=G=>{K.current&&!K.current.contains(G.target)&&(h.trim()||se());};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[i,h,se]);let le=react.useCallback(async()=>{let U=h.trim();if(!(!U||d)){g(true);try{await t({name:U,columnId:e,assigneeIds:T.length>0?T:void 0,startDate:b?new Date(b):void 0,endDate:l?new Date(l):void 0,priority:v||void 0}),C(""),c([]),y(""),x(""),D(""),w(!1),M(!1),I(!1),B.current?.focus();}catch(G){console.error("Error creating card:",G);}finally{g(false);}}},[h,e,T,b,l,v,t,d]),ye=react.useCallback(U=>{U.key==="Enter"&&!U.shiftKey?(U.preventDefault(),le()):U.key==="Escape"&&se();},[le,se]),$=react.useCallback(U=>{c(G=>G.includes(U)?G.filter(A=>A!==U):[...G,U]);},[]),Q=p==="dark";return i?jsxRuntime.jsxs("div",{ref:K,className:f("rounded-lg overflow-hidden shadow-lg",Q?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:B,type:"text",value:h,onChange:U=>C(U.target.value),onKeyDown:ye,placeholder:te.placeholder,disabled:d,className:f("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Q?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>w(!k),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",k||T.length>0?"bg-emerald-500/20 text-emerald-400":Q?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),T.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:T.length})]}),jsxRuntime.jsx("button",{onClick:()=>M(!R),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",R||b||l?"bg-blue-500/20 text-blue-400":Q?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>I(!N),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",N||v?v==="urgent"?"bg-red-500/20 text-red-400":v==="high"?"bg-orange-500/20 text-orange-400":v==="medium"?"bg-yellow-500/20 text-yellow-400":v==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Q?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:le,disabled:!h.trim()||d,className:f("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):te.save})]})]}),k&&a.length>0&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",Q?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(U=>jsxRuntime.jsxs("button",{onClick:()=>$(U.id),className:f("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",T.includes(U.id)?"bg-emerald-500 text-white":Q?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[U.avatar?jsxRuntime.jsx("img",{src:U.avatar,alt:U.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",T.includes(U.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:U.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:U.name.split(" ")[0]})]},U.id))})}),R&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",Q?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-[10px] uppercase tracking-wide mb-1",Q?"text-gray-500":"text-gray-400"),children:te.startDate}),jsxRuntime.jsx("input",{type:"date",value:b,onChange:U=>y(U.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",Q?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-[10px] uppercase tracking-wide mb-1",Q?"text-gray-500":"text-gray-400"),children:te.endDate}),jsxRuntime.jsx("input",{type:"date",value:l,onChange:U=>x(U.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",Q?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),N&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",Q?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(U=>jsxRuntime.jsx("button",{onClick:()=>D(v===U?"":U),className:f("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",v===U?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[U]} text-white`:Q?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:te[U]},U))})})]}):jsxRuntime.jsxs("button",{onClick:()=>u(true),disabled:n,className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Q?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:te.buttonLabel})]})}var Mo=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(Er,{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 yd(e={}){return new Mo(e)}var co=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 Ss(e,t){let a=r=>jsxRuntime.jsx(co,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Ps({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:p,onOpenAIUsage:m,shortcut:i="k",className:u=""}){let[d,g]=react.useState(false),[h,C]=react.useState(""),[T,c]=react.useState("home"),[b,y]=react.useState(""),[l,x]=react.useState("");react.useEffect(()=>{let w=R=>{(R.metaKey||R.ctrlKey)&&R.key===i&&(R.preventDefault(),g(M=>!M)),R.key==="Escape"&&(g(false),c("home"),C(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),react.useEffect(()=>{d||(c("home"),C(""),y(""),x(""));},[d]);let v=react.useCallback(()=>{g(false);},[]),D=react.useCallback(w=>{let[R,M]=w.split(":");switch(R){case "create-card":c("create-card");break;case "create-card-in":y(M||"");break;case "navigate":M?(a?.(M),v()):c("navigate");break;case "search":r?.(h),v();break;case "priority":c("priority");break;case "set-priority":l&&M&&(o?.(l,M),v());break;case "assign":c("assign");break;case "assign-user":l&&M&&(s?.(l,M),v());break;case "ai":c("ai");break;case "ai-generate-plan":n?.(),v();break;case "ai-predict-risks":p?.(),v();break;case "ai-usage":m?.(),v();break;case "back":c("home");break;}},[h,l,t,a,r,o,s,n,p,m,v]),k=react.useCallback(()=>{b&&h.trim()&&(t?.(b,h.trim()),v());},[b,h,t,v]);return d?jsxRuntime.jsx(dt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:v,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:h,onValueChange:C,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:T==="create-card"&&b?"Type card title and press Enter...":T==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&T==="create-card"&&b&&k();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),T==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(R=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:R},R))})]},w.id))})]}),T==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${w.id}`,onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:w.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),T==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(w=>{let R=e.columns.find(M=>M.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:D,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:w.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:R?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(M=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:M},M))})]},w.id)})})]}),T==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function kd(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=`
4
+ `);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=Pl(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let p=Pl(t[n]||"");if(p.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-p.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${p.length})`);continue}for(;p.length<a.length;)p.push("");let i={};a.forEach((h,C)=>{i[h]=p[C]||"";});let u=i.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let d=o.get(u),g={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(g),d.cardIds.push(g.id);}catch(p){s.push(`Line ${n+1}: ${p instanceof Error?p.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Pl(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 Ml(e,t){switch(t){case "json":return up(e);case "csv":return gp(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Al(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 ds=react.createContext(null);function Fl(){return react.useContext(ds)}var Ll=react.createContext(null);function Il({children:e,themeName:t}){return jsxRuntime.jsx(Ll.Provider,{value:{themeName:t},children:e})}function oo(){return react.useContext(Ll)}function lt({children:e,container:t}){let[a,r]=react.useState(false),o=Fl(),s=oo();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:p,themeName:m}=o,i={"--asakaa-color-background-primary":p.bgPrimary,"--asakaa-color-background-secondary":p.bgSecondary,"--asakaa-color-background-card":p.bgGrid,"--asakaa-color-background-hover":p.hoverBg,"--asakaa-color-text-primary":p.textPrimary,"--asakaa-color-text-secondary":p.textSecondary,"--asakaa-color-text-tertiary":p.textTertiary,"--asakaa-color-text-inverse":p.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":p.border,"--asakaa-color-border-hover":p.borderLight,"--asakaa-color-border-subtle":p.borderLight,"--asakaa-color-interactive-primary":p.accent,"--asakaa-color-interactive-primaryHover":p.accentHover,"--asakaa-color-interactive-primaryBorder":`${p.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${p.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${p.accent}33`,"--asakaa-color-status-success":p.statusCompleted,"--asakaa-color-status-warning":p.milestone,"--asakaa-color-status-error":p.criticalPath,"--asakaa-color-danger":p.criticalPath,"--asakaa-color-danger-border":`${p.criticalPath}4D`,"--asakaa-color-danger-background":`${p.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${p.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":m,"data-gantt-portal":"true",style: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 zl={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},wp="#BDC3C7",Cp=({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 zr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),p=react.useRef(null),m=react.useRef(null),i=()=>{if(!m.current)return;let h=m.current.getBoundingClientRect(),C=window.innerHeight,T=window.innerWidth,c=160,b=220,y=4,l=h.right-c;l<10&&(l=h.left),l+c>T-10&&(l=T-c-10);let x=C-h.bottom,v=h.top,S;x>=b+y?S=h.bottom+y:v>=b+y?S=h.top-b-y:S=x>=v?h.bottom+y:Math.max(10,h.top-b-y),n({top:S,left:l}),o(true);};react.useEffect(()=>{let h=C=>{p.current&&!p.current.contains(C.target)&&!m.current?.contains(C.target)&&o(false);};if(r)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[r]),react.useEffect(()=>{let h=C=>{C.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[r]);let u=h=>{t(h),o(false);},d=e?zl[e]:null,g=d?.color||wp;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${g}10`:"transparent",boxShadow:e?`0 0 0 2px ${g}30 inset`:"none"},title:d?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:g,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:g,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsxs("div",{ref:p,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(zl).map(([h,C])=>jsxRuntime.jsxs("button",{onClick:()=>u(h),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:C.color,background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:T=>{T.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Cp,{color:C.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:C.label}),e===h&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Tp=[{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 To({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,p]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),g=(oo()?.themeName||"dark")==="dark",h=()=>{if(!i.current)return;let l=i.current.getBoundingClientRect(),x=window.innerHeight,v=window.innerWidth,S=320,k=380,w=4,R=l.left;R+S>v-10&&(R=v-S-10),R<10&&(R=10);let M=x-l.bottom,D=l.top,I;M>=k+w?I=l.bottom+w:D>=k+w?I=l.top-k-w:I=M>=D?l.bottom+w:Math.max(10,l.top-k-w),p({top:I,left:R}),s(true);};react.useEffect(()=>{let l=x=>{m.current&&!m.current.contains(x.target)&&!i.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[o]),react.useEffect(()=>{let l=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[o]);let C=l=>{let x=new Date,v=R=>{let M=R.getFullYear(),D=String(R.getMonth()+1).padStart(2,"0"),I=String(R.getDate()).padStart(2,"0");return `${M}-${D}-${I}`},S=v(x),k=new Date(x);k.setDate(k.getDate()+l);let w=v(k);a(S,w),s(false);},T=()=>{if(!e||!t)return "Set date";let l=k=>{if(k instanceof Date)return k;if(typeof k!="string"||!k.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=k.split("-").map(Number);if(w.length!==3||w.some(I=>isNaN(I)))return null;let R=w[0],M=w[1],D=w[2];return R===void 0||M===void 0||D===void 0?null:new Date(R,M-1,D)},x=l(e),v=l(t);if(!x||!v||isNaN(x.getTime())||isNaN(v.getTime()))return "Set date";let S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${S[x.getMonth()]} ${x.getDate()} \u2013 ${S[v.getMonth()]} ${v.getDate()}`},c=e&&t,y=(()=>{if(!t)return false;let l=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),l<x})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):h(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${y?"asakaa-date-overdue":"asakaa-date"}`,title:c?`${T()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:T()})]}),o&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:g?"#1A1D25":"#FFFFFF",border:`1px solid ${g?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:g?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:g?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:g?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:Tp.map(l=>jsxRuntime.jsx("button",{onClick:()=>C(l.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:l.label},l.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:g?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:l=>a(l.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:l=>a(e,l.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:l=>{l.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:l=>{l.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Hr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[p,m]=react.useState(""),[i,u]=react.useState({top:0,left:0}),d=react.useRef(null),g=react.useRef(null),h=()=>{if(!g.current)return;let y=g.current.getBoundingClientRect(),l=window.innerHeight,x=window.innerWidth,v=300,S=380,k=4,w=y.right-v;w<10&&(w=y.left),w+v>x-10&&(w=x-v-10);let R=l-y.bottom,M=y.top,D;R>=S+k?D=y.bottom+k:M>=S+k?D=y.top-S-k:D=R>=M?y.bottom+k:Math.max(10,y.top-S-k),u({top:D,left:w}),n(true);};react.useEffect(()=>{let y=l=>{d.current&&!d.current.contains(l.target)&&!g.current?.contains(l.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),react.useEffect(()=>{let y=l=>{l.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let C=y=>{let l=e.some(x=>x.id===y.id);a(l?e.filter(x=>x.id!==y.id):[...e,y]);},T=t.filter(y=>y.name.toLowerCase().includes(p.toLowerCase())),c=e.slice(0,o),b=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:g,onClick:()=>s?n(false):h(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[c.map(y=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:y.name,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"asakaa-avatar-img"}):y.initials},y.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(lt,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:p,onChange:y=>m(y.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:T.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):T.map(y=>{let l=e.some(x=>x.id===y.id);return jsxRuntime.jsxs("button",{onClick:()=>C(y),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:y.color,color:"#fff"},children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.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:y.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:l?"#3b82f6":"transparent"},children:l?"\u2713":""})]},y.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 on(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let i=m.dependencies.map(u=>{if(typeof u=="string")return u;let d=u;return d.taskId||d.targetId||""}).filter(Boolean);r.set(m.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,p=m=>{if(!s.has(m)){s.add(m),n.add(m);let i=r.get(m)||[];for(let u of i){if(!s.has(u)&&p(u))return true;if(n.has(u))return true}}return n.delete(m),false};return p(a)}function Do({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[p,m]=react.useState(false),[i,u]=react.useState(""),[d,g]=react.useState(t.length>0),[h,C]=react.useState({top:0,left:0}),[T,c]=react.useState(null),b=react.useRef(null),y=react.useRef(null),l=()=>{if(!y.current)return;let w=y.current.getBoundingClientRect(),R=window.innerHeight,M=window.innerWidth,D=300,I=d?380:120,B=4,K=w.right-D;K<10&&(K=w.left),K+D>M-10&&(K=M-D-10);let te=R-w.bottom,ie=w.top,de;te>=I+B?de=w.bottom+B:ie>=I+B?de=w.top-I-B:de=te>=ie?w.bottom+B:Math.max(10,w.top-I-B),C({top:de,left:K}),m(true);};react.useEffect(()=>{if(!p||!y.current)return;let w=y.current.getBoundingClientRect(),R=window.innerHeight,M=window.innerWidth,D=300,I=d?380:120,B=4,K=w.right-D;K<10&&(K=w.left),K+D>M-10&&(K=M-D-10);let te=R-w.bottom,ie=w.top,de;te>=I+B?de=w.bottom+B:ie>=I+B?de=w.top-I-B:de=te>=ie?w.bottom+B:Math.max(10,w.top-I-B),C({top:de,left:K});},[d,p]),react.useEffect(()=>{let w=R=>{b.current&&!b.current.contains(R.target)&&!y.current?.contains(R.target)&&(m(false),u(""));};if(p)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[p]),react.useEffect(()=>{let w=R=>{R.key==="Escape"&&(m(false),u(""));};if(p)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[p]);let x=w=>{let R=t.includes(w),M=a.find(D=>D.id===w);if(c(null),R){let D=t.filter(I=>I!==w);r(D),D.length===0&&g(false);}else {if(s&&on(a,w,e)){let I=`Cannot add "${M?.title||w}" as dependency - would create circular reference`;c(I),n?.(w,M?.title||w),setTimeout(()=>c(null),3e3);return}r([...t,w]),g(true);}},v=()=>{let w=!d;g(w),w||r([]);},S=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),k=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:y,onClick:()=>p?m(false):l(),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:k,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:k},children:t.length})]}),p&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${h.top}px`,left:`${h.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[T&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:T})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:v,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:w=>u(w.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:S.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):S.map(w=>{let R=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>x(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:M=>{M.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:M=>{M.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:R?"#3b82f6":"transparent",borderColor:R?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:R&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:w.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),g(false),m(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var ur=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:p=[],allCards:m=[]})=>{let{attributes:i,listeners:u,setNodeRef:d,transform:g,transition:h,isDragging:C}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),T={transform:en.Transform.toString(g),transition:h};if(t)return jsxRuntime.jsx("div",{ref:d,style:T,...i,...u,onClick:()=>a?.(e),children:t(e)});let c=p.filter(x=>e.assignedUserIds?.includes(x.id)),b=e.progress===100,y=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),l={...T,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:l,className:f("asakaa-card",C&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:x=>{x.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:x=>{x.currentTarget.style.display="none";}})}),y.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:y.length===1&&y[0]?jsxRuntime.jsx("img",{src:y[0].url,alt:y[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:y.slice(0,4).map((x,v)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:S=>{S.currentTarget.style.display="none";}}),v===3&&y.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:["+",y.length-4]})})]},x.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:x=>x.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(zr,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(To,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(x,v)=>n?.(e.id,{startDate:x,endDate:v})})}),p.length>0&&jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Hr,{assignedUsers:c,availableUsers:p,onChange:x=>n?.(e.id,{assignedUserIds:x.map(v=>v.id)})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Do,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:m,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsxRuntime.jsx("span",{className:"asakaa-label",children:x},x))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));ur.displayName="Card";var nn={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"}},ql=({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 Xl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,p]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),u=[...Object.entries(nn).map(([c,b])=>({id:c,label:b.label,color:b.color,icon:b.icon})),...r.filter(c=>!Object.keys(nn).includes(c.id)).map(c=>({id:c.id,label:c.title,color:c.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let c=nn[e];if(c)return {...c,id:e};let b=r.find(y=>y.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...nn.todo,id:"todo"}},g=()=>{if(!i.current)return;let c=i.current.getBoundingClientRect(),b=window.innerHeight,y=window.innerWidth,l=180,x=280,v=4,S=c.right-l;S<10&&(S=c.left),S+l>y-10&&(S=y-l-10);let k=b-c.bottom,w=c.top,R;k>=x+v?R=c.bottom+v:w>=x+v?R=c.top-x-v:R=k>=w?c.bottom+v:Math.max(10,c.top-x-v),p({top:R,left:S}),s(true);};react.useEffect(()=>{let c=b=>{m.current&&!m.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(o)return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[o]),react.useEffect(()=>{let c=b=>{b.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[o]);let h=c=>{t(c),s(false);},C=d(),T=C.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):g(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${T}10`,boxShadow:`0 0 0 2px ${T}30 inset`},title:C.label,children:jsxRuntime.jsx(ql,{icon:C.icon,color:T})}),o&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:u.map(c=>jsxRuntime.jsxs("button",{onClick:()=>h(c.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:c.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(ql,{icon:c.icon,color:c.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:c.label}),e===c.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"})})]},c.id))})]})})]})}function Jl({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[p,m]=react.useState(false),[i,u]=react.useState(e),[d,g]=react.useState({top:0,left:0}),h=react.useRef(null),C=react.useRef(null),T=react.useRef(null);react.useEffect(()=>{if(s&&C.current){let l=C.current.getBoundingClientRect();g({top:l.bottom+window.scrollY+8,left:l.left+window.scrollX});}},[s]),react.useEffect(()=>{let l=x=>{h.current&&!h.current.contains(x.target)&&!C.current?.contains(x.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]),react.useEffect(()=>{let l=x=>{x.key==="Escape"&&(n(false),m(false),u(e));};if(s)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[s,e]),react.useEffect(()=>{p&&T.current&&(T.current.focus(),T.current.select());},[p]);let c=()=>{m(true),u(e);},b=()=>{let l=i.trim();l&&l!==e&&t(l),m(false),n(false),u(e);},y=l=>{l.key==="Enter"?b():l.key==="Escape"&&(m(false),u(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:C,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsx("div",{ref:h,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:p?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:T,type:"text",value:i,onChange:l=>u(l.target.value),onKeyDown:y,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:c,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 io=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:p,availableUsers:m,allCards:i,enableVirtualization:u,cardHeight:d=120,isCollapsed:g,onToggleCollapse:h,onColumnRename:C,onColumnDelete:T,isDeletable:c=false,className:b})=>{let{setNodeRef:y,isOver:l}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),x=react.useRef(null),v=u??Cl(t.length),S=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>d,enabled:v});if(a)return jsxRuntime.jsx("div",{ref:y,className:b,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let D=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:D}:D>=80?{state:"warning",percentage:D}:D>=60?{state:"approaching",percentage:D}:{state:"ok",percentage:D}})(),R=w.state==="exceeded",M=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:y,className:f("asakaa-column",l&&"ring-2 ring-asakaa-accent-blue",R&&"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:f(M()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&w.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${w.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[w.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),w.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),w.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),w.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(C||T)&&jsxRuntime.jsx(Jl,{columnTitle:e.title,onRename:D=>C?.(e.id,D),onDelete:T?()=>T(e.id):void 0,isDeletable:c}),h&&jsxRuntime.jsx("button",{onClick:h,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":g?"Expand column":"Collapse column",children:g?"\u25B6":"\u25BC"})]})]}),!g&&jsxRuntime.jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:v?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(D=>D.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"})}):v?jsxRuntime.jsx("div",{style:{height:`${S.getTotalSize()}px`,position:"relative"},children:S.getVirtualItems().map(D=>{let I=t[D.index];return I?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${D.start}px)`},children:jsxRuntime.jsx(ur,{card:I,render:r,onClick:n,onUpdate:p,availableUsers:m,allCards:i})},I.id):null})}):t.map(D=>jsxRuntime.jsx(ur,{card:D,render:r,onClick:n,onUpdate:p,availableUsers:m,allCards:i},D.id))})})]})});io.displayName="Column";function gs({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),p=react.useRef(null);react.useEffect(()=>{r&&p.current&&(p.current.focus(),p.current.select());},[r]);let m=()=>{let u=s.trim();u&&u!==e?t(u):n(e),o(false);},i=u=>{u.key==="Enter"?m():u.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:p,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:m,onKeyDown:i,className:f("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:f("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}var cn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function nr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[p,m]=react.useState(false),[i,u]=react.useState(""),[d,g]=react.useState(false),[h,C]=react.useState(cn[10]||"#3B82F6"),[T,c]=react.useState({top:0,left:0}),b=react.useRef(null),y=react.useRef(null),l=react.useRef(null),x=react.useRef(null),v=t.filter(D=>D.name.toLowerCase().includes(i.toLowerCase())),S=t.some(D=>D.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(p&&y.current){let D=y.current.getBoundingClientRect();c({top:D.bottom+6,left:D.left});}},[p]),react.useEffect(()=>{let D=I=>{let B=I.target,K=b.current?.contains(B),te=l.current?.contains(B);!K&&!te&&(m(false),u(""),g(false));};if(p)return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[p]),react.useEffect(()=>{p&&x.current&&x.current.focus();},[p]);let k=D=>{let I=e.some(B=>B.id===D.id);a(I?e.filter(B=>B.id!==D.id):[...e,D]);},w=async()=>{if(!(!r||!i.trim())){g(true);try{let D=await r(i.trim(),h);D&&(a([...e,D]),u(""),C(cn[Math.floor(Math.random()*cn.length)]||"#3B82F6"));}finally{g(false);}}},R=(D,I)=>{I.stopPropagation(),a(e.filter(B=>B.id!==D));},M={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:y,type:"button",onClick:()=>!s&&m(!p),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:M,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(D=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${D.color}20`,color:D.color},children:D.name},D.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:l,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:T.top,left:T.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:x,type:"text",value:i,onChange:D=>u(D.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:D=>{D.key==="Enter"&&i.trim()&&!S&&r&&w();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(D=>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:`${D.color}20`,color:D.color},onClick:I=>R(D.id,I),children:[D.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},D.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:v.length>0?v.map(D=>{let I=e.some(B=>B.id===D.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>k(D),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:I?`${D.color}15`:"transparent",color:o.textPrimary},onMouseEnter:B=>{I||(B.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:B=>{I||(B.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:D.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:D.name}),I&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:D.color}})]},D.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()&&!S&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:cn.map(D=>jsxRuntime.jsx("button",{type:"button",onClick:()=>C(D),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:D,outline:h===D?`2px solid ${D}`:"none",outlineOffset:"2px"}},D))}),jsxRuntime.jsxs("button",{type:"button",onClick:w,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:h,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function hs({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 td({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(hs,{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 sr=[{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 sd(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 cu(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 _r({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:p=[],availableTags:m=[],onCreateTag:i,attachments:u=[],onUploadAttachments:d,onDeleteAttachment:g,availableTasks:h=[],comments:C=[],onAddComment:T,currentUser:c}){let b=s==="dark",y={textTertiary:b?"#6B7280":"#9CA3AF",textSecondary:b?"#9CA3AF":"#6B7280",textPrimary:b?"#FFFFFF":"#111827",borderLight:b?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:b?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:b?"#1A1D25":"#FFFFFF",bgSecondary:b?"#0F1117":"#F9FAFB",hoverBg:b?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},l=e&&"title"in e&&!("name"in e),x=e,[v,S]=react.useState(e?sd(e,p):null),[k,w]=react.useState(false),[R,M]=react.useState(false),[D,I]=react.useState(false),[B,K]=react.useState(null),[te,ie]=react.useState(new Date),[de,be]=react.useState(false),[$,J]=react.useState(false),[U,G]=react.useState(""),[A,Q]=react.useState(false),[X,H]=react.useState(false),[Ce,Me]=react.useState(false),[Oe,ye]=react.useState(""),Ye=react.useRef(null),[We,et]=react.useState(""),vt=react.useRef(null),[Mt,mt]=react.useState(""),[O,le]=react.useState(false);react.useEffect(()=>{if(e){let N=sd(e,p);S(N),ye(N.description||""),et(N.name||"");}},[e?.id,p]),react.useEffect(()=>()=>{Ye.current&&clearTimeout(Ye.current),vt.current&&clearTimeout(vt.current);},[]);let xe=react.useCallback(N=>{S(N),l&&o&&x?o(cu(N,x)):r&&r(N);},[l,x,o,r]),Pe=react.useCallback(()=>{w(false),M(false),I(false),K(null),J(false),G(""),Q(false);},[]),ze=react.useCallback((N,ee)=>{if(!v)return;let se={...v,[N]:ee};xe(se);},[v,xe]),at=react.useCallback(N=>{ye(N),Ye.current&&clearTimeout(Ye.current),Ye.current=setTimeout(()=>{if(v){let ee={...v,description:N};xe(ee);}},800);},[v,xe]),Et=react.useCallback(N=>{et(N),vt.current&&clearTimeout(vt.current),vt.current=setTimeout(()=>{if(v&&N.trim()){let ee={...v,name:N.trim()};xe(ee);}},800);},[v,xe]),Fe=react.useCallback(async()=>{if(!(!v||!Mt.trim()||!T)){le(true);try{await T(v.id,Mt.trim()),mt("");}finally{le(false);}}},[v,Mt,T]),Xt=react.useCallback(N=>{let ee=typeof N=="string"?new Date(N):N,De=new Date().getTime()-ee.getTime(),$e=Math.floor(De/6e4),tt=Math.floor(De/36e5),Ge=Math.floor(De/864e5);return $e<1?n==="es"?"Ahora":"Just now":$e<60?n==="es"?`Hace ${$e} min`:`${$e}m ago`:tt<24?n==="es"?`Hace ${tt}h`:`${tt}h ago`:Ge<7?n==="es"?`Hace ${Ge}d`:`${Ge}d ago`:ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Ot=react.useCallback(N=>{if(!v)return;let ee=v.progress||0;N==="completed"?ee=100:N==="in-progress"&&ee===0?ee=10:N==="todo"&&(ee=0);let se={...v,status:N,progress:ee};xe(se),w(false);},[v,xe]),Nt=react.useCallback((N,ee)=>{if(!v)return;let se={...v,startDate:N,endDate:ee};xe(se);},[v,xe]),ct=react.useCallback(()=>{let N=te.getFullYear(),ee=te.getMonth(),se=new Date(N,ee,1),$e=new Date(N,ee+1,0).getDate(),tt=se.getDay(),Ge=[],Be=new Date(N,ee,0).getDate();for(let _=tt-1;_>=0;_--)Ge.push({date:new Date(N,ee-1,Be-_),isCurrentMonth:false});for(let _=1;_<=$e;_++)Ge.push({date:new Date(N,ee,_),isCurrentMonth:true});let rt=42-Ge.length;for(let _=1;_<=rt;_++)Ge.push({date:new Date(N,ee+1,_),isCurrentMonth:false});return Ge},[te]),Jt=react.useCallback(async N=>{if(N.preventDefault(),N.stopPropagation(),H(false),!v||!d)return;let ee=Array.from(N.dataTransfer.files);if(ee.length!==0){Me(true);try{await d(v.id,ee);}finally{Me(false);}}},[v,d]),Ea=react.useCallback(async N=>{if(!v||!d||!N.target.files)return;let ee=Array.from(N.target.files);if(ee.length!==0){Me(true);try{await d(v.id,ee);}finally{Me(false);}N.target.value="";}},[v,d]),oe=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),H(true);},[]),ue=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),H(false);},[]),pa=react.useCallback(N=>N<1024?`${N} B`:N<1024*1024?`${(N/1024).toFixed(1)} KB`:`${(N/(1024*1024)).toFixed(1)} MB`,[]),ya=react.useCallback(N=>N.startsWith("image/")?lucideReact.Image:N.includes("pdf")||N.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!v?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",b?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:f("w-4 h-4",b?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",b?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:f("text-xs font-mono",b?"text-[#6B7280]":"text-gray-400"),children:v.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",b?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:a,className:f("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let N=v.progress===100?0:100,se={...v,progress:N,status:N===100?"completed":"todo"};xe(se);},className:f("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",v.progress===100?"bg-green-500 border-green-500":b?"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("input",{type:"text",value:We,onChange:N=>Et(N.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:f("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",v.progress===100?"line-through text-[#6B7280]":b?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Pe(),w(!k);},className:f("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":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:v.progress===100||v.status==="completed"?n==="es"?"COMPLETADO":"DONE":v.progress&&v.progress>0||v.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>w(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(N=>jsxRuntime.jsxs("button",{onClick:()=>Ot(N.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",v.status===N.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",N.color)}),jsxRuntime.jsx("span",{className:b?"text-white":"text-gray-900",children:N.label})]},N.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Pe(),I(!D);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[v.assignees&&v.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[v.assignees.slice(0,3).map((N,ee)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:N.color||"#8B5CF6"},title:N.name,children:N.initials||N.name.slice(0,2).toUpperCase()},ee)),v.assignees.length>3&&jsxRuntime.jsxs("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:["+",v.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:f("text-sm",b?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",b?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&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:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:p.length>0?p.map(N=>{let ee=v.assignees?.some(se=>se.name===N.name);return jsxRuntime.jsxs("button",{onClick:()=>{let se=v.assignees||[],De;ee?De=se.filter($e=>$e.name!==N.name):De=[...se,N],ze("assignees",De);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",ee&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:N.color||"#8B5CF6"},children:N.initials||N.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:f("flex-1",b?"text-white":"text-gray-900"),children:N.name}),ee&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},N.name)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{K(B?null:"start"),ie(v.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[v.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:f("mx-1",b?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),v.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>K(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:f("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:N=>N.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:f("w-44 py-2 border-r",b?"border-white/10":"border-gray-200"),children:[(()=>{let N=new Date,ee=new Date(N);ee.setDate(N.getDate()+1);let se=new Date(N);se.setDate(N.getDate()+((6-N.getDay()+7)%7||7));let De=new Date(N);De.setDate(N.getDate()+((1-N.getDay()+7)%7||7));let $e=new Date(N);$e.setDate(N.getDate()+(6-N.getDay()+7)%7+7);let tt=new Date(N);tt.setDate(N.getDate()+14);let Ge=new Date(N);return Ge.setDate(N.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:N,display:N.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ee,display:ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:se,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:De,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:$e,display:$e.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:tt,display:tt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ge,display:Ge.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((rt,_)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",b?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(B==="start"){let ae=v.endDate&&rt.date>v.endDate?rt.date:v.endDate;Nt(rt.date,ae),K("end");}else {let ae=v.startDate&&rt.date<v.startDate?rt.date:v.startDate;Nt(ae,rt.date),K(null);}},children:[jsxRuntime.jsx("span",{children:rt.label}),jsxRuntime.jsx("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:rt.display})]},_))})(),jsxRuntime.jsx("div",{className:f("border-t mt-2 pt-2",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Nt(void 0,void 0),K(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",b?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:f("text-xs mb-3 px-2 py-1 rounded",b?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:B==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:f("font-medium",b?"text-white":"text-gray-900"),children:te.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>ie(new Date),className:f("p-1 rounded text-sm transition-colors",b?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>ie(new Date(te.getFullYear(),te.getMonth()-1)),className:f("p-1 rounded",b?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>ie(new Date(te.getFullYear(),te.getMonth()+1)),className:f("p-1 rounded",b?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(N=>jsxRuntime.jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",b?"text-[#6B7280]":"text-gray-400"),children:N},N))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:ct().map((N,ee)=>{let se=N.date.toDateString()===new Date().toDateString(),De=v.startDate?.toDateString()===N.date.toDateString(),$e=v.endDate?.toDateString()===N.date.toDateString(),tt=De||$e,Ge=v.startDate&&v.endDate&&N.date>=v.startDate&&N.date<=v.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Be=new Date(N.date);if(B==="start"){let rt=v.endDate&&Be>v.endDate?Be:v.endDate;Nt(Be,rt),K("end");}else {let rt=v.startDate&&Be<v.startDate?Be:v.startDate;Nt(rt,Be),K(null);}},className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!N.isCurrentMonth&&(b?"text-[#4B5563]":"text-gray-300"),N.isCurrentMonth&&(b?"text-white":"text-gray-900"),se&&"ring-2 ring-[#3B82F6]",De&&"bg-[#3B82F6] text-white",$e&&!De&&"bg-[#7C3AED] text-white",Ge&&!tt&&(b?"bg-[#7C3AED]/20":"bg-purple-100"),!tt&&(b?"hover:bg-white/10":"hover:bg-gray-100")),children:N.date.getDate()},ee)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Pe(),M(!R);},className:f("text-xs px-2 py-1 rounded font-medium 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":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:v.priority?v.priority==="high"||v.priority==="urgent"?n==="es"?"Alta":"High":v.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>M(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(N=>jsxRuntime.jsxs("button",{onClick:()=>{ze("priority",N.id),M(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",v.priority===N.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",N.color)}),jsxRuntime.jsx("span",{className:b?"text-white":"text-gray-900",children:N.label})]},N.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:f("text-sm",b?"text-white":"text-gray-900"),children:v.startDate&&v.endDate?`${Math.ceil((v.endDate.getTime()-v.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full border-2",b?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[de?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:v.progress||0,onChange:N=>{let ee=parseInt(N.target.value),se=v.status;ee===100?se="completed":ee>0?se="in-progress":se="todo";let De={...v,progress:ee,status:se};xe(De);},onBlur:()=>be(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",b?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>be(true),className:f("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",b?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",v.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${v.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium min-w-[40px]",b?"text-white":"text-gray-900"),children:[v.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(nr,{selectedTags:v.tags||[],availableTags:m,onChange:N=>{ze("tags",N);},onCreateTag:i,theme:y})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:f("w-4 h-4 mt-1.5",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24 mt-1",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="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(N=>{let ee=h.find(se=>se.id===N);return jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",b?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ee?.name||N.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let se=(v.dependencies||[]).filter(De=>De!==N);ze("dependencies",se);},className:f("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},N)})}),jsxRuntime.jsxs("button",{onClick:()=>{Pe(),J(!$);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:f("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{J(false),G("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("p-2 border-b",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:U,onChange:N=>G(N.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",b?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:h.length>0?h.filter(N=>N.id!==v.id).filter(N=>U===""||N.name.toLowerCase().includes(U.toLowerCase())).map(N=>{let ee=v.dependencies?.includes(N.id);return jsxRuntime.jsxs("button",{onClick:()=>{let se=v.dependencies||[],De;ee?De=se.filter($e=>$e!==N.id):De=[...se,N.id],ze("dependencies",De);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",ee&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ee?"bg-blue-500 border-blue-500":b?"border-white/30":"border-gray-300"),children:ee&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:f("block truncate",b?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:N.id.slice(0,8)})]})]},N.id)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Pe(),Q(!A);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:v.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:f("text-sm",b?"text-white":"text-gray-900"),children:sr.find(N=>N.value===v.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",b?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:A&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Q(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:sr.map(N=>{let ee=v.color===N.value;return jsxRuntime.jsx("button",{onClick:()=>{ze("color",N.value),Q(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",ee&&"ring-2 ring-offset-2",b?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:N.value,outlineColor:ee?N.value:void 0},title:N.name,children:ee&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},N.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:v.isMilestone||false,onChange:N=>ze("isMilestone",N.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",v.isMilestone?"bg-purple-500 border-purple-500":b?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:f("text-sm",b?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",b?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:Oe,onChange:N=>at(N.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:f("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",b?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-2 text-sm mt-2 transition-colors",b?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),v.subtasks&&v.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:v.subtasks.map(N=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",N.progress===100?"bg-green-500 border-green-500":b?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:N.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:f("text-sm",N.progress===100?"line-through text-[#6B7280]":b?"text-white":"text-gray-900"),children:N.name})]},N.id))}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",b?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:f("p-1 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",b?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(N=>{let ee=ya(N.type),se=N.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[se&&N.thumbnailUrl?jsxRuntime.jsx("img",{src:N.thumbnailUrl,alt:N.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",b?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(ee,{className:f("w-5 h-5",b?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:N.url,target:"_blank",rel:"noopener noreferrer",className:f("text-sm font-medium truncate block hover:underline",b?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("p",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:pa(N.size)})]}),g&&jsxRuntime.jsx("button",{onClick:()=>g(N.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",b?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},N.id)})}),jsxRuntime.jsxs("div",{onDragOver:oe,onDragLeave:ue,onDrop:Jt,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",X?b?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":b?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",Ce&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Ea,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||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:f("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:f("w-6 h-6 mx-auto mb-2",X?"text-blue-500":b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:X?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsxRuntime.jsx("p",{className:f("text-xs mt-1",b?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:f("w-80 border-l flex flex-col",b?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold",b?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",C.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",b?"text-[#6B7280]":"text-gray-400"),children:["(",C.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:C.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:C.map(N=>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:N.user?.color||"#8B5CF6"},children:N.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:f("text-sm font-medium",b?"text-white":"text-gray-900"),children:N.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:Xt(N.createdAt)})]}),jsxRuntime.jsx("p",{className:f("text-sm break-words",b?"text-[#9CA3AF]":"text-gray-600"),children:N.content})]})]},N.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:f("w-10 h-10 mb-3",b?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:f("text-sm",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:f("p-4 border-t",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[c&&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:c.color||"#8B5CF6"},children:c.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:f("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",b?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",value:Mt,onChange:N=>mt(N.target.value),onKeyDown:N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),Fe());},placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",disabled:O||!T,className:f("flex-1 bg-transparent text-sm outline-none",b?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(O||!T)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:Fe,disabled:O||!Mt.trim()||!T,className:f("p-1.5 rounded transition-colors",Mt.trim()&&T?"bg-blue-500 text-white hover:bg-blue-600":b?"text-[#6B7280]":"text-gray-400",O&&"opacity-50 cursor-not-allowed"),children:O?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]})]})})]})]})]})})}function ks(){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 Er({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:p,isLoading:m,error:i,children:u,availableTags:d=[],onCreateTag:g,attachmentsByCard:h,onUploadAttachments:C,onDeleteAttachment:T,comments:c,onAddComment:b,currentUser:y,onTaskOpen:l}){let[x,v]=ks(),[S,k]=react.useState(null),w=o?.theme||"dark",R=w==="dark"||w==="neutral",M=R?"dark":"",D=react.useCallback((A,Q)=>{t.onCardUpdate?.(A,Q);},[t]),I=react.useCallback((A,Q)=>{t.onColumnUpdate?.(A,{title:Q});},[t]),B=react.useCallback(A=>{t.onColumnDelete?.(A);},[t]),K=["todo","in-progress","completed"],te=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),ie=react.useMemo(()=>{let A=new Map;return e.columns.forEach(Q=>{let X=Q.cardIds.map(H=>e.cards.find(Ce=>Ce.id===H)).filter(H=>H!==void 0).sort((H,Ce)=>H.position-Ce.position);A.set(Q.id,X);}),A},[e.cards,e.columns]),de=react.useMemo(()=>e.cards.map(A=>({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(),dependencies:Array.isArray(A.dependencies)?A.dependencies.map(Q=>typeof Q=="string"?Q:Q.taskId):[]})),[e.cards]),be=react.useCallback(A=>{let{active:Q}=A,X=e.cards.find(H=>H.id===Q.id);X&&v({isDragging:true,draggedCardId:X.id,sourceColumnId:X.columnId,targetColumnId:X.columnId});},[e.cards,v]),$=react.useCallback(A=>{let{active:Q,over:X}=A;if(!X||!e.cards.find(Me=>Me.id===Q.id))return;let Ce=null;X.data.current?.type==="column"?Ce=X.id:X.data.current?.type==="card"&&(Ce=e.cards.find(Oe=>Oe.id===X.id)?.columnId||null),Ce&&Ce!==x.targetColumnId&&v({...x,targetColumnId:Ce});},[e.cards,x,v]),J=react.useCallback(async A=>{let{active:Q,over:X}=A;if(v({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!X)return;let H=e.cards.find(ye=>ye.id===Q.id);if(!H)return;let Ce,Me;if(X.data.current?.type==="column"){Ce=X.id;let ye=ie.get(Ce)||[];Me=ns(ye,0);}else {let ye=e.cards.find(et=>et.id===X.id);if(!ye)return;Ce=ye.columnId;let Ye=ie.get(Ce)||[],We=Ye.findIndex(et=>et.id===X.id);Me=ns(Ye,We);}let Oe=e.columns.find(ye=>ye.id===Ce);if(Oe&&Oe.wipLimit&&Oe.wipLimitType==="hard"){let ye=ie.get(Ce)||[];if(H.columnId!==Ce&&ye.length>=Oe.wipLimit){t.onWipLimitExceeded?.(Oe,H);return}}(H.columnId!==Ce||H.position!==Me)&&await t.onCardMove?.(H.id,Ce,Me);},[e.cards,e.columns,ie,t,v]),U=react.useCallback(A=>{k(A),a?.(A),l?.(A.id);},[a,l]),G=react.useCallback(A=>{t.onCardUpdate?.(A.id,A),k(A);},[t]);return m?jsxRuntime.jsx("div",{className:f("asakaa-board",M,n),style:p,children:jsxRuntime.jsx(wu,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:f("asakaa-board",M,n),style:p,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(Il,{themeName:w,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:te,collisionDetection:core$1.closestCorners,onDragStart:be,onDragOver:$,onDragEnd:J,children:[jsxRuntime.jsxs("div",{className:f("asakaa-board",M,n),style:p,"data-theme":w,children:[e.columns.sort((A,Q)=>A.position-Q.position).map(A=>{let Q=ie.get(A.id)||[],X=!K.includes(A.id);return jsxRuntime.jsx(io,{column:A,cards:Q,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:U,onCardUpdate:D,onColumnRename:I,onColumnDelete:B,isDeletable:X,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},A.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:x.draggedCardId?jsxRuntime.jsx(ur,{card:e.cards.find(A=>A.id===x.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(_r,{task:S,isOpen:!!S,onClose:()=>k(null),onCardUpdate:G,theme:R?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:g,attachments:S?h?.get(S.id)||[]:[],onUploadAttachments:C,onDeleteAttachment:T,availableTasks:de,comments:c,onAddComment:b,currentUser:y})]})}function wu({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 Su={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)"},Eu={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)"},Pu={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Mu={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Au({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),p=react.useRef(null);react.useEffect(()=>{let i=u=>{p.current&&!p.current.contains(u.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let m=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:p,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,u)=>i.position-u.position).map((i,u)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Fu({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[p,m]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let h=C=>{i.current&&!i.current.contains(C.target)&&n(false);};return s&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(h=>h.handler),g=async(h,C)=>{if(C){m(h);try{await C();}catch(T){console.error(`Export ${h} failed:`,T);}finally{m(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((h,C)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>g(h.id,h.handler),disabled:p!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:C<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:C*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:p===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 Lu({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 Cs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:p,onExportExcel:m,translations:i}){let u=r==="dark"?Su:Eu,d={...o==="es"?Pu:Mu,...i},g=n||p||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:u.bgGrid,borderColor:u.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Fu,{theme:u,t:d,onExportCSV:n,onExportJSON:p,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),t&&(s?jsxRuntime.jsx(Au,{columns:e,onSelect:t,theme:u,t:d,createTaskLabel:a}):jsxRuntime.jsx(Lu,{onClick:()=>t(),label:a||d.newTask}))]})})}function Ns({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[p,m]=react.useState(""),i=react.useCallback(()=>{let g=p.trim();g&&(e(g),m(""),n(false));},[p,e]),u=react.useCallback(g=>{g.key==="Enter"?(g.preventDefault(),i()):g.key==="Escape"&&(m(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{p.trim()||n(false);},150);},[p]);return s?jsxRuntime.jsx("div",{className:f("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:p,onChange:g=>m(g.target.value),onKeyDown:u,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!p.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{m(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:f("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Ds({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:p="dark",locale:m="es"}){let[i,u]=react.useState(false),[d,g]=react.useState(false),[h,C]=react.useState(""),[T,c]=react.useState([]),[b,y]=react.useState(""),[l,x]=react.useState(""),[v,S]=react.useState(""),[k,w]=react.useState(false),[R,M]=react.useState(false),[D,I]=react.useState(false),B=react.useRef(null),K=react.useRef(null),te={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},ie=react.useCallback(()=>{C(""),c([]),y(""),x(""),S(""),w(false),M(false),I(false),u(false);},[]);react.useEffect(()=>{i&&B.current&&B.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let U=G=>{K.current&&!K.current.contains(G.target)&&(h.trim()||ie());};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[i,h,ie]);let de=react.useCallback(async()=>{let U=h.trim();if(!(!U||d)){g(true);try{await t({name:U,columnId:e,assigneeIds:T.length>0?T:void 0,startDate:b?new Date(b):void 0,endDate:l?new Date(l):void 0,priority:v||void 0}),C(""),c([]),y(""),x(""),S(""),w(!1),M(!1),I(!1),B.current?.focus();}catch(G){console.error("Error creating card:",G);}finally{g(false);}}},[h,e,T,b,l,v,t,d]),be=react.useCallback(U=>{U.key==="Enter"&&!U.shiftKey?(U.preventDefault(),de()):U.key==="Escape"&&ie();},[de,ie]),$=react.useCallback(U=>{c(G=>G.includes(U)?G.filter(A=>A!==U):[...G,U]);},[]),J=p==="dark";return i?jsxRuntime.jsxs("div",{ref:K,className:f("rounded-lg overflow-hidden shadow-lg",J?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:B,type:"text",value:h,onChange:U=>C(U.target.value),onKeyDown:be,placeholder:te.placeholder,disabled:d,className:f("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",J?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>w(!k),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",k||T.length>0?"bg-emerald-500/20 text-emerald-400":J?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),T.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:T.length})]}),jsxRuntime.jsx("button",{onClick:()=>M(!R),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",R||b||l?"bg-blue-500/20 text-blue-400":J?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>I(!D),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",D||v?v==="urgent"?"bg-red-500/20 text-red-400":v==="high"?"bg-orange-500/20 text-orange-400":v==="medium"?"bg-yellow-500/20 text-yellow-400":v==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":J?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:de,disabled:!h.trim()||d,className:f("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):te.save})]})]}),k&&a.length>0&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",J?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(U=>jsxRuntime.jsxs("button",{onClick:()=>$(U.id),className:f("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",T.includes(U.id)?"bg-emerald-500 text-white":J?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[U.avatar?jsxRuntime.jsx("img",{src:U.avatar,alt:U.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",T.includes(U.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:U.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:U.name.split(" ")[0]})]},U.id))})}),R&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",J?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-[10px] uppercase tracking-wide mb-1",J?"text-gray-500":"text-gray-400"),children:te.startDate}),jsxRuntime.jsx("input",{type:"date",value:b,onChange:U=>y(U.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",J?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-[10px] uppercase tracking-wide mb-1",J?"text-gray-500":"text-gray-400"),children:te.endDate}),jsxRuntime.jsx("input",{type:"date",value:l,onChange:U=>x(U.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",J?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),D&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",J?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(U=>jsxRuntime.jsx("button",{onClick:()=>S(v===U?"":U),className:f("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",v===U?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[U]} text-white`:J?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:te[U]},U))})})]}):jsxRuntime.jsxs("button",{onClick:()=>u(true),disabled:n,className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",J?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:te.buttonLabel})]})}var Mo=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(Er,{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 yd(e={}){return new Mo(e)}var co=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 Ss(e,t){let a=r=>jsxRuntime.jsx(co,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Ps({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:p,onOpenAIUsage:m,shortcut:i="k",className:u=""}){let[d,g]=react.useState(false),[h,C]=react.useState(""),[T,c]=react.useState("home"),[b,y]=react.useState(""),[l,x]=react.useState("");react.useEffect(()=>{let w=R=>{(R.metaKey||R.ctrlKey)&&R.key===i&&(R.preventDefault(),g(M=>!M)),R.key==="Escape"&&(g(false),c("home"),C(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),react.useEffect(()=>{d||(c("home"),C(""),y(""),x(""));},[d]);let v=react.useCallback(()=>{g(false);},[]),S=react.useCallback(w=>{let[R,M]=w.split(":");switch(R){case "create-card":c("create-card");break;case "create-card-in":y(M||"");break;case "navigate":M?(a?.(M),v()):c("navigate");break;case "search":r?.(h),v();break;case "priority":c("priority");break;case "set-priority":l&&M&&(o?.(l,M),v());break;case "assign":c("assign");break;case "assign-user":l&&M&&(s?.(l,M),v());break;case "ai":c("ai");break;case "ai-generate-plan":n?.(),v();break;case "ai-predict-risks":p?.(),v();break;case "ai-usage":m?.(),v();break;case "back":c("home");break;}},[h,l,t,a,r,o,s,n,p,m,v]),k=react.useCallback(()=>{b&&h.trim()&&(t?.(b,h.trim()),v());},[b,h,t,v]);return d?jsxRuntime.jsx(lt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:v,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:h,onValueChange:C,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:T==="create-card"&&b?"Type card title and press Enter...":T==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&T==="create-card"&&b&&k();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),T==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:S,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:S,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:S,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:S,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:S,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(R=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:R},R))})]},w.id))})]}),T==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:S,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${w.id}`,onSelect:S,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:w.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),T==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:S,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(w=>{let R=e.columns.find(M=>M.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:S,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:w.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:R?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(M=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:M},M))})]},w.id)})})]}),T==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:S,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:S,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:S,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:S,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function kd(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;
@@ -68,7 +68,7 @@
68
68
  border: none !important;
69
69
  cursor: pointer !important;
70
70
  opacity: 0.5 !important;
71
- `,h.onmouseenter=()=>{h.style.opacity="1";},h.onmouseleave=()=>{h.style.opacity="0.5";},h.onclick=C=>{C.stopPropagation();let T=r<a.length-1?r+1:0;i(),o(T);},n.appendChild(d),n.appendChild(g),n.appendChild(h);}n.appendChild(p),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function zu(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 Uu(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 As(e){return e.startsWith("image/")}function dr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,p]=react.useState(false),[m,i]=react.useState(false),[u,d]=react.useState(null),g=react.useRef(null),h=react.useRef(e);h.current=e;let C=react.useCallback((w,R)=>{R.preventDefault(),R.stopPropagation();let M=h.current.filter(B=>As(B.type)),N=M.findIndex(B=>B.id===w.id),I=B=>{let K=h.current.filter(se=>As(se.type)),te=K[B];te&&kd(te.url,te.name,K,B,I);};kd(w.url,w.name,M,N,I);},[]),T=react.useCallback(w=>{let R=[],M=[];return e.length+w.length>s?(M.push(`Maximum ${s} files allowed`),{valid:R,errors:M}):(w.forEach(N=>{if(N.size/1048576>r){M.push(`${N.name} is too large (max ${r}MB)`);return}if(o&&!o.some(B=>N.type.match(B))){M.push(`${N.name} has invalid file type`);return}R.push(N);}),{valid:R,errors:M})},[e.length,s,r,o]),c=react.useCallback(async w=>{let{valid:R,errors:M}=T(w);if(M.length>0){d(M.join(", ")),setTimeout(()=>d(null),5e3);return}if(R.length!==0){i(true),d(null);try{await t?.(R);}catch(N){d(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[T,t]),b=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),p(true);},[]),y=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),p(false);},[]),l=react.useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),x=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),p(false);let R=Array.from(w.dataTransfer.files);c(R);},[c]),v=react.useCallback(w=>{let R=w.target.files?Array.from(w.target.files):[];c(R),g.current&&(g.current.value="");},[c]),D=react.useCallback(()=>{g.current?.click();},[]),k=react.useCallback(w=>{confirm("Are you sure you want to delete this attachment?")&&a?.(w);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${m?"uploading":""}`,onDragEnter:b,onDragLeave:y,onDragOver:l,onDrop:x,onClick:D,children:[jsxRuntime.jsx("input",{ref:g,type:"file",multiple:true,onChange:v,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),u&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(w=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:As(w.type)&&w.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:R=>C(w,R),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:w.thumbnailUrl||w.url,alt:w.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Uu(w.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:w.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:w.name,children:w.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:zu(w.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(w.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>k(w.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},w.id))})]})}function Fs({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:p=[],aiInsights:m=[],attachments:i=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:g,onDeleteAttachment:h,onSuggestAssignee:C,onGenerateSubtasks:T,onEstimateEffort:c,currentUserId:b="user-1"}){let[y,l]=react.useState("details"),[x,v]=react.useState(false),[D,k]=react.useState({}),[w,R]=react.useState(""),[M,N]=react.useState(false),[I,B]=react.useState({});if(!t||!e)return null;let K=react.useCallback(()=>{v(false),k({}),l("details"),R(""),B({}),a();},[a]),te=react.useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),k({}),v(false));},[e.id,D,r]),se=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),K());},[e.id,o,K]),le=react.useCallback(()=>{u&&w.trim()&&(u(e.id,w.trim()),R(""));},[e.id,w,u]),ye=react.useCallback(async()=>{if(C){N(true);try{let A=await C(e);B(Z=>({...Z,assignees:A}));}catch(A){console.error("Failed to suggest assignee:",A);}finally{N(false);}}},[e,C]),$=react.useCallback(async()=>{if(T){N(true);try{let A=await T(e);B(Z=>({...Z,subtasks:A}));}catch(A){console.error("Failed to generate subtasks:",A);}finally{N(false);}}},[e,T]),Q=react.useCallback(async()=>{if(c){N(true);try{let A=await c(e);B(Z=>({...Z,effort:A}));}catch(A){console.error("Failed to estimate effort:",A);}finally{N(false);}}},[e,c]),U={...e,...D},G=s.filter(A=>U.assignedUserIds?.includes(A.id));return jsxRuntime.jsx(dt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:K,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:A=>A.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:U.priority==="URGENT"?"#EF4444":U.priority==="HIGH"?"#F59E0B":U.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsxRuntime.jsx("input",{type:"text",value:D.title??U.title,onChange:A=>k({...D,title:A.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:U.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:te,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{v(false),k({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>v(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:()=>l("details"),className:`card-detail-tab ${y==="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:()=>l("comments"),className:`card-detail-tab ${y==="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:()=>l("activity"),className:`card-detail-tab ${y==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",p.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:p.length})]}),jsxRuntime.jsxs("button",{onClick:()=>l("attachments"),className:`card-detail-tab ${y==="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:()=>l("ai"),className:`card-detail-tab ${y==="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:[y==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),x?jsxRuntime.jsx("textarea",{value:D.description??U.description??"",onChange:A=>k({...D,description:A.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:U.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsxRuntime.jsx("select",{multiple:true,value:D.assignedUserIds??U.assignedUserIds??[],onChange:A=>{let Z=Array.from(A.target.selectedOptions,J=>J.value);k({...D,assignedUserIds:Z});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(A=>jsxRuntime.jsx("option",{value:A.id,children:A.name},A.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:G.length>0?G.map(A=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:A.color},children:A.initials}),jsxRuntime.jsx("span",{children:A.name})]},A.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),x?jsxRuntime.jsxs("select",{value:D.priority??U.priority??"",onChange:A=>k({...D,priority:A.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:U.priority==="URGENT"?"#EF4444":U.priority==="HIGH"?"#F59E0B":U.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:U.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:U.labels&&U.labels.length>0?U.labels.map(A=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:A},A)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),x?jsxRuntime.jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:U.startDate?new Date(U.startDate).toISOString().split("T")[0]:"",onChange:A=>k({...D,startDate:A.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:U.startDate?new Date(U.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsxRuntime.jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:U.endDate?new Date(U.endDate).toISOString().split("T")[0]:"",onChange:A=>k({...D,endDate:A.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:U.endDate?new Date(U.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??U.estimatedTime??"",onChange:A=>k({...D,estimatedTime:A.target.value?parseFloat(A.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:U.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:U.dependencies&&U.dependencies.length>0?U.dependencies.map(A=>{let Z=typeof A=="string"?A:A.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",Z.slice(-4)]},Z)}):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:U.createdAt?new Date(U.createdAt).toLocaleString():"Unknown"})]})]}),y==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:w,onChange:A=>R(A.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:le,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(A=>{let Z=s.find(J=>J.id===A.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:[Z&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:Z.color},children:Z.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:Z?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(A.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(A.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:A.content})]},A.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"})]})})]}),y==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:p.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:p.map(A=>{let Z=s.find(J=>J.id===A.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[A.type.includes("CREATED")&&"\u2795",A.type.includes("UPDATED")&&"\u270F\uFE0F",A.type.includes("MOVED")&&"\u27A1\uFE0F",A.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",A.type.includes("COMMENT")&&"\u{1F4AC}",A.type.includes("ASSIGNED")&&"\u{1F464}",A.type.includes("PRIORITY")&&"\u{1F3AF}",A.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",A.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:Z?.name||"Unknown"})," ",A.type.replace(/_/g," ").toLowerCase(),A.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:A.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(A.timestamp).toLocaleString()})]})]},A.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"})]})}),y==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(dr,{cardId:e.id,attachments:i,onUpload:g?A=>g(e.id,A):void 0,onDelete:h,currentUserId:b,maxSizeMB:10,maxFiles:20})}),y==="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:M||!C,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:$,disabled:M||!T,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:Q,disabled:M||!c,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),I.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),I.assignees.map((A,Z)=>{let J=s.find(H=>H.id===A.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:A.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(A.confidence*100).toFixed(0),"%"]})]})]},Z)})]}),I.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),I.subtasks.map((A,Z)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:A.title}),A.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:A.description}),A.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",A.estimatedTime,"h"]})]},Z))]}),I.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:[I.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(I.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(A=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${A.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:A.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:A.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:A.description}),A.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",A.suggestedAction]})]},A.id))]}),!I.assignees&&!I.subtasks&&!I.effort&&m.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Fo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[p,m]=react.useState({top:0,left:0}),i=react.useRef(null),u=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),g=window.innerHeight,h=window.innerWidth,C=4,T=d.left;T+o>h-10&&(T=h-o-10),T<10&&(T=10);let c=g-d.bottom,b=d.top,y;return c>=s+C?y=d.bottom+C:b>=s+C?y=d.top-s-C:c>=b?y=d.bottom+C:y=Math.max(10,d.top-s-C),{top:y,left:T}},[e,o,s]);return react.useEffect(()=>{t&&m(u());},[t,u]),react.useEffect(()=>{if(!t)return;let d=h=>{let C=h.target;i.current&&!i.current.contains(C)&&e.current&&!e.current.contains(C)&&a();},g=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(g),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(dt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${p.top}px`,left:`${p.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var qe={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#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 Yu=["LOW","MEDIUM","HIGH","URGENT"],qu=["todo","in-progress","review","done"];function Bs({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:p=[],onAddComment:m,onDeleteComment:i,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:g,onAIFindSimilar:h,availableColumns:C=[],availableLabels:T=[],availableTags:c=[],onCreateTag:b,onUploadCoverImage:y,unsplashAccessKey:l,theme:x,onSubtasksChange:v,attachments:D=[],onUploadAttachments:k,onDeleteAttachment:w}){let R=oo(),M=x||R?.themeName||"dark",[N,I]=react.useState(e),[B,K]=react.useState(false),[te,se]=react.useState(e?.subtasks||[]),[le,ye]=react.useState(false),[$,Q]=react.useState(""),[U,G]=react.useState(""),[A,Z]=react.useState("all"),[J,H]=react.useState(false),[Te,Me]=react.useState(false),[Oe,xe]=react.useState(false),[Ye,We]=react.useState(false),[tt,xt]=react.useState(false),[At,pt]=react.useState(false),O=react.useRef(null),ie=react.useRef(null),ke=react.useRef(null),Pe=react.useRef(null),Ue=react.useRef(null),rt=react.useRef(null),Pt=react.useRef(null),Fe=react.useRef(null),Jt=react.useRef(null),zt=react.useRef(null),Dt=react.useRef(null),mt=react.useRef(null);react.useEffect(()=>{e&&!N?(I({...e}),se(e.subtasks||[])):e&&N&&e.id!==N.id&&(I({...e}),se(e.subtasks||[]));},[e,N]),react.useEffect(()=>{let W=de=>{let Be=de.target;Pe.current&&!Pe.current.contains(Be)&&H(false),Ue.current&&!Ue.current.contains(Be)&&Me(false),rt.current&&!rt.current.contains(Be)&&xe(false),Pt.current&&!Pt.current.contains(Be)&&We(false);};if(J||Te||Oe||Ye)return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[J,Te,Oe,Ye]),react.useEffect(()=>{if(!t)return;let W=de=>{let Be=de.target,St=Be.tagName==="INPUT"||Be.tagName==="TEXTAREA"||Be.isContentEditable;if(de.key==="Escape"){de.preventDefault(),J||Te||Oe||Ye||tt||At?(H(false),Me(false),xe(false),We(false),xt(false),pt(false)):St||a();return}if(St&&de.key!=="Escape")return;let Qe=de.metaKey||de.ctrlKey;switch(de.key.toLowerCase()){case "s":de.preventDefault(),H(true);break;case "a":de.preventDefault(),xe(true);break;case "p":de.preventDefault(),Me(true);break;case "l":de.preventDefault(),We(true);break;case "d":Qe||(de.preventDefault(),xt(true),setTimeout(()=>Fe.current?.focus(),0));break;case "e":Qe||(de.preventDefault(),pt(true));break;case "i":de.preventDefault(),K(true),setTimeout(()=>ie.current?.focus(),0);break;case "t":de.preventDefault(),ye(true);break;case "c":de.preventDefault(),ke.current?.focus();break}};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[t,a,J,Te,Oe,Ye,tt,At]);let Qt=react.useCallback(W=>{let de=W.currentTarget.textContent?.trim()||"";if(N&&de!==N.title){let Be={...N,title:de};I(Be),r?.(N.id,{title:de});}},[N,r]),Ea=react.useCallback(W=>{W.key==="Enter"&&(W.preventDefault(),W.currentTarget.blur()),W.key==="Escape"&&(W.preventDefault(),W.currentTarget.textContent=N?.title||"",W.currentTarget.blur());},[N]),oe=react.useCallback(()=>{N&&e&&N.description!==e.description&&r?.(N.id,{description:N.description}),K(false);},[N,e,r]),pe=react.useCallback(W=>{if(N){let de={...N,columnId:W};I(de),r?.(N.id,{columnId:W}),H(false);}},[N,r]),ua=react.useCallback(W=>{if(N){let de={...N,priority:W};I(de),r?.(N.id,{priority:W}),Me(false);}},[N,r]),ue=react.useCallback(W=>{if(N){let de=N.assignedUserIds||[],Be=de.includes(W)?de.filter(Qe=>Qe!==W):[...de,W],St={...N,assignedUserIds:Be};I(St),r?.(N.id,{assignedUserIds:Be});}},[N,r]),S=react.useCallback(W=>{if(N){let de=N.labels||[],Be=de.includes(W)?de.filter(Qe=>Qe!==W):[...de,W],St={...N,labels:Be};I(St),r?.(N.id,{labels:Be});}},[N,r]),q=react.useCallback(W=>{if(N){let de={...N,tags:W};I(de),r?.(N.id,{tags:W});}},[N,r]),be=react.useCallback(W=>{if(N){let de=W.target.value,Be={...N,endDate:de};I(Be),r?.(N.id,{endDate:de}),xt(false);}},[N,r]),Le=react.useCallback(W=>{if(N){let de={...N,estimatedTime:parseFloat(W)||0};I(de),r?.(N.id,{estimatedTime:parseFloat(W)||0});}},[N,r]),ze=react.useCallback(()=>{if($.trim()&&N){let W={id:`subtask-${Date.now()}`,title:$.trim(),completed:false,createdAt:new Date},de=[...te,W];se(de),Q(""),ye(false),v?.(N.id,de);}},[$,te,N,v]),je=react.useCallback(W=>{let de=te.map(Be=>Be.id===W?{...Be,completed:!Be.completed,updatedAt:new Date}:Be);se(de),N&&v?.(N.id,de);},[te,N,v]),Re=react.useCallback(W=>{let de=te.filter(Be=>Be.id!==W);se(de),N&&v?.(N.id,de);},[te,N,v]),at=react.useCallback(()=>{U.trim()&&N&&m&&(m(N.id,U.trim()),G(""));},[U,N,m]),st=react.useCallback(W=>{(W.metaKey||W.ctrlKey)&&W.key==="Enter"&&(W.preventDefault(),at());},[at]),_=W=>jsxRuntime.jsx(Vu__default.default,{remarkPlugins:[ju__default.default],rehypePlugins:[Ku__default.default],components:{a:({node:de,...Be})=>jsxRuntime.jsx("a",{...Be,target:"_blank",rel:"noopener noreferrer"})},children:W}),ae=p.filter(W=>A==="comments"?W.type.includes("COMMENT"):A==="history"?!W.type.includes("COMMENT"):true);if(!t||!e)return null;let Ee=N||e,Ke=s.filter(W=>Ee.assignedUserIds?.includes(W.id)),He=te.filter(W=>W.completed).length;return jsxRuntime.jsx(dt,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:W=>W.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":M,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:O,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Qt,onKeyDown:Ea,children:Ee.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Pe,children:[jsxRuntime.jsxs("button",{ref:Jt,className:"modal-v2-field",onClick:()=>H(!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:Ee.columnId||"No status"})]}),jsxRuntime.jsx(Fo,{triggerRef:Jt,isOpen:J,onClose:()=>H(false),width:250,estimatedHeight:200,children:(C.length>0?C:qu.map(W=>({id:W,title:W}))).map(W=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${Ee.columnId===W.id?"active":""}`,onClick:()=>pe(W.id),children:W.title},W.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:rt,children:[jsxRuntime.jsxs("button",{ref:zt,className:"modal-v2-field",onClick:()=>xe(!Oe),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(W=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:W.color},title:W.name,children:W.initials},W.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Fo,{triggerRef:zt,isOpen:Oe,onClose:()=>xe(false),width:280,estimatedHeight:300,children:s.map(W=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Ee.assignedUserIds?.includes(W.id)?"active":""}`,onClick:()=>ue(W.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:W.color},children:W.initials}),W.name,Ee.assignedUserIds?.includes(W.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},W.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ue,children:[jsxRuntime.jsxs("button",{ref:Dt,className:"modal-v2-field",onClick:()=>Me(!Te),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:Ee.priority||"None"})]}),jsxRuntime.jsxs(Fo,{triggerRef:Dt,isOpen:Te,onClose:()=>Me(false),width:180,estimatedHeight:220,children:[Yu.map(W=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${W.toLowerCase()} ${Ee.priority===W?"active":""}`,onClick:()=>ua(W),children:W},W)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>ua(""),children:"None"})]})]}),c.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(nr,{selectedTags:Ee.tags||[],availableTags:c,onChange:q,onCreateTag:b,theme:qe[M]||qe.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Pt,children:[jsxRuntime.jsxs("button",{ref:mt,className:"modal-v2-field",onClick:()=>We(!Ye),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"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:Ee.labels&&Ee.labels.length>0?jsxRuntime.jsx("span",{children:Ee.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Fo,{triggerRef:mt,isOpen:Ye,onClose:()=>We(false),width:220,estimatedHeight:200,children:(T.length>0?T:["Bug","Feature","Enhancement","Documentation"]).map(W=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Ee.labels?.includes(W)?"active":""}`,onClick:()=>S(W),children:[W,Ee.labels?.includes(W)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},W))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{xt(!tt),setTimeout(()=>Fe.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:Ee.endDate?new Date(Ee.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Fe,type:"date",value:typeof Ee.endDate=="string"?Ee.endDate.split("T")[0]:Ee.endDate?(()=>{let W=new Date(Ee.endDate),de=W.getUTCFullYear(),Be=String(W.getUTCMonth()+1).padStart(2,"0"),St=String(W.getUTCDate()).padStart(2,"0");return `${de}-${Be}-${St}`})():"",onChange:be,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>pt(!At),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:Ee.estimatedTime?`${Ee.estimatedTime}h`:"Not set"})]}),At&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Ee.estimatedTime||"",onChange:W=>Le(W.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>pt(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"})]}),B?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:Ee.description||"",onChange:W=>{if(N){let de={...N,description:W.target.value};I(de);}},onBlur:oe,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>K(true),children:Ee.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:_(Ee.description)}):jsxRuntime.jsxs("p",{className:"modal-v2-placeholder",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M9 11l3 3L22 4"}),jsxRuntime.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsxRuntime.jsx("h2",{children:"Subtasks"}),te.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[He,"/",te.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:[te.map(W=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${W.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>je(W.id),children:W.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:W.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Re(W.id),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},W.id)),le&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:$,onChange:W=>Q(W.target.value),onKeyDown:W=>{W.key==="Enter"&&ze(),W.key==="Escape"&&(ye(false),Q(""));},onBlur:ze,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(k||D.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),D.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:D.length})]}),jsxRuntime.jsx(dr,{cardId:Ee.id,attachments:D,onUpload:k?W=>k(Ee.id,W):void 0,onDelete:w,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${A==="all"?"active":""}`,onClick:()=>Z("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${A==="comments"?"active":""}`,onClick:()=>Z("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${A==="history"?"active":""}`,onClick:()=>Z("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:ke,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:U,onChange:W=>G(W.target.value),onKeyDown:st,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:at,disabled:!U.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[ae.map(W=>{let de=s.find(St=>St.id===W.userId);if(W.type.includes("COMMENT")){let St=n.find(Qe=>Qe.id===W.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(W.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:St.content})]})]},W.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[W.type.includes("CREATED")&&"\u2795",W.type.includes("UPDATED")&&"\u270F\uFE0F",W.type.includes("MOVED")&&"\u27A1\uFE0F",W.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",W.type.includes("ASSIGNED")&&"\u{1F464}",W.type.includes("PRIORITY")&&"\u{1F3AF}",W.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:de?.name||"Unknown"})," ",W.type.replace(/_/g," ").toLowerCase(),W.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:W.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]})]},W.id)}),ae.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 og({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," cards"]},r))]})}function $s({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((p,m)=>p+m.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(og,{})}),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,p)=>n+p.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,p)=>n+p.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,p)=>n+(p.planned||0),0)})]})]})]})}function ug({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 Os({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,p=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,i=n<=p;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(ug,{})}),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:m>=50?"#10B981":"#F59E0B"},children:[m.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color: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 wg={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Md=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Cg({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,p=e+n*Math.cos(-a*(Math.PI/180)),m=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:p,y:m,fill:"white",textAnchor:p>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Ad({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 zs({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,i)=>m+i.value,0),n=e.map(m=>({...m,totalValue:s,color:m.color||wg[m.name]||Md[e.indexOf(m)%Md.length]})),p=n.map(m=>m.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?Cg:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,i)=>jsxRuntime.jsx(recharts.Cell,{fill:p[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ad,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,i)=>{let u=i.payload,d=s>0?(u.value/s*100).toFixed(0):"0";return `${m} (${u.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ad,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((m,i)=>jsxRuntime.jsx(recharts.Cell,{fill:p[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((m,i)=>i.value>m.value?i:m).name})]})]})]})}var hn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,p]=react.useState(false),[m,i]=react.useState(false),[u,d]=react.useState(false),[g,h]=react.useState(false);if(e.length===0)return null;let C=e.map(x=>x.id),T=x=>{r.onBulkUpdate?.(C,{priority:x}),p(false);},c=x=>{r.onBulkMove?.(C,x),i(false),a();},b=x=>{r.onBulkUpdate?.(C,{assignedUserIds:x}),d(false);},y=x=>{let v=new Set;e.forEach(k=>{k.labels?.forEach(w=>v.add(w));});let D=Array.from(new Set([...v,...x]));r.onBulkUpdate?.(C,{labels:D}),h(false);},l=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(C),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>p(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>T(x),children:[jsxRuntime.jsx("span",{className:f("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!m),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>c(x.id),children:x.title},x.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([x.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>h(!g),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),g&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([x]),children:x},x))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:l,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"})})]})]})})});hn.displayName="BulkOperationsToolbar";function Eg(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,p,m,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(h=>{let C=a?.find(T=>T.id===h);n=`assignee-${h}`,p=C?.name||`User ${h}`,m=C?.color,i=C?.avatar,r.has(n)||r.set(n,{id:n,title:p,groupValue:h,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",p="Unassigned",m="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:p,groupValue:null,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let g={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];p=g.title,m=g.color,r.has(n)||r.set(n,{id:n,title:p,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(h=>{n=`label-${h}`,p=h,m="#6b7280",r.has(n)||r.set(n,{id:n,title:p,groupValue:h,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",p="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:p,groupValue:null,cardIds:[],color:m}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Us({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),p=react.useMemo(()=>Eg(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(i=>{n(u=>{let d=new Set(u);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||p.length===0?jsxRuntime.jsx(Er,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:f("asakaa-swimlane-view",o),children:[p.map(i=>{let u=s.has(i.id),d=e.cards.filter(h=>i.cardIds.includes(h.id)),g={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Er,{board:g,callbacks:r,availableUsers:a})})]},i.id)}),p.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Hs=[{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 Ws({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),p=Hs.find(i=>i.value===e)||Hs[0];react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:f("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:p.icon}),jsxRuntime.jsx("span",{children:p.label}),jsxRuntime.jsx("svg",{className:f("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:Hs.map(i=>jsxRuntime.jsxs("button",{onClick:()=>m(i.value),className:f("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Lo=[{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 Ag(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,p=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&p&&m}function Rd(e={}){let{shortcuts:t=Lo,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(m=>{o.current=[...o.current,m];},[]),p=react.useCallback(m=>{o.current=o.current.filter(i=>i.action!==m);},[]);return react.useEffect(()=>{function m(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Ag(i,d)){r&&i.preventDefault();let g=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(g);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:p,isEnabled:a}}function Lg(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Ig(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 Bg(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Ig(e),r=t?Lg(t):"";return a?`${a} + ${r}`:r}function Rg(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 Gs({shortcuts:e=Lo,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function p(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,a]),!o||!t)return null;let n=Rg(e);return jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([p,m])=>m.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),p]}),jsxRuntime.jsx("div",{className:"space-y-3",children:m.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:Bg(i)})]},i.action))})]},p))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var _s=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
71
+ `,h.onmouseenter=()=>{h.style.opacity="1";},h.onmouseleave=()=>{h.style.opacity="0.5";},h.onclick=C=>{C.stopPropagation();let T=r<a.length-1?r+1:0;i(),o(T);},n.appendChild(d),n.appendChild(g),n.appendChild(h);}n.appendChild(p),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function zu(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 Uu(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 As(e){return e.startsWith("image/")}function dr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,p]=react.useState(false),[m,i]=react.useState(false),[u,d]=react.useState(null),g=react.useRef(null),h=react.useRef(e);h.current=e;let C=react.useCallback((w,R)=>{R.preventDefault(),R.stopPropagation();let M=h.current.filter(B=>As(B.type)),D=M.findIndex(B=>B.id===w.id),I=B=>{let K=h.current.filter(ie=>As(ie.type)),te=K[B];te&&kd(te.url,te.name,K,B,I);};kd(w.url,w.name,M,D,I);},[]),T=react.useCallback(w=>{let R=[],M=[];return e.length+w.length>s?(M.push(`Maximum ${s} files allowed`),{valid:R,errors:M}):(w.forEach(D=>{if(D.size/1048576>r){M.push(`${D.name} is too large (max ${r}MB)`);return}if(o&&!o.some(B=>D.type.match(B))){M.push(`${D.name} has invalid file type`);return}R.push(D);}),{valid:R,errors:M})},[e.length,s,r,o]),c=react.useCallback(async w=>{let{valid:R,errors:M}=T(w);if(M.length>0){d(M.join(", ")),setTimeout(()=>d(null),5e3);return}if(R.length!==0){i(true),d(null);try{await t?.(R);}catch(D){d(D instanceof Error?D.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[T,t]),b=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),p(true);},[]),y=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),p(false);},[]),l=react.useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),x=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),p(false);let R=Array.from(w.dataTransfer.files);c(R);},[c]),v=react.useCallback(w=>{let R=w.target.files?Array.from(w.target.files):[];c(R),g.current&&(g.current.value="");},[c]),S=react.useCallback(()=>{g.current?.click();},[]),k=react.useCallback(w=>{confirm("Are you sure you want to delete this attachment?")&&a?.(w);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${m?"uploading":""}`,onDragEnter:b,onDragLeave:y,onDragOver:l,onDrop:x,onClick:S,children:[jsxRuntime.jsx("input",{ref:g,type:"file",multiple:true,onChange:v,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),u&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(w=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:As(w.type)&&w.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:R=>C(w,R),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:w.thumbnailUrl||w.url,alt:w.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Uu(w.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:w.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:w.name,children:w.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:zu(w.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(w.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>k(w.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},w.id))})]})}function Fs({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:p=[],aiInsights:m=[],attachments:i=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:g,onDeleteAttachment:h,onSuggestAssignee:C,onGenerateSubtasks:T,onEstimateEffort:c,currentUserId:b="user-1"}){let[y,l]=react.useState("details"),[x,v]=react.useState(false),[S,k]=react.useState({}),[w,R]=react.useState(""),[M,D]=react.useState(false),[I,B]=react.useState({});if(!t||!e)return null;let K=react.useCallback(()=>{v(false),k({}),l("details"),R(""),B({}),a();},[a]),te=react.useCallback(()=>{r&&Object.keys(S).length>0&&(r(e.id,S),k({}),v(false));},[e.id,S,r]),ie=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),K());},[e.id,o,K]),de=react.useCallback(()=>{u&&w.trim()&&(u(e.id,w.trim()),R(""));},[e.id,w,u]),be=react.useCallback(async()=>{if(C){D(true);try{let A=await C(e);B(Q=>({...Q,assignees:A}));}catch(A){console.error("Failed to suggest assignee:",A);}finally{D(false);}}},[e,C]),$=react.useCallback(async()=>{if(T){D(true);try{let A=await T(e);B(Q=>({...Q,subtasks:A}));}catch(A){console.error("Failed to generate subtasks:",A);}finally{D(false);}}},[e,T]),J=react.useCallback(async()=>{if(c){D(true);try{let A=await c(e);B(Q=>({...Q,effort:A}));}catch(A){console.error("Failed to estimate effort:",A);}finally{D(false);}}},[e,c]),U={...e,...S},G=s.filter(A=>U.assignedUserIds?.includes(A.id));return jsxRuntime.jsx(lt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:K,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:A=>A.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:U.priority==="URGENT"?"#EF4444":U.priority==="HIGH"?"#F59E0B":U.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsxRuntime.jsx("input",{type:"text",value:S.title??U.title,onChange:A=>k({...S,title:A.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:U.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:te,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{v(false),k({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>v(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:ie,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:()=>l("details"),className:`card-detail-tab ${y==="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:()=>l("comments"),className:`card-detail-tab ${y==="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:()=>l("activity"),className:`card-detail-tab ${y==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",p.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:p.length})]}),jsxRuntime.jsxs("button",{onClick:()=>l("attachments"),className:`card-detail-tab ${y==="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:()=>l("ai"),className:`card-detail-tab ${y==="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:[y==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),x?jsxRuntime.jsx("textarea",{value:S.description??U.description??"",onChange:A=>k({...S,description:A.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:U.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsxRuntime.jsx("select",{multiple:true,value:S.assignedUserIds??U.assignedUserIds??[],onChange:A=>{let Q=Array.from(A.target.selectedOptions,X=>X.value);k({...S,assignedUserIds:Q});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(A=>jsxRuntime.jsx("option",{value:A.id,children:A.name},A.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:G.length>0?G.map(A=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:A.color},children:A.initials}),jsxRuntime.jsx("span",{children:A.name})]},A.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),x?jsxRuntime.jsxs("select",{value:S.priority??U.priority??"",onChange:A=>k({...S,priority:A.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:U.priority==="URGENT"?"#EF4444":U.priority==="HIGH"?"#F59E0B":U.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:U.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:U.labels&&U.labels.length>0?U.labels.map(A=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:A},A)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),x?jsxRuntime.jsx("input",{type:"date",value:S.startDate?new Date(S.startDate).toISOString().split("T")[0]:U.startDate?new Date(U.startDate).toISOString().split("T")[0]:"",onChange:A=>k({...S,startDate:A.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:U.startDate?new Date(U.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsxRuntime.jsx("input",{type:"date",value:S.endDate?new Date(S.endDate).toISOString().split("T")[0]:U.endDate?new Date(U.endDate).toISOString().split("T")[0]:"",onChange:A=>k({...S,endDate:A.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:U.endDate?new Date(U.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:S.estimatedTime??U.estimatedTime??"",onChange:A=>k({...S,estimatedTime:A.target.value?parseFloat(A.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:U.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:U.dependencies&&U.dependencies.length>0?U.dependencies.map(A=>{let Q=typeof A=="string"?A:A.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",Q.slice(-4)]},Q)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:U.createdAt?new Date(U.createdAt).toLocaleString():"Unknown"})]})]}),y==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:w,onChange:A=>R(A.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:de,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(A=>{let Q=s.find(X=>X.id===A.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[Q&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:Q.color},children:Q.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:Q?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(A.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(A.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:A.content})]},A.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"})]})})]}),y==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:p.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:p.map(A=>{let Q=s.find(X=>X.id===A.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[A.type.includes("CREATED")&&"\u2795",A.type.includes("UPDATED")&&"\u270F\uFE0F",A.type.includes("MOVED")&&"\u27A1\uFE0F",A.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",A.type.includes("COMMENT")&&"\u{1F4AC}",A.type.includes("ASSIGNED")&&"\u{1F464}",A.type.includes("PRIORITY")&&"\u{1F3AF}",A.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",A.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:Q?.name||"Unknown"})," ",A.type.replace(/_/g," ").toLowerCase(),A.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:A.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(A.timestamp).toLocaleString()})]})]},A.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"})]})}),y==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(dr,{cardId:e.id,attachments:i,onUpload:g?A=>g(e.id,A):void 0,onDelete:h,currentUserId:b,maxSizeMB:10,maxFiles:20})}),y==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:be,disabled:M||!C,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:$,disabled:M||!T,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:J,disabled:M||!c,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),I.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),I.assignees.map((A,Q)=>{let X=s.find(H=>H.id===A.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[X&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:X.color},children:X.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:X?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:A.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(A.confidence*100).toFixed(0),"%"]})]})]},Q)})]}),I.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),I.subtasks.map((A,Q)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:A.title}),A.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:A.description}),A.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",A.estimatedTime,"h"]})]},Q))]}),I.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:[I.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(I.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(A=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${A.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:A.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:A.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:A.description}),A.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",A.suggestedAction]})]},A.id))]}),!I.assignees&&!I.subtasks&&!I.effort&&m.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Fo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[p,m]=react.useState({top:0,left:0}),i=react.useRef(null),u=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),g=window.innerHeight,h=window.innerWidth,C=4,T=d.left;T+o>h-10&&(T=h-o-10),T<10&&(T=10);let c=g-d.bottom,b=d.top,y;return c>=s+C?y=d.bottom+C:b>=s+C?y=d.top-s-C:c>=b?y=d.bottom+C:y=Math.max(10,d.top-s-C),{top:y,left:T}},[e,o,s]);return react.useEffect(()=>{t&&m(u());},[t,u]),react.useEffect(()=>{if(!t)return;let d=h=>{let C=h.target;i.current&&!i.current.contains(C)&&e.current&&!e.current.contains(C)&&a();},g=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(g),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(lt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${p.top}px`,left:`${p.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var qe={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#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 Yu=["LOW","MEDIUM","HIGH","URGENT"],qu=["todo","in-progress","review","done"];function Bs({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:p=[],onAddComment:m,onDeleteComment:i,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:g,onAIFindSimilar:h,availableColumns:C=[],availableLabels:T=[],availableTags:c=[],onCreateTag:b,onUploadCoverImage:y,unsplashAccessKey:l,theme:x,onSubtasksChange:v,attachments:S=[],onUploadAttachments:k,onDeleteAttachment:w}){let R=oo(),M=x||R?.themeName||"dark",[D,I]=react.useState(e),[B,K]=react.useState(false),[te,ie]=react.useState(e?.subtasks||[]),[de,be]=react.useState(false),[$,J]=react.useState(""),[U,G]=react.useState(""),[A,Q]=react.useState("all"),[X,H]=react.useState(false),[Ce,Me]=react.useState(false),[Oe,ye]=react.useState(false),[Ye,We]=react.useState(false),[et,vt]=react.useState(false),[Mt,mt]=react.useState(false),O=react.useRef(null),le=react.useRef(null),xe=react.useRef(null),Pe=react.useRef(null),ze=react.useRef(null),at=react.useRef(null),Et=react.useRef(null),Fe=react.useRef(null),Xt=react.useRef(null),Ot=react.useRef(null),Nt=react.useRef(null),ct=react.useRef(null);react.useEffect(()=>{e&&!D?(I({...e}),ie(e.subtasks||[])):e&&D&&e.id!==D.id&&(I({...e}),ie(e.subtasks||[]));},[e,D]),react.useEffect(()=>{let W=ce=>{let Ie=ce.target;Pe.current&&!Pe.current.contains(Ie)&&H(false),ze.current&&!ze.current.contains(Ie)&&Me(false),at.current&&!at.current.contains(Ie)&&ye(false),Et.current&&!Et.current.contains(Ie)&&We(false);};if(X||Ce||Oe||Ye)return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[X,Ce,Oe,Ye]),react.useEffect(()=>{if(!t)return;let W=ce=>{let Ie=ce.target,Dt=Ie.tagName==="INPUT"||Ie.tagName==="TEXTAREA"||Ie.isContentEditable;if(ce.key==="Escape"){ce.preventDefault(),X||Ce||Oe||Ye||et||Mt?(H(false),Me(false),ye(false),We(false),vt(false),mt(false)):Dt||a();return}if(Dt&&ce.key!=="Escape")return;let Je=ce.metaKey||ce.ctrlKey;switch(ce.key.toLowerCase()){case "s":ce.preventDefault(),H(true);break;case "a":ce.preventDefault(),ye(true);break;case "p":ce.preventDefault(),Me(true);break;case "l":ce.preventDefault(),We(true);break;case "d":Je||(ce.preventDefault(),vt(true),setTimeout(()=>Fe.current?.focus(),0));break;case "e":Je||(ce.preventDefault(),mt(true));break;case "i":ce.preventDefault(),K(true),setTimeout(()=>le.current?.focus(),0);break;case "t":ce.preventDefault(),be(true);break;case "c":ce.preventDefault(),xe.current?.focus();break}};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[t,a,X,Ce,Oe,Ye,et,Mt]);let Jt=react.useCallback(W=>{let ce=W.currentTarget.textContent?.trim()||"";if(D&&ce!==D.title){let Ie={...D,title:ce};I(Ie),r?.(D.id,{title:ce});}},[D,r]),Ea=react.useCallback(W=>{W.key==="Enter"&&(W.preventDefault(),W.currentTarget.blur()),W.key==="Escape"&&(W.preventDefault(),W.currentTarget.textContent=D?.title||"",W.currentTarget.blur());},[D]),oe=react.useCallback(()=>{D&&e&&D.description!==e.description&&r?.(D.id,{description:D.description}),K(false);},[D,e,r]),ue=react.useCallback(W=>{if(D){let ce={...D,columnId:W};I(ce),r?.(D.id,{columnId:W}),H(false);}},[D,r]),pa=react.useCallback(W=>{if(D){let ce={...D,priority:W};I(ce),r?.(D.id,{priority:W}),Me(false);}},[D,r]),ya=react.useCallback(W=>{if(D){let ce=D.assignedUserIds||[],Ie=ce.includes(W)?ce.filter(Je=>Je!==W):[...ce,W],Dt={...D,assignedUserIds:Ie};I(Dt),r?.(D.id,{assignedUserIds:Ie});}},[D,r]),N=react.useCallback(W=>{if(D){let ce=D.labels||[],Ie=ce.includes(W)?ce.filter(Je=>Je!==W):[...ce,W],Dt={...D,labels:Ie};I(Dt),r?.(D.id,{labels:Ie});}},[D,r]),ee=react.useCallback(W=>{if(D){let ce={...D,tags:W};I(ce),r?.(D.id,{tags:W});}},[D,r]),se=react.useCallback(W=>{if(D){let ce=W.target.value,Ie={...D,endDate:ce};I(Ie),r?.(D.id,{endDate:ce}),vt(false);}},[D,r]),De=react.useCallback(W=>{if(D){let ce={...D,estimatedTime:parseFloat(W)||0};I(ce),r?.(D.id,{estimatedTime:parseFloat(W)||0});}},[D,r]),$e=react.useCallback(()=>{if($.trim()&&D){let W={id:`subtask-${Date.now()}`,title:$.trim(),completed:false,createdAt:new Date},ce=[...te,W];ie(ce),J(""),be(false),v?.(D.id,ce);}},[$,te,D,v]),tt=react.useCallback(W=>{let ce=te.map(Ie=>Ie.id===W?{...Ie,completed:!Ie.completed,updatedAt:new Date}:Ie);ie(ce),D&&v?.(D.id,ce);},[te,D,v]),Ge=react.useCallback(W=>{let ce=te.filter(Ie=>Ie.id!==W);ie(ce),D&&v?.(D.id,ce);},[te,D,v]),Be=react.useCallback(()=>{U.trim()&&D&&m&&(m(D.id,U.trim()),G(""));},[U,D,m]),rt=react.useCallback(W=>{(W.metaKey||W.ctrlKey)&&W.key==="Enter"&&(W.preventDefault(),Be());},[Be]),_=W=>jsxRuntime.jsx(Vu__default.default,{remarkPlugins:[ju__default.default],rehypePlugins:[Ku__default.default],components:{a:({node:ce,...Ie})=>jsxRuntime.jsx("a",{...Ie,target:"_blank",rel:"noopener noreferrer"})},children:W}),ae=p.filter(W=>A==="comments"?W.type.includes("COMMENT"):A==="history"?!W.type.includes("COMMENT"):true);if(!t||!e)return null;let Ee=D||e,Ue=s.filter(W=>Ee.assignedUserIds?.includes(W.id)),He=te.filter(W=>W.completed).length;return jsxRuntime.jsx(lt,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:W=>W.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":M,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:O,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Jt,onKeyDown:Ea,children:Ee.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Pe,children:[jsxRuntime.jsxs("button",{ref:Xt,className:"modal-v2-field",onClick:()=>H(!X),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Ee.columnId||"No status"})]}),jsxRuntime.jsx(Fo,{triggerRef:Xt,isOpen:X,onClose:()=>H(false),width:250,estimatedHeight:200,children:(C.length>0?C:qu.map(W=>({id:W,title:W}))).map(W=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${Ee.columnId===W.id?"active":""}`,onClick:()=>ue(W.id),children:W.title},W.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:at,children:[jsxRuntime.jsxs("button",{ref:Ot,className:"modal-v2-field",onClick:()=>ye(!Oe),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:Ue.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Ue.map(W=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:W.color},title:W.name,children:W.initials},W.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Fo,{triggerRef:Ot,isOpen:Oe,onClose:()=>ye(false),width:280,estimatedHeight:300,children:s.map(W=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Ee.assignedUserIds?.includes(W.id)?"active":""}`,onClick:()=>ya(W.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:W.color},children:W.initials}),W.name,Ee.assignedUserIds?.includes(W.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},W.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ze,children:[jsxRuntime.jsxs("button",{ref:Nt,className:"modal-v2-field",onClick:()=>Me(!Ce),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:Ee.priority||"None"})]}),jsxRuntime.jsxs(Fo,{triggerRef:Nt,isOpen:Ce,onClose:()=>Me(false),width:180,estimatedHeight:220,children:[Yu.map(W=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${W.toLowerCase()} ${Ee.priority===W?"active":""}`,onClick:()=>pa(W),children:W},W)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>pa(""),children:"None"})]})]}),c.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(nr,{selectedTags:Ee.tags||[],availableTags:c,onChange:ee,onCreateTag:b,theme:qe[M]||qe.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Et,children:[jsxRuntime.jsxs("button",{ref:ct,className:"modal-v2-field",onClick:()=>We(!Ye),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"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:Ee.labels&&Ee.labels.length>0?jsxRuntime.jsx("span",{children:Ee.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Fo,{triggerRef:ct,isOpen:Ye,onClose:()=>We(false),width:220,estimatedHeight:200,children:(T.length>0?T:["Bug","Feature","Enhancement","Documentation"]).map(W=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Ee.labels?.includes(W)?"active":""}`,onClick:()=>N(W),children:[W,Ee.labels?.includes(W)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},W))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{vt(!et),setTimeout(()=>Fe.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:Ee.endDate?new Date(Ee.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Fe,type:"date",value:typeof Ee.endDate=="string"?Ee.endDate.split("T")[0]:Ee.endDate?(()=>{let W=new Date(Ee.endDate),ce=W.getUTCFullYear(),Ie=String(W.getUTCMonth()+1).padStart(2,"0"),Dt=String(W.getUTCDate()).padStart(2,"0");return `${ce}-${Ie}-${Dt}`})():"",onChange:se,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>mt(!Mt),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:Ee.estimatedTime?`${Ee.estimatedTime}h`:"Not set"})]}),Mt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Ee.estimatedTime||"",onChange:W=>De(W.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>mt(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"})]}),B?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:Ee.description||"",onChange:W=>{if(D){let ce={...D,description:W.target.value};I(ce);}},onBlur:oe,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>K(true),children:Ee.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:_(Ee.description)}):jsxRuntime.jsxs("p",{className:"modal-v2-placeholder",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M9 11l3 3L22 4"}),jsxRuntime.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsxRuntime.jsx("h2",{children:"Subtasks"}),te.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[He,"/",te.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>be(true),children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[te.map(W=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${W.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>tt(W.id),children:W.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:W.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ge(W.id),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},W.id)),de&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:$,onChange:W=>J(W.target.value),onKeyDown:W=>{W.key==="Enter"&&$e(),W.key==="Escape"&&(be(false),J(""));},onBlur:$e,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(k||S.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),S.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:S.length})]}),jsxRuntime.jsx(dr,{cardId:Ee.id,attachments:S,onUpload:k?W=>k(Ee.id,W):void 0,onDelete:w,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${A==="all"?"active":""}`,onClick:()=>Q("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${A==="comments"?"active":""}`,onClick:()=>Q("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${A==="history"?"active":""}`,onClick:()=>Q("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:xe,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:U,onChange:W=>G(W.target.value),onKeyDown:rt,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:Be,disabled:!U.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[ae.map(W=>{let ce=s.find(Dt=>Dt.id===W.userId);if(W.type.includes("COMMENT")){let Dt=n.find(Je=>Je.id===W.metadata?.commentId);return Dt?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ce&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:ce.color},children:ce.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:ce?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Dt.content})]})]},W.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[W.type.includes("CREATED")&&"\u2795",W.type.includes("UPDATED")&&"\u270F\uFE0F",W.type.includes("MOVED")&&"\u27A1\uFE0F",W.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",W.type.includes("ASSIGNED")&&"\u{1F464}",W.type.includes("PRIORITY")&&"\u{1F3AF}",W.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:ce?.name||"Unknown"})," ",W.type.replace(/_/g," ").toLowerCase(),W.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:W.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]})]},W.id)}),ae.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 og({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," cards"]},r))]})}function $s({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((p,m)=>p+m.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(og,{})}),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,p)=>n+p.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,p)=>n+p.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,p)=>n+(p.planned||0),0)})]})]})]})}function ug({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 Os({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,p=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,i=n<=p;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(ug,{})}),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:m>=50?"#10B981":"#F59E0B"},children:[m.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color: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 wg={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Md=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Cg({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,p=e+n*Math.cos(-a*(Math.PI/180)),m=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:p,y:m,fill:"white",textAnchor:p>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Ad({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 zs({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,i)=>m+i.value,0),n=e.map(m=>({...m,totalValue:s,color:m.color||wg[m.name]||Md[e.indexOf(m)%Md.length]})),p=n.map(m=>m.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?Cg:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,i)=>jsxRuntime.jsx(recharts.Cell,{fill:p[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ad,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,i)=>{let u=i.payload,d=s>0?(u.value/s*100).toFixed(0):"0";return `${m} (${u.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ad,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((m,i)=>jsxRuntime.jsx(recharts.Cell,{fill:p[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((m,i)=>i.value>m.value?i:m).name})]})]})]})}var hn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,p]=react.useState(false),[m,i]=react.useState(false),[u,d]=react.useState(false),[g,h]=react.useState(false);if(e.length===0)return null;let C=e.map(x=>x.id),T=x=>{r.onBulkUpdate?.(C,{priority:x}),p(false);},c=x=>{r.onBulkMove?.(C,x),i(false),a();},b=x=>{r.onBulkUpdate?.(C,{assignedUserIds:x}),d(false);},y=x=>{let v=new Set;e.forEach(k=>{k.labels?.forEach(w=>v.add(w));});let S=Array.from(new Set([...v,...x]));r.onBulkUpdate?.(C,{labels:S}),h(false);},l=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(C),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>p(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>T(x),children:[jsxRuntime.jsx("span",{className:f("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!m),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>c(x.id),children:x.title},x.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([x.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>h(!g),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),g&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([x]),children:x},x))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:l,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"})})]})]})})});hn.displayName="BulkOperationsToolbar";function Eg(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,p,m,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(h=>{let C=a?.find(T=>T.id===h);n=`assignee-${h}`,p=C?.name||`User ${h}`,m=C?.color,i=C?.avatar,r.has(n)||r.set(n,{id:n,title:p,groupValue:h,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",p="Unassigned",m="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:p,groupValue:null,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let g={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];p=g.title,m=g.color,r.has(n)||r.set(n,{id:n,title:p,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(h=>{n=`label-${h}`,p=h,m="#6b7280",r.has(n)||r.set(n,{id:n,title:p,groupValue:h,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",p="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:p,groupValue:null,cardIds:[],color:m}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Us({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),p=react.useMemo(()=>Eg(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(i=>{n(u=>{let d=new Set(u);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||p.length===0?jsxRuntime.jsx(Er,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:f("asakaa-swimlane-view",o),children:[p.map(i=>{let u=s.has(i.id),d=e.cards.filter(h=>i.cardIds.includes(h.id)),g={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Er,{board:g,callbacks:r,availableUsers:a})})]},i.id)}),p.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Hs=[{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 Ws({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),p=Hs.find(i=>i.value===e)||Hs[0];react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:f("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:p.icon}),jsxRuntime.jsx("span",{children:p.label}),jsxRuntime.jsx("svg",{className:f("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:Hs.map(i=>jsxRuntime.jsxs("button",{onClick:()=>m(i.value),className:f("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Lo=[{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 Ag(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,p=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&p&&m}function Rd(e={}){let{shortcuts:t=Lo,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(m=>{o.current=[...o.current,m];},[]),p=react.useCallback(m=>{o.current=o.current.filter(i=>i.action!==m);},[]);return react.useEffect(()=>{function m(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Ag(i,d)){r&&i.preventDefault();let g=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(g);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:p,isEnabled:a}}function Lg(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Ig(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 Bg(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Ig(e),r=t?Lg(t):"";return a?`${a} + ${r}`:r}function Rg(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 Gs({shortcuts:e=Lo,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function p(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,a]),!o||!t)return null;let n=Rg(e);return jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([p,m])=>m.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),p]}),jsxRuntime.jsx("div",{className:"space-y-3",children:m.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:Bg(i)})]},i.action))})]},p))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var _s=[{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,7 +108,7 @@
108
108
  1.
109
109
 
110
110
  **Action items:**
111
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Vs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=i=>{t(i),o(false);},m=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxRuntime.jsxs("div",{className:f("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:f("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([i,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(d=>jsxRuntime.jsxs("button",{onClick:()=>p(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Ks({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,p]=react.useState("export"),[m,i]=react.useState("json"),[u,d]=react.useState(null),g=react.useRef(null);if(!t)return null;let h=async()=>{let T=o?.current||void 0,c=await Sl(e,m,T);El(c,m);},C=async T=>{let c=T.target.files?.[0];if(c){try{let b=await Al(c),y=c.name.endsWith(".json")?"json":"csv",l=Ml(b,y);d(l),l.success&&r&&r(l,b);}catch(b){d({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}g.current&&(g.current.value="");}};return jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>p("export"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>p("import"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(T=>jsxRuntime.jsxs("button",{onClick:()=>i(T),className:f("p-4 rounded-lg border-2 transition-all text-center",m===T?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[T==="json"&&"\u{1F4C4}",T==="csv"&&"\u{1F4CA}",T==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:T})]},T))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:h,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:g,type:"file",accept:".json,.csv",onChange:C,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>g.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:f("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:f("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((T,c)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",T]},c))})]})]})]})]})]})}var Hg=["URGENT","HIGH","MEDIUM","LOW"],Wg=[{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"}],Gg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ys({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:p,availableUsers:m=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:g=false,groupBy:h="none",onGroupByChange:C}){let[T,c]=react.useState(true),b=react.useCallback(D=>{a({search:D.target.value});},[a]),y=react.useCallback(D=>{a({dateFilter:D.target.value});},[a]),l=react.useCallback(D=>{r({by:D.target.value});},[r]),x=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),v=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${g?"filter-bar--compact":""} ${T?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>c(!T),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:T?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:T?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),v&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!T&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),p&&jsxRuntime.jsx("button",{onClick:p,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:y,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:D=>{let k=D.target.value;a({priorities:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Hg.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let k=D.target.value;a({assignees:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(D=>jsxRuntime.jsx("option",{value:D.id,children:D.name},D.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let k=D.target.value;a({labels:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:l,className:"filter-bar__select filter-bar__select--sm",children:Wg.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),C&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:h,onChange:D=>C(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Gg.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))})}),v&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function qs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:p,onExportGanttCSV:m}){let[i,u]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let h=C=>{d.current&&!d.current.contains(C.target)&&u(false);};return i&&document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h);}},[i]);let g=h=>{h(),u(false);};return jsxRuntime.jsxs("div",{className:f("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",h.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",h.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>g(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>g(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>g(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>g(async()=>await p?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>g(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>g(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>g(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Xs={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"}},Js={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"}},Qs={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"}},Kr={dark:Xs,light:Js,neutral:Qs},yn="dark";var vn=react.createContext(void 0),Zg="asakaa-theme";function zd({children:e,defaultTheme:t=yn,storageKey:a=Zg}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let p=localStorage.getItem(a);if(p&&(p==="dark"||p==="light"||p==="neutral"))return p}return t}),s=react.useCallback(p=>{o(p),typeof window<"u"&&localStorage.setItem(a,p);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let p=document.documentElement,m=Kr[r];Object.entries(m.colors).forEach(([u,d])=>{d&&p.style.setProperty(`--theme-${ef(u)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,d])=>{let g=m.colors[u];g&&p.style.setProperty(d,g);}),p.setAttribute("data-theme",r),p.classList.remove("theme-dark","theme-light","theme-neutral"),p.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Kr};return jsxRuntime.jsx(vn.Provider,{value:n,children:e})}function go(){let e=react.useContext(vn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ef(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Zs({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=go();return e?jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Kr).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:f("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Ud(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return qe[e]||qe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",qe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",qe[e].bgSecondary),bgGrid:r("--theme-bg-card",qe[e].bgGrid),bgWeekend:r("--theme-bg-hover",qe[e].bgWeekend),border:r("--theme-border-primary",qe[e].border),borderLight:r("--theme-border-subtle",qe[e].borderLight),textPrimary:r("--theme-text-primary",qe[e].textPrimary),textSecondary:r("--theme-text-secondary",qe[e].textSecondary),textTertiary:r("--theme-text-tertiary",qe[e].textTertiary),accent:r("--theme-accent-primary",qe[e].accent),accentHover:r("--theme-accent-hover",qe[e].accentHover),accentLight:r("--theme-accent-primary",qe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",qe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",qe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",qe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",qe[e].dependency),dependencyHover:r("--theme-border-secondary",qe[e].dependencyHover),criticalPath:r("--theme-error",qe[e].criticalPath),criticalPathLight:r("--theme-error",qe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",qe[e].today):e==="neutral"?r("--theme-text-primary",qe[e].today):r("--theme-error",qe[e].today),todayLight:e==="light"?r("--theme-accent-primary",qe[e].todayLight):e==="neutral"?r("--theme-text-primary",qe[e].todayLight):r("--theme-error",qe[e].todayLight),milestone:r("--theme-warning",qe[e].milestone),milestoneLight:r("--theme-warning",qe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",qe[e].statusTodo),statusInProgress:r("--theme-accent-primary",qe[e].statusInProgress),statusCompleted:r("--theme-success",qe[e].statusCompleted),hoverBg:r("--theme-bg-hover",qe[e].hoverBg),focusRing:r("--theme-accent-primary",qe[e].focusRing)}}var xn={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filter",filterBy:"Filter by status",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},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"}},Hd={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtrar",filterBy:"Filtrar por estado",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},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"}},ei={en:xn,es:Hd};function Wd(e){return ei[e]||ei.en}function ti(e,t){let a=Wd(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 ho=react.createContext(xn);function bo(){return react.useContext(ho)}function bf({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[p,m]=react.useState(false),[i,u]=react.useState(null),d=react.useRef(null),g=bo();if(react.useEffect(()=>{let c=b=>{d.current&&!d.current.contains(b.target)&&m(false);};return p&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[p]),!(t||a||r||o||s||n))return null;let C=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(c=>c.handler),T=async(c,b)=>{if(b){u(c);try{await b();}catch(y){console.error(`Export ${c} failed:`,y);}finally{u(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!p),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:p?e.accent:e.bgSecondary,border:`1px solid ${p?e.accent:e.borderLight}`,color:p?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:g.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:p?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:C.map((c,b)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>T(c.id,c.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<C.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===c.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"})}):c.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:c.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:c.description})]})]},c.id))})})})]})}function yf({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 vf({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 xf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=bo();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=p.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"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:p.map((i,u)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:u<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function kf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=bo();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=[{value:"all",label:n.toolbar.filterAll||"All tasks",description:n.toolbar.filterAllDesc||"Show all tasks"},{value:"incomplete",label:n.toolbar.filterIncomplete||"Incomplete only",description:n.toolbar.filterIncompleteDesc||"Hide completed tasks"},{value:"in_progress",label:n.toolbar.filterInProgress||"In progress",description:n.toolbar.filterInProgressDesc||"Tasks currently being worked on"},{value:"completed",label:n.toolbar.filterCompleted||"Completed",description:n.toolbar.filterCompletedDesc||"Only show finished tasks"}],m=t!=="all";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m||r?e.accentLight:e.bgSecondary,border:`1px solid ${m||r?e.accent:e.borderLight}`,color:m||r?e.accent:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.accentLight,borderColor:e.accent,color:e.accent,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:n.toolbar.filter||"Filter"}),m&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},className:"flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-semibold",style:{backgroundColor:e.accent,color:"#FFFFFF"},children:"1"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:r?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-56 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:e.borderLight},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:e.textTertiary},children:n.toolbar.filterBy||"Filter by status"})}),jsxRuntime.jsx("div",{className:"py-1",children:p.map((i,u)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-start gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-4 h-4 rounded border mt-0.5 flex-shrink-0",style:{borderColor:d?e.accent:e.border,backgroundColor:d?e.accent:"transparent"},children:d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3",style:{color:"#FFFFFF"}})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium",style:{color:d?e.accent:e.textPrimary},children:i.label}),jsxRuntime.jsx("div",{className:"text-[10px] mt-0.5",style:{color:e.textTertiary},children:i.description})]})]},i.value)})}),m&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t",style:{borderColor:e.borderLight},children:jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>{a("all"),o(false);},className:"w-full text-xs py-1.5 rounded-md",style:{color:e.textTertiary},whileHover:{backgroundColor:e.hoverBg,color:e.textSecondary},children:n.toolbar.clearFilter||"Clear filter"})})]})})]})}function wn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:p,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:g,taskFilter:h="all",onTaskFilterChange:C,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:y,onExportJSON:l,onExportMSProject:x}){let v=bo(),D=T||c||b||y||l||x,k=[{value:"day",label:v.toolbar.day},{value:"week",label:v.toolbar.week},{value:"month",label:v.toolbar.month}],w=[{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(vf,{options:k,value:t,onChange:R=>a(R),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(xf,{theme:e,value:p,onChange:m}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(kf,{theme:e,value:h,onChange:C})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:g,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||v.toolbar.createTask})]}),(D||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),D&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(bf,{theme:e,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:y,onExportJSON:l,onExportMSProject:x}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(yf,{options:w,value:s,onChange:R=>n(R),theme:e})]})]})}function Cn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),p=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=d=>{p.current&&!p.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let u=m.current.getBoundingClientRect();n({x:u.left,y:u.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(dt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:p,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function yo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[p,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,d=r.length*36+8,g=8,h=window.innerWidth,C=window.innerHeight,T=t,c=a;t+u+g>h&&(T=t-u,T<g&&(T=g)),a+d+g>C&&(c=C-d-g,c<g&&(c=g)),m({x:T,y:c});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=g=>{n.current&&!n.current.contains(g.target)&&o();},d=g=>{g.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${p.x}px`,top:`${p.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(u=>jsxRuntime.jsxs("div",{children:[u.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:d=>{u.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var $t={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Zd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:p,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:g=true}){let h=react.useRef(false),C=react.useCallback(l=>{h.current=l;},[]),T=react.useCallback(l=>{let x=[],v=D=>{for(let k of D)x.push(k),k.subtasks&&k.subtasks.length>0&&k.isExpanded&&v(k.subtasks);};return v(l),x},[]),c=react.useCallback(()=>{let l=T(e);for(let x of l)if(t.has(x.id))return x;return null},[e,t,T]),b=react.useCallback((l,x)=>{let v=T(e);if(v.length===0)return;let D=c();if(!D){a(v[0].id,false);return}let k=v.findIndex(M=>M.id===D.id);if(k===-1)return;let w=l==="up"?k-1:k+1;if(w<0||w>=v.length)return;let R=v[w];a(R.id,x);},[e,c,T,a]),y=react.useCallback(l=>{if(!g)return;let x=l.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||h.current){l.key==="Escape"&&(x.blur(),h.current=false);return}let k=navigator.platform.toUpperCase().indexOf("MAC")>=0?l.metaKey:l.ctrlKey,w=Array.from(t),R=c();if(l.key==="ArrowUp"){l.preventDefault(),b("up",l.shiftKey);return}if(l.key==="ArrowDown"){l.preventDefault(),b("down",l.shiftKey);return}if(R&&(l.key==="ArrowRight"||l.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(l.preventDefault(),(l.key==="ArrowRight"&&!R.isExpanded||l.key==="ArrowLeft"&&R.isExpanded)&&u(R.id));return}if(l.altKey&&(l.key==="ArrowUp"||l.key==="ArrowDown")){w.length>0&&(l.preventDefault(),n(w,l.key==="ArrowUp"?"up":"down"));return}if(l.key==="Tab"&&!l.shiftKey){w.length>0&&(l.preventDefault(),p(w));return}if(l.key==="Tab"&&l.shiftKey){w.length>0&&(l.preventDefault(),m(w));return}if(l.key==="Enter"&&!l.shiftKey&&!k){R&&(l.preventDefault(),r(R.id,"below"));return}if(l.key==="Enter"&&l.shiftKey&&!k){R&&(l.preventDefault(),r(R.id,"above"));return}if(l.key==="Enter"&&k){R&&(l.preventDefault(),d(R.id));return}if(l.key==="F2"){R&&(l.preventDefault(),i(R.id));return}if(l.key==="Delete"||l.key==="Backspace"&&k){w.length>0&&(l.preventDefault(),o(w));return}if(l.key==="d"&&k&&!l.shiftKey){w.length>0&&(l.preventDefault(),s(w));return}},[g,t,c,b,r,o,s,n,p,m,i,u,d]);return react.useEffect(()=>{if(g)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[g,y]),{setIsEditing:C}}function tc(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(g=>{let h=new Set(g);return h.has(d)?h.delete(d):h.add(d),h}),r(d);},[]),n=react.useCallback((d,g)=>{if(!a){o(d);return}let h=g.indexOf(a),C=g.indexOf(d);if(h===-1||C===-1){o(d);return}let T=Math.min(h,C),c=Math.max(h,C),b=g.slice(T,c+1);t(new Set(b)),r(d);},[a,o]),p=react.useCallback((d,g,h,C)=>{C?n(d,g):h?s(d):o(d);},[o,s,n]),m=react.useCallback((d,g)=>{g?t(h=>{let C=new Set(h);return C.add(d),C}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:p,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:u}}function vo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let p={...r[n],parentId:o,level:s,position:n};t.push(p),p.subtasks&&p.subtasks.length>0&&p.isExpanded&&a(p.subtasks,p.id,s+1);}};return a(e),t}function ac(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ac(a.subtasks,t);if(r)return r}}return null}function ii(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ii(a.subtasks,t);if(r)return r}return null}function li(e,t){if(t.length===0)return e;let a=vo(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,g)=>{let h=[];return {tasks:d.filter(T=>{if(g.has(T.id))return h.push(T),false;if(T.subtasks){let c=n(T.subtasks,g);T.subtasks=c.tasks,h.push(...c.removed);}return true}),removed:h}},p=(d,g,h)=>d.map(C=>C.id===g?{...C,subtasks:[...C.subtasks||[],...h],isExpanded:true}:C.subtasks?{...C,subtasks:p(C.subtasks,g,h)}:C),m=new Set(t),{tasks:i,removed:u}=n(e,m);return p(i,s.id,u)}function di(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ii(a,r);if(!o)continue;let s=ii(a,o.id),n=(i,u,d)=>{for(let g=0;g<i.length;g++){let h=i[g];if(h.id===u&&h.subtasks){let C=h.subtasks.findIndex(T=>T.id===d);if(C!==-1){let[T]=h.subtasks.splice(C,1);return T}}if(h.subtasks){let C=n(h.subtasks,u,d);if(C)return C}}return null},p=(i,u,d)=>{let g=i.findIndex(h=>h.id===u);if(g!==-1)return i.splice(g+1,0,d),i;for(let h of i)h.subtasks&&p(h.subtasks,u,d);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?p(s.subtasks,o.id,m):p(a,o.id,m));}return a}function ci(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,p,m)=>{let i=n.findIndex(d=>d.id===p);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,p,m))return true;return false}let u=m==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],true)};return s(r,o,a),r}function mi(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 pi(e,t){let a=[...e];for(let r of t){let o=n=>{let p=n.findIndex(u=>u.id===r);if(p===-1){for(let u of n)if(u.subtasks&&o(u.subtasks))return true;return false}let m=n[p],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(p+1,0,i),true},s=n=>n.map(p=>({...p,id:`${p.id}-copy-${Date.now()}`,subtasks:p.subtasks?s(p.subtasks):void 0}));o(a);}return a}function rc(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"},p=m=>{let i=m.findIndex(d=>d.id===t);if(i===-1){for(let d of m)if(d.subtasks&&p(d.subtasks))return true;return false}let u=a==="above"?i:i+1;return m.splice(u,0,n),true};return p(r),{tasks:r,newTask:n}}function ui(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ui(r.subtasks,t,a)}:r)}function gi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:gi(a.subtasks,t)}:a)}function fi(e,t){let a=u=>{for(let d of u){if(d.id===t)return d;if(d.subtasks){let g=a(d.subtasks);if(g)return g}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,p=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(p),color:r?.color||"#3B82F6"},i=u=>u.map(d=>{if(d.id===t){let g=d.subtasks||[];return {...d,subtasks:[...g,m],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:m}}function oc(e,t,a,r){if(t===a)return e;let o=ac(e,t);if(!o)return e;if(a){let p=(m,i)=>{if(!m.subtasks)return false;for(let u of m.subtasks)if(u.id===i||p(u,i))return true;return false};if(p(o,a))return e}let s=p=>p.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let p=r!==void 0?r:n.length;n.splice(p,0,{...o,parentId:void 0});}else {let p=m=>m.map(i=>{if(i.id===a){let u=i.subtasks||[],d=r!==void 0?r:u.length,g=[...u];return g.splice(d,0,{...o,parentId:a}),{...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:p(i.subtasks)}:i});n=p(n);}return n}function Dn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:p,onTaskToggle:m,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:g,onTaskUpdate:h,onTaskIndent:C,onTaskOutdent:T,onTaskMove:c,onMultiTaskDelete:b,onTaskDuplicate:y,onTaskCreate:l,onTaskRename:x,onCreateSubtask:v,onOpenTaskModal:D,onDeleteRequest:k,onTaskReparent:w}){let R=react.useContext(ho),[M,N]=react.useState(null),[I,B]=react.useState(null),[K,te]=react.useState(""),se=react.useRef(null),[le,ye]=react.useState(null),[$,Q]=react.useState(0),[U,G]=react.useState(0),[A,Z]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[J,H]=react.useState(null),[Te,Me]=react.useState(null),[Oe,xe]=react.useState(null),Ye=react.useRef(0),We=5,tt=react.useRef(false),[xt,At]=react.useState(null),[pt,O]=react.useState(false),[ie,ke]=react.useState(null),[Pe,Ue]=react.useState(false),rt=react.useRef(null);react.useEffect(()=>{function _(ae){rt.current&&!rt.current.contains(ae.target)&&Ue(false);}if(Pe)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[Pe]),react.useEffect(()=>{I&&se.current&&(se.current.focus(),se.current.select());},[I]),react.useEffect(()=>{if(!le)return;let _=Ee=>{let Ke=Ee.clientX-$,He=U+Ke;g?.(le,He);},ae=()=>{ye(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",ae),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",ae),document.body.style.cursor="",document.body.style.userSelect="";}},[le,$,U,g]);let{selectedTaskIds:Pt,handleTaskClick:Fe,isTaskSelected:Jt}=tc(),{setIsEditing:zt}=Zd({tasks:e,selectedTaskIds:Pt,onTaskSelect:(_,ae)=>{let Ke=vo(e).map(He=>He.id);Fe(_,Ke,ae||false,false);},onTaskCreate:l||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:y||(()=>{}),onTaskMove:c||(()=>{}),onTaskIndent:C||(()=>{}),onTaskOutdent:T||(()=>{}),onTaskRename:_=>{let ae=vo(e).find(Ee=>Ee.id===_);ae&&pe(ae);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:_=>{let ae=vo(e).find(Ee=>Ee.id===_);ae&&D&&D(ae);},enableKeyboard:true}),Dt=(_,ae=0)=>{let Ee=[];for(let Ke of _)Ee.push({task:Ke,level:ae}),Ke.subtasks&&Ke.subtasks.length>0&&Ke.isExpanded&&Ee.push(...Dt(Ke.subtasks,ae+1));return Ee},mt=Dt(e),Qt=48,Ea=Math.max(mt.length*a,600-Qt),oe=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,pe=_=>{B(_.id),te(_.name),zt(true);},ua=_=>{K.trim()&&K!==e.find(ae=>ae.id===_)?.name&&x?.(_,K.trim()),B(null),te(""),zt(false);},ue=()=>{B(null),te(""),zt(false);},S=(_,ae)=>{ae.stopPropagation(),v?.(_.id);},q=(_,ae)=>{ae.preventDefault(),Ye.current=ae.clientY,H(_),tt.current=false,O(false),At({x:ae.clientX,y:ae.clientY});},be=_=>{if(!J||(Math.abs(_.clientY-Ye.current)>We&&!tt.current&&(tt.current=true,O(true)),At({x:_.clientX,y:_.clientY}),!tt.current))return;let Ee=document.querySelectorAll("[data-task-row]"),Ke=null,He=null;Ee.forEach(W=>{let de=W.getBoundingClientRect(),Be=W.getAttribute("data-task-row");if(Be&&Be!==J&&_.clientY>=de.top&&_.clientY<=de.bottom){Ke=Be;let St=_.clientY-de.top,Qe=de.height;St<Qe*.25?He="above":St>Qe*.75?He="below":He="child";}}),Me(Ke),xe(He);},Le=()=>{if(tt.current&&J&&Te&&Oe){if(Oe==="child")w?.(J,Te);else if(Oe==="above"||Oe==="below"){let _=(Ke,He,W=null)=>{for(let de of Ke){if(de.id===He)return W;if(de.subtasks){let Be=_(de.subtasks,He,de.id);if(Be!==void 0)return Be}}},ae=_(e,Te,null),Ee=(Ke,He)=>{let W=Ke.findIndex(de=>de.id===He);return Oe==="below"?W+1:W};if(ae===null){let Ke=Ee(e,Te);w?.(J,null,Ke);}else {let Ke=mt.find(He=>He.task.id===ae)?.task;if(Ke?.subtasks){let He=Ee(Ke.subtasks,Te);w?.(J,ae,He);}}}}H(null),Me(null),xe(null),At(null),tt.current=false,O(false);};react.useEffect(()=>{if(J)return document.addEventListener("mousemove",be),document.addEventListener("mouseup",Le),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",be),document.removeEventListener("mouseup",Le),document.body.style.cursor="",document.body.style.userSelect="";}},[J,Te,Oe]);let ze=(_,ae,Ee)=>{switch(_.id){case "name":let Ke=I===ae.id,He=M===ae.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Ee*20}px`},children:[w&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:He?1:.3},onMouseDown:X=>q(ae.id,X),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),ae.subtasks&&ae.subtasks.length>0?jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),m?.(ae.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ae.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:ae.color||"#3B82F6",opacity:ae.parentId?.6:1,borderColor:ae.isMilestone?t.accent:"transparent",borderWidth:ae.isMilestone?"2px":"0px"},title:ae.isMilestone?"Milestone":ae.parentId?"Subtask":"Task"})}),Ke?jsxRuntime.jsx("input",{ref:se,type:"text",value:K,onChange:X=>te(X.target.value),onKeyDown:X=>{X.key==="Enter"?ua(ae.id):X.key==="Escape"&&ue();},onBlur:()=>ua(ae.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:X=>X.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:ae.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ae.parentId?"13px":"14px",fontWeight:ae.isMilestone?600:ae.parentId?400:600,letterSpacing:ae.parentId?"0":"-0.01em"},title:ae.name,children:ae.name}),He&&!Ke&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:X=>S(ae,X),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:X=>{X.stopPropagation(),pe(ae);},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=_.id==="startDate"?"startDate":"endDate",Be=ae[de],St=ie?.taskId===ae.id&&ie?.field===de,Qe=X=>X?(typeof X=="string"?new Date(X):X).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:X=>X.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:X=>{if(St)ke(null);else {let Ae=X.currentTarget.getBoundingClientRect();ke({taskId:ae.id,field:de,month:Be?typeof Be=="string"?new Date(Be):Be:new Date,position:{top:Ae.bottom+4,left:Ae.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Qe(Be)})]}),St&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ke(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:ie?.position.top,left:ie?.position.left},onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let X=new Date,Ae=new Date(X);Ae.setDate(X.getDate()+1);let ot=new Date(X);ot.setDate(X.getDate()+7);let ne=new Date(X);return ne.setDate(X.getDate()+14),[{label:"Hoy",date:X},{label:"Ma\xF1ana",date:Ae},{label:"Pr\xF3xima semana",date:ot},{label:"2 semanas",date:ne}].map((kt,Ie)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Ft=>Ft.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Ft=>Ft.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(ae.id,{[de]:kt.date}),ke(null);},children:kt.label},Ie))})(),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:X=>X.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(ae.id,{[de]:void 0}),ke(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:()=>ke(X=>X?{...X,month:new Date(X.month.getFullYear(),X.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:ie?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ke(X=>X?{...X,month:new Date(X.month.getFullYear(),X.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((X,Ae)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:X},Ae))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=ie?.month||new Date,Ae=X.getFullYear(),ot=X.getMonth(),ne=new Date(Ae,ot,1).getDay(),$e=new Date(Ae,ot+1,0).getDate(),kt=new Date,Ie=[];for(let it=ne-1;it>=0;it--)Ie.push({day:new Date(Ae,ot,-it).getDate(),date:new Date(Ae,ot-1,new Date(Ae,ot,-it).getDate()),isCurrentMonth:false});for(let it=1;it<=$e;it++)Ie.push({day:it,date:new Date(Ae,ot,it),isCurrentMonth:true});let Ft=42-Ie.length;for(let it=1;it<=Ft;it++)Ie.push({day:it,date:new Date(Ae,ot+1,it),isCurrentMonth:false});return Ie.map((it,fa)=>{let Ut=it.date.toDateString()===kt.toDateString(),wt=(Be?typeof Be=="string"?new Date(Be):Be:null)?.toDateString()===it.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:it.isCurrentMonth?wt?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:wt?"#3B82F6":"transparent",boxShadow:Ut&&!wt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{h?.(ae.id,{[de]:it.date}),ke(null);},children:it.day},fa)})})()})]})]})]}),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:oe(ae)})});case "assignees":let va=r.filter(X=>ae.assignees?.some(Ae=>Ae.name===X.name||Ae.initials===X.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:X=>X.stopPropagation(),children:jsxRuntime.jsx(Hr,{assignedUsers:va,availableUsers:r,onChange:X=>{let Ae=X.map(ot=>({id:ot.id,name:ot.name,initials:ot.initials,color:ot.color}));h?.(ae.id,{assignees:Ae.length>0?Ae:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:X=>X.stopPropagation(),children:jsxRuntime.jsx(Xl,{status:ae.status||"todo",onChange:X=>{h?.(ae.id,{status:X,progress:X==="completed"?100:ae.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:`${ae.progress}%`,backgroundColor:ae.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:[ae.progress,"%"]})]});case "priority":let ga={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},E={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ve=ga[ae.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:X=>X.stopPropagation(),children:jsxRuntime.jsx(zr,{priority:ve,onChange:X=>{X&&h?.(ae.id,{priority:E[X]||"medium"});}})});default:return null}},je=_=>[{id:"hide",label:"Hide Column",icon:$t.Hide,onClick:()=>d(_),disabled:_==="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:()=>{}}],Re=_=>_.subtasks&&_.subtasks.length>0?[{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:$t.Add,onClick:()=>{v?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:$t.Delete,onClick:()=>{k?k(_.id,_.name):b?.([_.id]);}}]:[{id:"edit",label:R?.contextMenu?.editTask||"Edit Task",icon:$t.Pencil,onClick:()=>{n?.(_);}},{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:$t.Add,onClick:()=>{v?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:R?.contextMenu?.markIncomplete||"Mark Incomplete",icon:$t.MarkIncomplete,onClick:()=>{h?.(_.id,{status:"todo",progress:0});},disabled:_.status==="todo"},{id:"setInProgress",label:R?.contextMenu?.setInProgress||"Set In Progress",icon:$t.SetInProgress,onClick:()=>{h?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"markComplete",label:R?.contextMenu?.markComplete||"Mark Complete",icon:$t.MarkComplete,onClick:()=>{h?.(_.id,{status:"completed",progress:100});},disabled:_.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:R?.contextMenu?.splitTask||"Split Task",icon:$t.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:$t.Delete,onClick:()=>{k?k(_.id,_.name):b?.([_.id]);}}],at=u.filter(_=>_.visible),st=at.reduce((_,ae)=>_+ae.width,0);return jsxRuntime.jsxs("div",{className:"h-full",style:{backgroundColor:t.bgPrimary,minWidth:st},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Qt}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:at.map((_,ae)=>{let Ee=ae===at.length-1,Ke=_.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:`${_.width}px`,minWidth:`${_.minWidth??(Ke?200:60)}px`,maxWidth:`${_.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Ee?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:He=>{He.preventDefault(),Z({isOpen:true,x:He.clientX,y:He.clientY,type:"header",columnId:_.id});},onMouseEnter:He=>{He.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:He=>{He.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:_.label,children:_.label}),_.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:le===_.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:He=>{He.preventDefault(),He.stopPropagation(),ye(_.id),Q(He.clientX),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"}})})]},_.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(Cn,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>Ue(!Pe),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),Pe&&jsxRuntime.jsxs("div",{ref:rt,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:_=>_.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>Ue(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Ea},children:mt.map(({task:_,level:ae},Ee)=>{let Ke=Jt(_.id),He=Te===_.id,W=He&&Oe==="above",de=He&&Oe==="below",Be=He&&Oe==="child",St={};return Be&&(St.backgroundColor=`${t.accent}15`,St.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":_.id,className:`flex items-center cursor-pointer group ${J===_.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ke?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ke?t.accentLight:Be?`${t.accent}15`:Ee%2===0?t.bgPrimary:t.bgGrid,...St},onMouseEnter:()=>N(_.id),onMouseLeave:()=>N(null),onClick:Qe=>{let ga=vo(e).map(X=>X.id),ve=navigator.platform.toUpperCase().indexOf("MAC")>=0?Qe.metaKey:Qe.ctrlKey;Fe(_.id,ga,ve,Qe.shiftKey),s?.(_);},onDoubleClick:Qe=>{Qe.stopPropagation(),n?.(_);},onContextMenu:Qe=>{Qe.preventDefault(),Z({isOpen:true,x:Qe.clientX,y:Qe.clientY,type:"task",task:_}),p?.(_,Qe);},whileHover:{backgroundColor:Ke?t.accentLight:t.hoverBg},children:[W&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),de&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),at.map((Qe,va)=>{let ga=va===at.length-1,E=Qe.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${E?"justify-start":"justify-center"}`,style:{width:`${Qe.width}px`,minWidth:`${Qe.minWidth??(E?200:60)}px`,maxWidth:`${Qe.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ga?"none":`1px solid ${M===_.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ze(Qe,_,E?ae:0)},`${_.id}-${Qe.id}`)})]},_.id)})}),jsxRuntime.jsx(yo,{isOpen:A.isOpen,x:A.x,y:A.y,items:A.type==="header"&&A.columnId?je(A.columnId):A.type==="task"&&A.task?Re(A.task):[],onClose:()=>Z({...A,isOpen:false}),theme:t}),pt&&xt&&J&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:xt.x+12,top:xt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let _=mt.find(ae=>ae.task.id===J)?.task;return _?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:_.name})}):null})()}),document.body)]})}function dc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,p]=react.useState(e),[m,i]=react.useState(t),[u,d]=react.useState(null),[g,h]=react.useState(null),[C,T]=react.useState(null),[c,b]=react.useState(null),[y,l]=react.useState(0),[x,v]=react.useState(0),[D,k]=react.useState(null),[w,R]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:p,ghostWidth:m,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:g,setHoveredTaskId:h,activeZone:C,setActiveZone:T,draggedSegmentIndex:c,setDraggedSegmentIndex:b,draggedSegmentStartX:y,setDraggedSegmentStartX:l,segmentDragOffsetX:x,setSegmentDragOffsetX:v,hoveredSegmentIndex:D,setHoveredSegmentIndex:k,isHovered:w,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(K,te)=>{r("none"),d(null),h(null),p(K),i(te),v(0),b(null),l(0);}}}function Sn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:p,onClick:m,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:g,allTaskPositions:h=[],onDragMove:C,onHoverChange:T}){let c=dc(t,r),b=react.useRef(null),{dragMode:y,setDragMode:l,dragOffset:x,setDragOffset:v,ghostX:D,setGhostX:k,ghostWidth:w,setGhostWidth:R,connectionLine:M,setConnectionLine:N,hoveredTaskId:I,setHoveredTaskId:B,activeZone:K,setActiveZone:te,draggedSegmentIndex:se,setDraggedSegmentIndex:le,draggedSegmentStartX:ye,setDraggedSegmentStartX:$,segmentDragOffsetX:Q,setSegmentDragOffsetX:U,hoveredSegmentIndex:G,setHoveredSegmentIndex:A,isHovered:Z,setIsHovered:J,isDragging:H,isResizing:Te,isConnecting:Me,resetDragState:Oe}=c,xe=32,Ye=8,We=e.endDate&&e.endDate<new Date&&e.progress<100,tt=e.isCriticalPath,xt=o.name==="neutral"||o.today==="#1C1917",At=e.status==="completed"||e.progress===100,pt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ie=e.isCriticalPath||We?"#DC2626":e.color?e.color:e.priority&&pt[e.priority]?pt[e.priority]:o.taskBarPrimary,Pe=(ue=>ue>=80?20:ue>=60?15:ue>=50?12:10)(r),Ue=r<50,rt=r<40;react.useEffect(()=>{if(T)if(Z&&!H&&!e.segments){let ue=a<100;T({task:e,x:t,y:a,width:r,height:xe,showBelow:ue});}else T(null);},[Z,H,e,t,a,r,xe,T]);let Pt=ue=>ue.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Fe=()=>{let ue=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ue} day${ue!==1?"s":""}`},Jt=ue=>Math.round(ue/s)*s,zt=ue=>{let S=Math.round(ue/s),q=new Date(n);return q.setDate(q.getDate()+S),q},Dt=(ue,S)=>{for(let q of h){if(q.id===e.id)continue;let be=5;if(ue>=q.x-be&&ue<=q.x+q.width+be&&S>=q.y-be&&S<=q.y+q.height+be)return q.id}return null},mt=react.useCallback((ue,S,q)=>{ue.preventDefault(),ue.stopPropagation();let be=b.current?.ownerSVGElement;if(!be)return;let Le=be.createSVGPoint();Le.x=ue.clientX,Le.y=ue.clientY;let ze=Le.matrixTransform(be.getScreenCTM()?.inverse()),je=q!==void 0?q:t,Re=S;if(!Re){let at=ze.x-je;ue.shiftKey?(Re="connect",N({x:t+r,y:a+xe/2})):ue.ctrlKey||ue.metaKey?Re="move":ue.altKey?Re=at<r/2?"resize-start":"resize-end":rt?at<r/2?Re="move":Re="resize-end":Ue?at<=Pe/2?Re="resize-start":at>=r-Pe/2?Re="resize-end":Re="move":at<=Pe?Re="resize-start":at>=r-Pe?Re="resize-end":Re="move";}l(Re),J(false),te(null),Re==="move"?v(ze.x-je):Re==="connect"?N({x:t+r,y:a+xe/2}):v(0),k(je),R(r);},[t,r,a,xe]),Qt=react.useCallback(ue=>{if(y==="none")return;let S=b.current?.ownerSVGElement;if(!S)return;let q=S.createSVGPoint();q.x=ue.clientX,q.y=ue.clientY;let be=q.matrixTransform(S.getScreenCTM()?.inverse());if(y==="connect"){N({x:be.x,y:be.y});let Le=Dt(be.x,be.y);B(Le);}else if(y==="move"){let Le=be.x-x,ze=Jt(Le);k(ze),R(r);let je=Math.round((ze-t)/s);if(C?.(e.id,je,true),e.segments&&e.segments.length>0&&se!==null){let Re=ze-ye;U(Re);}}else if(y==="resize-start"){let Le=be.x,ze=Jt(Le),je=t+r-ze;je>=s&&(k(ze),R(je));}else if(y==="resize-end"){let Le=be.x,je=Jt(Le)-t;je>=s&&R(je);}},[y,t,r,s,x,e,Jt,se,ye,Dt,B,N,k,R,U,C]),Ea=react.useCallback(()=>{if(y!=="none"){if(y==="connect")I&&g&&g(e,I),N(null),B(null);else {let ue=e.endDate.getTime()-e.startDate.getTime(),S,q,be=true;if(y==="move"){if(S=zt(D),q=new Date(S.getTime()+ue),e.segments&&e.segments.length>0&&se!==null){let Le=Math.round(Q/s),ze=e.segments.map((st,_)=>{if(_===se){let ae=new Date(st.startDate),Ee=new Date(st.endDate);return ae.setDate(ae.getDate()+Le),Ee.setDate(Ee.getDate()+Le),{startDate:ae,endDate:Ee}}return st}),je=ze.flatMap(st=>[st.startDate,st.endDate]),Re=new Date(Math.min(...je.map(st=>st.getTime()))),at=new Date(Math.max(...je.map(st=>st.getTime())));d?.({...e,segments:ze},Re,at),Oe(t,r);return}}else y==="resize-start"?(S=zt(D),q=e.endDate,S>q&&(console.warn("Invalid date range: start date must be before or equal to end date"),be=false)):y==="resize-end"?(S=e.startDate,q=zt(D+w),q<S&&(console.warn("Invalid date range: end date must be after or equal to start date"),be=false)):be=false;be&&S&&q&&(q.getTime()<S.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,S,q));}C?.(e.id,0,false),Oe(t,r);}},[y,D,w,e,d,I,g,t,r,s,zt,Q,se,Oe,C]);react.useEffect(()=>{if(y==="none")return;let ue=q=>{Qt(q);},S=()=>{Ea();};return window.addEventListener("mousemove",ue),window.addEventListener("mouseup",S),()=>{window.removeEventListener("mousemove",ue),window.removeEventListener("mouseup",S);}},[y,Qt,Ea]);let oe=H&&!Me?D:t,pe=H&&!Me?w:r,ua=p.taskClass(e);return jsxRuntime.jsxs("g",{ref:b,onClick:()=>!H&&m?.(e),onDoubleClick:ue=>{H||(ue.stopPropagation(),i?.(e));},onContextMenu:ue=>{ue.preventDefault(),u?.(e,ue);},onMouseEnter:()=>!H&&J(true),onMouseLeave:()=>{H||(J(false),te(null));},children:[Z&&!H&&!Ue&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Pe,height:xe,fill:K==="resize-start"?o.accent:"transparent",opacity:K==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-start"),onMouseDown:ue=>mt(ue,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Pe,y:a,width:r-Pe*2,height:xe,fill:K==="move"?o.accent:"transparent",opacity:K==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:ue=>mt(ue,"move")}),jsxRuntime.jsx("rect",{x:t+r-Pe,y:a,width:Pe,height:xe,fill:K==="resize-end"?o.accent:"transparent",opacity:K==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:ue=>mt(ue,"resize-end")})]}),Z&&!H&&rt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:xe,fill:K==="move"?o.accent:"transparent",opacity:K==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:ue=>mt(ue,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:xe,fill:K==="resize-end"?o.accent:"transparent",opacity:K==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:ue=>mt(ue,"resize-end")}),Z&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+xe-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),H&&!Me&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:D,y:a,width:w,height:xe,rx:Ye,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:oe,y:a,width:pe,height:xe,rx:Ye,fill:ie,"data-task-class":ua,initial:{opacity:0,scale:.95},animate:{opacity:H&&!Me?.15:e.parentId?.6:Z?.9:.8,scale:Z&&!H?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ue=>mt(ue),style:{cursor:H?Me?"crosshair":Te?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:oe,y:a,width:pe*(e.progress/100),height:xe,rx:Ye,fill:ie,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((ue,S)=>{let q=(ue.startDate.getTime()-n.getTime())/864e5*s,Le=(ue.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-q+s,ze=H&&y==="move"&&se===S,je=G===S,Re=ze?q+Q:q;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!H&&A(S),onMouseLeave:()=>!H&&A(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Re,y:a,width:Le,height:xe,rx:Ye,fill:ie,initial:{opacity:0,scale:.95},animate:{opacity:ze||e.parentId?.6:je?.9:.8,scale:je&&!H?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:at=>{at.stopPropagation(),le(S),$(q),mt(at,void 0,q);},style:{cursor:H?Me?"crosshair":Te?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Re,y:a,width:Le*(e.progress/100),height:xe,rx:Ye,fill:ie,opacity:1,style:{pointerEvents:"none"}})]},`segment-${S}`)}),xt&&(We||tt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[tt&&!We&&jsxRuntime.jsx("rect",{x:oe,y:a,width:pe,height:xe,rx:Ye,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),We&&jsxRuntime.jsx("rect",{x:oe,y:a,width:pe,height:xe,rx:Ye,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),pe>60&&!e.segments&&(()=>{let ue=p.taskLabel(e),S=typeof ue=="string"?ue:e.name,q=S.length>Math.floor(pe/8)?`${S.substring(0,Math.floor(pe/8))}...`:S;return jsxRuntime.jsx("text",{x:oe+12,y:a+xe/2,dominantBaseline:"middle",fill:At?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:At?"line-through":"none"},children:q})})(),pe>100&&e.progress>0&&e.progress<100&&!H&&!e.segments&&jsxRuntime.jsxs("text",{x:oe+pe-12,y:a+xe/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&pe>80&&!H&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:oe+pe-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:oe+pe-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Z||Te)&&!Me&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:oe-2,y:a,width:16,height:xe,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>te("resize-start"),onMouseLeave:()=>te(null),onMouseDown:ue=>{ue.stopPropagation(),mt(ue,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:oe+4,y:a+8,width:3,height:xe-16,rx:1.5,fill:K==="resize-start"||y==="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:oe+pe-14,y:a,width:16,height:xe,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>te("resize-end"),onMouseLeave:()=>te(null),onMouseDown:ue=>{ue.stopPropagation(),mt(ue,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:oe+pe-7,y:a+8,width:3,height:xe-16,rx:1.5,fill:K==="resize-end"||y==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Z&&!H&&!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+18,cy:a+xe/2,r:14,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>te("connect"),onMouseLeave:()=>te(null),onMouseDown:ue=>{ue.stopPropagation(),mt(ue,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+18,cy:a+xe/2,r:7,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:K==="connect"?1.3:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}}),jsxRuntime.jsx("text",{x:t+r+32,y:a+xe/2,dominantBaseline:"middle",fill:K==="connect"?o.accent:o.textTertiary,fontSize:K==="connect"?"11":"10",fontWeight:K==="connect"?"600":"400",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Me&&M&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+xe/2,x2:M.x,y2:M.y,stroke:I?o.statusCompleted:o.accent,strokeWidth:I?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:I?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:M.x,cy:M.y,r:I?8:6,fill:I?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),I&&jsxRuntime.jsx(framerMotion.motion.text,{x:M.x+15,y:M.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:M.x+10},animate:{opacity:1,x:M.x+15},transition:{duration:.2},children:"Connect"})]}),(Z||H)&&!Me&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:oe-2,y:a-2,width:pe+4,height:xe+4,rx:Ye+2,fill:"none",stroke:H?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:H?.6:.4,initial:{opacity:0},animate:{opacity:H?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Te&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:D,y1:0,x2:D,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:D+w,y1:0,x2:D+w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Z&&!H&&!e.segments&&!T&&(()=>{let q=a<100,be=q?a+xe+13:a-82-13,Le=q?`M ${oe+pe/2-6} ${a+xe+3} L ${oe+pe/2} ${a+xe+13} L ${oe+pe/2+6} ${a+xe+3}`:`M ${oe+pe/2-6} ${a-13} L ${oe+pe/2} ${a-3} L ${oe+pe/2+6} ${a-13}`,ze=be+22,je=be+40,Re=be+55,at=be+70,st=q?be+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:q?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:q?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Le,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:oe+pe/2-120,y:be,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:oe+pe/2,y:ze,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:oe+pe/2-110,y:je,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:oe+pe/2-70,y:je,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Pt(e.startDate)}),jsxRuntime.jsx("text",{x:oe+pe/2-110,y:Re,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:oe+pe/2-70,y:Re,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Pt(e.endDate)}),jsxRuntime.jsx("text",{x:oe+pe/2+10,y:je,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:oe+pe/2+65,y:je,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Fe()}),jsxRuntime.jsx("text",{x:oe+pe/2+10,y:Re,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:oe+pe/2+65,y:Re,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:oe+pe/2-110,y:at,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:oe+pe/2-50,y:at,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(_=>_.name).join(", ").substring(0,30),e.assignees.map(_=>_.name).join(", ").length>30?"...":""]})]}),!q&&jsxRuntime.jsx("text",{x:oe+pe/2,y:st,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:rt?"Left: move \u2022 Right: resize":Ue?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function pc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:p}=e,m=82,i=13,u=p?o+n+i:o-m-i,d=p?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,g=u+22,h=u+40,C=u+55,T=u+70,c=x=>x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let x=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${x} day${x!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:p?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:p?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:u,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:g,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?c(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?c(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:b()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(x=>x.name).join(", ").substring(0,30),a.assignees.map(x=>x.name).join(", ").length>30?"...":""]})]})]})})}function Mn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:p=false}){let[m,i]=react.useState(false),[u,d]=react.useState(null),g=r-t,h=g>0,C=Math.abs(g)<5,c=5,b=20,y=!C&&a<=e,l,x;if(C)if(x=(e+a)/2,n==="squared")l=`M ${e} ${t} L ${a} ${r}`;else {let se=Math.min(Math.abs(a-e)/3,30);l=`M ${e} ${t} C ${e+se} ${t}, ${a-se} ${r}, ${a} ${r}`;}else if(x=a-b,y){let le=e+15,ye=a-b,$=h?t+20:t-20;x=ye,n==="squared"?l=`M ${e} ${t} L ${le} ${t} L ${le} ${$} L ${ye} ${$} L ${ye} ${r} L ${a} ${r}`:h?l=`M ${e} ${t} L ${le-c} ${t} Q ${le} ${t} ${le} ${t+c} L ${le} ${$-c} Q ${le} ${$} ${le-c} ${$} L ${ye+c} ${$} Q ${ye} ${$} ${ye} ${$+c} L ${ye} ${r-c} Q ${ye} ${r} ${ye+c} ${r} L ${a} ${r}`:l=`M ${e} ${t} L ${le-c} ${t} Q ${le} ${t} ${le} ${t-c} L ${le} ${$+c} Q ${le} ${$} ${le-c} ${$} L ${ye+c} ${$} Q ${ye} ${$} ${ye} ${$-c} L ${ye} ${r+c} Q ${ye} ${r} ${ye+c} ${r} L ${a} ${r}`;}else n==="squared"?l=`M ${e} ${t} L ${x} ${t} L ${x} ${r} L ${a} ${r}`:h?l=`M ${e} ${t} L ${x-c} ${t} Q ${x} ${t} ${x} ${t+c} L ${x} ${r-c} Q ${x} ${r} ${x+c} ${r} L ${a} ${r}`:l=`M ${e} ${t} L ${x-c} ${t} Q ${x} ${t} ${x} ${t-c} L ${x} ${r+c} Q ${x} ${r} ${x+c} ${r} L ${a} ${r}`;let v=5,D=`M ${a} ${r} L ${a-v} ${r-v*.5} M ${a} ${r} L ${a-v} ${r+v*.5}`,k=o.dependency,w=o.dependencyHover||k,R="#f87171",M="rgba(248, 113, 113, 0.15)",N=x,I=(t+r)/2;if(u)if(C)N=Math.max(e+10,Math.min(a-10,u.x)),I=t;else if(y){let se=e+15,le=a-b,ye=h?t+20:t-20,$=[[e,t,se,t],[se,t,se,ye],[se,ye,le,ye],[le,ye,le,r],[le,r,a,r]],Q=1/0,U={x:N,y:I};for(let G of $){let A=B(u.x,u.y,G[0],G[1],G[2],G[3]),Z=Math.hypot(u.x-A.x,u.y-A.y);Z<Q&&(Q=Z,U=A);}N=U.x,I=U.y;}else {let se=[[e,t,x,t],[x,t,x,r],[x,r,a,r]],le=1/0,ye={x:N,y:I};for(let $ of se){let Q=B(u.x,u.y,$[0],$[1],$[2],$[3]),U=Math.hypot(u.x-Q.x,u.y-Q.y);U<le&&(le=U,ye=Q);}N=ye.x,I=ye.y;}function B(se,le,ye,$,Q,U){let G=Q-ye,A=U-$,Z=G*G+A*A;if(Z===0)return {x:ye,y:$};let J=((se-ye)*G+(le-$)*A)/Z;return J=Math.max(0,Math.min(1,J)),{x:ye+J*G,y:$+J*A}}let K=se=>{let le=se.currentTarget.ownerSVGElement;if(!le)return;let ye=le.getBoundingClientRect();d({x:se.clientX-ye.left,y:se.clientY-ye.top});},te=()=>{i(false),d(null);};return p?jsxRuntime.jsxs("g",{onMouseLeave:te,onMouseMove:K,children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:l,fill:"none",stroke:w,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:l,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:D,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:w,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:N,cy:I,r:9,fill:M,stroke:R,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:I-3,x2:N+3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:I-3,x2:N-3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{onMouseEnter:()=>i(true),onMouseLeave:te,onMouseMove:K,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:l,fill:"none",stroke:m?w:k,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:D,fill:"none",stroke:m?w:k,strokeWidth:m?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:m?4:3,fill:m?w:k,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&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:N,cy:I,r:9,fill:M,stroke:R,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:I-3,x2:N+3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:I-3,x2:N-3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Fn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),p=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:p+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-p/2,y:a+16-p/2,width:p,height:p,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(p+4)/2,y:a+16-(p+4)/2,width:p+4,height:p+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var fe={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,p=new Set,m=i=>{if(!n.has(i)){n.add(i),p.add(i);let u=r.get(i)||[];for(let d of u){if(!n.has(d)&&m(d))return true;if(p.has(d))return true}}return p.delete(i),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=fe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=fe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=fe.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=fe.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(`
111
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Vs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=i=>{t(i),o(false);},m=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxRuntime.jsxs("div",{className:f("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:f("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([i,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(d=>jsxRuntime.jsxs("button",{onClick:()=>p(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Ks({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,p]=react.useState("export"),[m,i]=react.useState("json"),[u,d]=react.useState(null),g=react.useRef(null);if(!t)return null;let h=async()=>{let T=o?.current||void 0,c=await Sl(e,m,T);El(c,m);},C=async T=>{let c=T.target.files?.[0];if(c){try{let b=await Al(c),y=c.name.endsWith(".json")?"json":"csv",l=Ml(b,y);d(l),l.success&&r&&r(l,b);}catch(b){d({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}g.current&&(g.current.value="");}};return jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>p("export"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>p("import"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(T=>jsxRuntime.jsxs("button",{onClick:()=>i(T),className:f("p-4 rounded-lg border-2 transition-all text-center",m===T?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[T==="json"&&"\u{1F4C4}",T==="csv"&&"\u{1F4CA}",T==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:T})]},T))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:h,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:g,type:"file",accept:".json,.csv",onChange:C,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>g.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:f("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:f("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((T,c)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",T]},c))})]})]})]})]})]})}var Hg=["URGENT","HIGH","MEDIUM","LOW"],Wg=[{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"}],Gg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ys({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:p,availableUsers:m=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:g=false,groupBy:h="none",onGroupByChange:C}){let[T,c]=react.useState(true),b=react.useCallback(S=>{a({search:S.target.value});},[a]),y=react.useCallback(S=>{a({dateFilter:S.target.value});},[a]),l=react.useCallback(S=>{r({by:S.target.value});},[r]),x=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),v=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${g?"filter-bar--compact":""} ${T?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>c(!T),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:T?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:T?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),v&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!T&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),p&&jsxRuntime.jsx("button",{onClick:p,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:y,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:S=>{let k=S.target.value;a({priorities:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Hg.map(S=>jsxRuntime.jsx("option",{value:S,children:S},S))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:S=>{let k=S.target.value;a({assignees:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:S=>{let k=S.target.value;a({labels:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(S=>jsxRuntime.jsx("option",{value:S,children:S},S))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:l,className:"filter-bar__select filter-bar__select--sm",children:Wg.map(S=>jsxRuntime.jsx("option",{value:S.value,children:S.label},S.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),C&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:h,onChange:S=>C(S.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Gg.map(S=>jsxRuntime.jsx("option",{value:S.value,children:S.label},S.value))})}),v&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function qs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:p,onExportGanttCSV:m}){let[i,u]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let h=C=>{d.current&&!d.current.contains(C.target)&&u(false);};return i&&document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h);}},[i]);let g=h=>{h(),u(false);};return jsxRuntime.jsxs("div",{className:f("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",h.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",h.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>g(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>g(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>g(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>g(async()=>await p?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>g(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>g(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>g(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Xs={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"}},Js={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"}},Qs={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"}},Kr={dark:Xs,light:Js,neutral:Qs},yn="dark";var vn=react.createContext(void 0),Zg="asakaa-theme";function zd({children:e,defaultTheme:t=yn,storageKey:a=Zg}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let p=localStorage.getItem(a);if(p&&(p==="dark"||p==="light"||p==="neutral"))return p}return t}),s=react.useCallback(p=>{o(p),typeof window<"u"&&localStorage.setItem(a,p);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let p=document.documentElement,m=Kr[r];Object.entries(m.colors).forEach(([u,d])=>{d&&p.style.setProperty(`--theme-${ef(u)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,d])=>{let g=m.colors[u];g&&p.style.setProperty(d,g);}),p.setAttribute("data-theme",r),p.classList.remove("theme-dark","theme-light","theme-neutral"),p.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Kr};return jsxRuntime.jsx(vn.Provider,{value:n,children:e})}function go(){let e=react.useContext(vn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ef(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Zs({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=go();return e?jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Kr).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:f("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Ud(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return qe[e]||qe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",qe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",qe[e].bgSecondary),bgGrid:r("--theme-bg-card",qe[e].bgGrid),bgWeekend:r("--theme-bg-hover",qe[e].bgWeekend),border:r("--theme-border-primary",qe[e].border),borderLight:r("--theme-border-subtle",qe[e].borderLight),textPrimary:r("--theme-text-primary",qe[e].textPrimary),textSecondary:r("--theme-text-secondary",qe[e].textSecondary),textTertiary:r("--theme-text-tertiary",qe[e].textTertiary),accent:r("--theme-accent-primary",qe[e].accent),accentHover:r("--theme-accent-hover",qe[e].accentHover),accentLight:r("--theme-accent-primary",qe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",qe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",qe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",qe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",qe[e].dependency),dependencyHover:r("--theme-border-secondary",qe[e].dependencyHover),criticalPath:r("--theme-error",qe[e].criticalPath),criticalPathLight:r("--theme-error",qe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",qe[e].today):e==="neutral"?r("--theme-text-primary",qe[e].today):r("--theme-error",qe[e].today),todayLight:e==="light"?r("--theme-accent-primary",qe[e].todayLight):e==="neutral"?r("--theme-text-primary",qe[e].todayLight):r("--theme-error",qe[e].todayLight),milestone:r("--theme-warning",qe[e].milestone),milestoneLight:r("--theme-warning",qe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",qe[e].statusTodo),statusInProgress:r("--theme-accent-primary",qe[e].statusInProgress),statusCompleted:r("--theme-success",qe[e].statusCompleted),hoverBg:r("--theme-bg-hover",qe[e].hoverBg),focusRing:r("--theme-accent-primary",qe[e].focusRing)}}var xn={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filter",filterBy:"Filter by status",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},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"}},Hd={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtrar",filterBy:"Filtrar por estado",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},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"}},ei={en:xn,es:Hd};function Wd(e){return ei[e]||ei.en}function ti(e,t){let a=Wd(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 ho=react.createContext(xn);function bo(){return react.useContext(ho)}function bf({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[p,m]=react.useState(false),[i,u]=react.useState(null),d=react.useRef(null),g=bo();if(react.useEffect(()=>{let c=b=>{d.current&&!d.current.contains(b.target)&&m(false);};return p&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[p]),!(t||a||r||o||s||n))return null;let C=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(c=>c.handler),T=async(c,b)=>{if(b){u(c);try{await b();}catch(y){console.error(`Export ${c} failed:`,y);}finally{u(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!p),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:p?e.accent:e.bgSecondary,border:`1px solid ${p?e.accent:e.borderLight}`,color:p?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:g.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:p?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:C.map((c,b)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>T(c.id,c.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<C.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===c.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"})}):c.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:c.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:c.description})]})]},c.id))})})})]})}function yf({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 vf({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 xf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=bo();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=p.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"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:p.map((i,u)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:u<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function kf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=bo();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=[{value:"all",label:n.toolbar.filterAll||"All tasks",description:n.toolbar.filterAllDesc||"Show all tasks"},{value:"incomplete",label:n.toolbar.filterIncomplete||"Incomplete only",description:n.toolbar.filterIncompleteDesc||"Hide completed tasks"},{value:"in_progress",label:n.toolbar.filterInProgress||"In progress",description:n.toolbar.filterInProgressDesc||"Tasks currently being worked on"},{value:"completed",label:n.toolbar.filterCompleted||"Completed",description:n.toolbar.filterCompletedDesc||"Only show finished tasks"}],m=t!=="all";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m||r?e.accentLight:e.bgSecondary,border:`1px solid ${m||r?e.accent:e.borderLight}`,color:m||r?e.accent:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.accentLight,borderColor:e.accent,color:e.accent,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:n.toolbar.filter||"Filter"}),m&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},className:"flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-semibold",style:{backgroundColor:e.accent,color:"#FFFFFF"},children:"1"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:r?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-56 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:e.borderLight},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:e.textTertiary},children:n.toolbar.filterBy||"Filter by status"})}),jsxRuntime.jsx("div",{className:"py-1",children:p.map((i,u)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-start gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-4 h-4 rounded border mt-0.5 flex-shrink-0",style:{borderColor:d?e.accent:e.border,backgroundColor:d?e.accent:"transparent"},children:d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3",style:{color:"#FFFFFF"}})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium",style:{color:d?e.accent:e.textPrimary},children:i.label}),jsxRuntime.jsx("div",{className:"text-[10px] mt-0.5",style:{color:e.textTertiary},children:i.description})]})]},i.value)})}),m&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t",style:{borderColor:e.borderLight},children:jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>{a("all"),o(false);},className:"w-full text-xs py-1.5 rounded-md",style:{color:e.textTertiary},whileHover:{backgroundColor:e.hoverBg,color:e.textSecondary},children:n.toolbar.clearFilter||"Clear filter"})})]})})]})}function wn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:p,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:g,taskFilter:h="all",onTaskFilterChange:C,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:y,onExportJSON:l,onExportMSProject:x}){let v=bo(),S=T||c||b||y||l||x,k=[{value:"day",label:v.toolbar.day},{value:"week",label:v.toolbar.week},{value:"month",label:v.toolbar.month}],w=[{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(vf,{options:k,value:t,onChange:R=>a(R),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(xf,{theme:e,value:p,onChange:m}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(kf,{theme:e,value:h,onChange:C})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:g,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||v.toolbar.createTask})]}),(S||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(bf,{theme:e,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:y,onExportJSON:l,onExportMSProject:x}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(yf,{options:w,value:s,onChange:R=>n(R),theme:e})]})]})}function Cn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),p=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=d=>{p.current&&!p.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let u=m.current.getBoundingClientRect();n({x:u.left,y:u.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:p,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function yo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[p,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,d=r.length*36+8,g=8,h=window.innerWidth,C=window.innerHeight,T=t,c=a;t+u+g>h&&(T=t-u,T<g&&(T=g)),a+d+g>C&&(c=C-d-g,c<g&&(c=g)),m({x:T,y:c});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=g=>{n.current&&!n.current.contains(g.target)&&o();},d=g=>{g.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${p.x}px`,top:`${p.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(u=>jsxRuntime.jsxs("div",{children:[u.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:d=>{u.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var Rt={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 Zd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:p,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:g=true}){let h=react.useRef(false),C=react.useCallback(l=>{h.current=l;},[]),T=react.useCallback(l=>{let x=[],v=S=>{for(let k of S)x.push(k),k.subtasks&&k.subtasks.length>0&&k.isExpanded&&v(k.subtasks);};return v(l),x},[]),c=react.useCallback(()=>{let l=T(e);for(let x of l)if(t.has(x.id))return x;return null},[e,t,T]),b=react.useCallback((l,x)=>{let v=T(e);if(v.length===0)return;let S=c();if(!S){a(v[0].id,false);return}let k=v.findIndex(M=>M.id===S.id);if(k===-1)return;let w=l==="up"?k-1:k+1;if(w<0||w>=v.length)return;let R=v[w];a(R.id,x);},[e,c,T,a]),y=react.useCallback(l=>{if(!g)return;let x=l.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||h.current){l.key==="Escape"&&(x.blur(),h.current=false);return}let k=navigator.platform.toUpperCase().indexOf("MAC")>=0?l.metaKey:l.ctrlKey,w=Array.from(t),R=c();if(l.key==="ArrowUp"){l.preventDefault(),b("up",l.shiftKey);return}if(l.key==="ArrowDown"){l.preventDefault(),b("down",l.shiftKey);return}if(R&&(l.key==="ArrowRight"||l.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(l.preventDefault(),(l.key==="ArrowRight"&&!R.isExpanded||l.key==="ArrowLeft"&&R.isExpanded)&&u(R.id));return}if(l.altKey&&(l.key==="ArrowUp"||l.key==="ArrowDown")){w.length>0&&(l.preventDefault(),n(w,l.key==="ArrowUp"?"up":"down"));return}if(l.key==="Tab"&&!l.shiftKey){w.length>0&&(l.preventDefault(),p(w));return}if(l.key==="Tab"&&l.shiftKey){w.length>0&&(l.preventDefault(),m(w));return}if(l.key==="Enter"&&!l.shiftKey&&!k){R&&(l.preventDefault(),r(R.id,"below"));return}if(l.key==="Enter"&&l.shiftKey&&!k){R&&(l.preventDefault(),r(R.id,"above"));return}if(l.key==="Enter"&&k){R&&(l.preventDefault(),d(R.id));return}if(l.key==="F2"){R&&(l.preventDefault(),i(R.id));return}if(l.key==="Delete"||l.key==="Backspace"&&k){w.length>0&&(l.preventDefault(),o(w));return}if(l.key==="d"&&k&&!l.shiftKey){w.length>0&&(l.preventDefault(),s(w));return}},[g,t,c,b,r,o,s,n,p,m,i,u,d]);return react.useEffect(()=>{if(g)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[g,y]),{setIsEditing:C}}function tc(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(g=>{let h=new Set(g);return h.has(d)?h.delete(d):h.add(d),h}),r(d);},[]),n=react.useCallback((d,g)=>{if(!a){o(d);return}let h=g.indexOf(a),C=g.indexOf(d);if(h===-1||C===-1){o(d);return}let T=Math.min(h,C),c=Math.max(h,C),b=g.slice(T,c+1);t(new Set(b)),r(d);},[a,o]),p=react.useCallback((d,g,h,C)=>{C?n(d,g):h?s(d):o(d);},[o,s,n]),m=react.useCallback((d,g)=>{g?t(h=>{let C=new Set(h);return C.add(d),C}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:p,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:u}}function vo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let p={...r[n],parentId:o,level:s,position:n};t.push(p),p.subtasks&&p.subtasks.length>0&&p.isExpanded&&a(p.subtasks,p.id,s+1);}};return a(e),t}function ac(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ac(a.subtasks,t);if(r)return r}}return null}function ii(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ii(a.subtasks,t);if(r)return r}return null}function li(e,t){if(t.length===0)return e;let a=vo(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,g)=>{let h=[];return {tasks:d.filter(T=>{if(g.has(T.id))return h.push(T),false;if(T.subtasks){let c=n(T.subtasks,g);T.subtasks=c.tasks,h.push(...c.removed);}return true}),removed:h}},p=(d,g,h)=>d.map(C=>C.id===g?{...C,subtasks:[...C.subtasks||[],...h],isExpanded:true}:C.subtasks?{...C,subtasks:p(C.subtasks,g,h)}:C),m=new Set(t),{tasks:i,removed:u}=n(e,m);return p(i,s.id,u)}function di(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ii(a,r);if(!o)continue;let s=ii(a,o.id),n=(i,u,d)=>{for(let g=0;g<i.length;g++){let h=i[g];if(h.id===u&&h.subtasks){let C=h.subtasks.findIndex(T=>T.id===d);if(C!==-1){let[T]=h.subtasks.splice(C,1);return T}}if(h.subtasks){let C=n(h.subtasks,u,d);if(C)return C}}return null},p=(i,u,d)=>{let g=i.findIndex(h=>h.id===u);if(g!==-1)return i.splice(g+1,0,d),i;for(let h of i)h.subtasks&&p(h.subtasks,u,d);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?p(s.subtasks,o.id,m):p(a,o.id,m));}return a}function ci(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,p,m)=>{let i=n.findIndex(d=>d.id===p);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,p,m))return true;return false}let u=m==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],true)};return s(r,o,a),r}function mi(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 pi(e,t){let a=[...e];for(let r of t){let o=n=>{let p=n.findIndex(u=>u.id===r);if(p===-1){for(let u of n)if(u.subtasks&&o(u.subtasks))return true;return false}let m=n[p],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(p+1,0,i),true},s=n=>n.map(p=>({...p,id:`${p.id}-copy-${Date.now()}`,subtasks:p.subtasks?s(p.subtasks):void 0}));o(a);}return a}function rc(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"},p=m=>{let i=m.findIndex(d=>d.id===t);if(i===-1){for(let d of m)if(d.subtasks&&p(d.subtasks))return true;return false}let u=a==="above"?i:i+1;return m.splice(u,0,n),true};return p(r),{tasks:r,newTask:n}}function ui(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ui(r.subtasks,t,a)}:r)}function gi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:gi(a.subtasks,t)}:a)}function fi(e,t){let a=u=>{for(let d of u){if(d.id===t)return d;if(d.subtasks){let g=a(d.subtasks);if(g)return g}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,p=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(p),color:r?.color||"#3B82F6"},i=u=>u.map(d=>{if(d.id===t){let g=d.subtasks||[];return {...d,subtasks:[...g,m],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:m}}function oc(e,t,a,r){if(t===a)return e;let o=ac(e,t);if(!o)return e;if(a){let p=(m,i)=>{if(!m.subtasks)return false;for(let u of m.subtasks)if(u.id===i||p(u,i))return true;return false};if(p(o,a))return e}let s=p=>p.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let p=r!==void 0?r:n.length;n.splice(p,0,{...o,parentId:void 0});}else {let p=m=>m.map(i=>{if(i.id===a){let u=i.subtasks||[],d=r!==void 0?r:u.length,g=[...u];return g.splice(d,0,{...o,parentId:a}),{...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:p(i.subtasks)}:i});n=p(n);}return n}function Dn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:p,onTaskToggle:m,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:g,onTaskUpdate:h,onTaskIndent:C,onTaskOutdent:T,onTaskMove:c,onMultiTaskDelete:b,onTaskDuplicate:y,onTaskCreate:l,onTaskRename:x,onCreateSubtask:v,onOpenTaskModal:S,onDeleteRequest:k,onTaskReparent:w}){let R=react.useContext(ho),[M,D]=react.useState(null),[I,B]=react.useState(null),[K,te]=react.useState(""),ie=react.useRef(null),[de,be]=react.useState(null),[$,J]=react.useState(0),[U,G]=react.useState(0),[A,Q]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[X,H]=react.useState(null),[Ce,Me]=react.useState(null),[Oe,ye]=react.useState(null),Ye=react.useRef(0),We=5,et=react.useRef(false),[vt,Mt]=react.useState(null),[mt,O]=react.useState(false),[le,xe]=react.useState(null),[Pe,ze]=react.useState(false),at=react.useRef(null);react.useEffect(()=>{function _(ae){at.current&&!at.current.contains(ae.target)&&ze(false);}if(Pe)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[Pe]),react.useEffect(()=>{I&&ie.current&&(ie.current.focus(),ie.current.select());},[I]),react.useEffect(()=>{if(!de)return;let _=Ee=>{let Ue=Ee.clientX-$,He=U+Ue;g?.(de,He);},ae=()=>{be(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",ae),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",ae),document.body.style.cursor="",document.body.style.userSelect="";}},[de,$,U,g]);let{selectedTaskIds:Et,handleTaskClick:Fe,isTaskSelected:Xt}=tc(),{setIsEditing:Ot}=Zd({tasks:e,selectedTaskIds:Et,onTaskSelect:(_,ae)=>{let Ue=vo(e).map(He=>He.id);Fe(_,Ue,ae||false,false);},onTaskCreate:l||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:y||(()=>{}),onTaskMove:c||(()=>{}),onTaskIndent:C||(()=>{}),onTaskOutdent:T||(()=>{}),onTaskRename:_=>{let ae=vo(e).find(Ee=>Ee.id===_);ae&&ue(ae);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:_=>{let ae=vo(e).find(Ee=>Ee.id===_);ae&&S&&S(ae);},enableKeyboard:true}),Nt=(_,ae=0)=>{let Ee=[];for(let Ue of _)Ee.push({task:Ue,level:ae}),Ue.subtasks&&Ue.subtasks.length>0&&Ue.isExpanded&&Ee.push(...Nt(Ue.subtasks,ae+1));return Ee},ct=Nt(e),Jt=48,Ea=Math.max(ct.length*a,600-Jt),oe=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,ue=_=>{B(_.id),te(_.name),Ot(true);},pa=_=>{K.trim()&&K!==e.find(ae=>ae.id===_)?.name&&x?.(_,K.trim()),B(null),te(""),Ot(false);},ya=()=>{B(null),te(""),Ot(false);},N=(_,ae)=>{ae.stopPropagation(),v?.(_.id);},ee=(_,ae)=>{ae.preventDefault(),Ye.current=ae.clientY,H(_),et.current=false,O(false),Mt({x:ae.clientX,y:ae.clientY});},se=_=>{if(!X||(Math.abs(_.clientY-Ye.current)>We&&!et.current&&(et.current=true,O(true)),Mt({x:_.clientX,y:_.clientY}),!et.current))return;let Ee=document.querySelectorAll("[data-task-row]"),Ue=null,He=null;Ee.forEach(W=>{let ce=W.getBoundingClientRect(),Ie=W.getAttribute("data-task-row");if(Ie&&Ie!==X&&_.clientY>=ce.top&&_.clientY<=ce.bottom){Ue=Ie;let Dt=_.clientY-ce.top,Je=ce.height;Dt<Je*.25?He="above":Dt>Je*.75?He="below":He="child";}}),Me(Ue),ye(He);},De=()=>{if(et.current&&X&&Ce&&Oe){if(Oe==="child")w?.(X,Ce);else if(Oe==="above"||Oe==="below"){let _=(Ue,He,W=null)=>{for(let ce of Ue){if(ce.id===He)return W;if(ce.subtasks){let Ie=_(ce.subtasks,He,ce.id);if(Ie!==void 0)return Ie}}},ae=_(e,Ce,null),Ee=(Ue,He)=>{let W=Ue.findIndex(ce=>ce.id===He);return Oe==="below"?W+1:W};if(ae===null){let Ue=Ee(e,Ce);w?.(X,null,Ue);}else {let Ue=ct.find(He=>He.task.id===ae)?.task;if(Ue?.subtasks){let He=Ee(Ue.subtasks,Ce);w?.(X,ae,He);}}}}H(null),Me(null),ye(null),Mt(null),et.current=false,O(false);};react.useEffect(()=>{if(X)return document.addEventListener("mousemove",se),document.addEventListener("mouseup",De),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",De),document.body.style.cursor="",document.body.style.userSelect="";}},[X,Ce,Oe]);let $e=(_,ae,Ee)=>{switch(_.id){case "name":let Ue=I===ae.id,He=M===ae.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Ee*20}px`},children:[w&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:He?1:.3},onMouseDown:q=>ee(ae.id,q),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),ae.subtasks&&ae.subtasks.length>0?jsxRuntime.jsx("button",{onClick:q=>{q.stopPropagation(),m?.(ae.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ae.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:ae.color||"#3B82F6",opacity:ae.parentId?.6:1,borderColor:ae.isMilestone?t.accent:"transparent",borderWidth:ae.isMilestone?"2px":"0px"},title:ae.isMilestone?"Milestone":ae.parentId?"Subtask":"Task"})}),Ue?jsxRuntime.jsx("input",{ref:ie,type:"text",value:K,onChange:q=>te(q.target.value),onKeyDown:q=>{q.key==="Enter"?pa(ae.id):q.key==="Escape"&&ya();},onBlur:()=>pa(ae.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:q=>q.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:ae.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ae.parentId?"13px":"14px",fontWeight:ae.isMilestone?600:ae.parentId?400:600,letterSpacing:ae.parentId?"0":"-0.01em"},title:ae.name,children:ae.name}),He&&!Ue&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:q=>N(ae,q),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:q=>{q.stopPropagation(),ue(ae);},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 ce=_.id==="startDate"?"startDate":"endDate",Ie=ae[ce],Dt=le?.taskId===ae.id&&le?.field===ce,Je=q=>q?(typeof q=="string"?new Date(q):q).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:q=>q.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:q=>{if(Dt)xe(null);else {let Ae=q.currentTarget.getBoundingClientRect();xe({taskId:ae.id,field:ce,month:Ie?typeof Ie=="string"?new Date(Ie):Ie:new Date,position:{top:Ae.bottom+4,left:Ae.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Je(Ie)})]}),Dt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>xe(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:le?.position.top,left:le?.position.left},onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let q=new Date,Ae=new Date(q);Ae.setDate(q.getDate()+1);let ot=new Date(q);ot.setDate(q.getDate()+7);let ne=new Date(q);return ne.setDate(q.getDate()+14),[{label:"Hoy",date:q},{label:"Ma\xF1ana",date:Ae},{label:"Pr\xF3xima semana",date:ot},{label:"2 semanas",date:ne}].map((xt,Le)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:At=>At.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:At=>At.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(ae.id,{[ce]:xt.date}),xe(null);},children:xt.label},Le))})(),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:q=>q.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(ae.id,{[ce]:void 0}),xe(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:()=>xe(q=>q?{...q,month:new Date(q.month.getFullYear(),q.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:le?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>xe(q=>q?{...q,month:new Date(q.month.getFullYear(),q.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((q,Ae)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:q},Ae))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let q=le?.month||new Date,Ae=q.getFullYear(),ot=q.getMonth(),ne=new Date(Ae,ot,1).getDay(),Re=new Date(Ae,ot+1,0).getDate(),xt=new Date,Le=[];for(let st=ne-1;st>=0;st--)Le.push({day:new Date(Ae,ot,-st).getDate(),date:new Date(Ae,ot-1,new Date(Ae,ot,-st).getDate()),isCurrentMonth:false});for(let st=1;st<=Re;st++)Le.push({day:st,date:new Date(Ae,ot,st),isCurrentMonth:true});let At=42-Le.length;for(let st=1;st<=At;st++)Le.push({day:st,date:new Date(Ae,ot+1,st),isCurrentMonth:false});return Le.map((st,ga)=>{let zt=st.date.toDateString()===xt.toDateString(),kt=(Ie?typeof Ie=="string"?new Date(Ie):Ie:null)?.toDateString()===st.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:st.isCurrentMonth?kt?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:kt?"#3B82F6":"transparent",boxShadow:zt&&!kt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{h?.(ae.id,{[ce]:st.date}),xe(null);},children:st.day},ga)})})()})]})]})]}),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:oe(ae)})});case "assignees":let va=r.filter(q=>ae.assignees?.some(Ae=>Ae.name===q.name||Ae.initials===q.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(Hr,{assignedUsers:va,availableUsers:r,onChange:q=>{let Ae=q.map(ot=>({id:ot.id,name:ot.name,initials:ot.initials,color:ot.color}));h?.(ae.id,{assignees:Ae.length>0?Ae:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(Xl,{status:ae.status||"todo",onChange:q=>{h?.(ae.id,{status:q,progress:q==="completed"?100:ae.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:`${ae.progress}%`,backgroundColor:ae.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:[ae.progress,"%"]})]});case "priority":let ua={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},E={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ve=ua[ae.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(zr,{priority:ve,onChange:q=>{q&&h?.(ae.id,{priority:E[q]||"medium"});}})});default:return null}},tt=_=>[{id:"hide",label:"Hide Column",icon:Rt.Hide,onClick:()=>d(_),disabled:_==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Rt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Rt.SortDesc,onClick:()=>{}}],Ge=_=>_.subtasks&&_.subtasks.length>0?[{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{v?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{k?k(_.id,_.name):b?.([_.id]);}}]:[{id:"edit",label:R?.contextMenu?.editTask||"Edit Task",icon:Rt.Pencil,onClick:()=>{n?.(_);}},{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{v?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:R?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Rt.MarkIncomplete,onClick:()=>{h?.(_.id,{status:"todo",progress:0});},disabled:_.status==="todo"},{id:"setInProgress",label:R?.contextMenu?.setInProgress||"Set In Progress",icon:Rt.SetInProgress,onClick:()=>{h?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"markComplete",label:R?.contextMenu?.markComplete||"Mark Complete",icon:Rt.MarkComplete,onClick:()=>{h?.(_.id,{status:"completed",progress:100});},disabled:_.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:R?.contextMenu?.splitTask||"Split Task",icon:Rt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{k?k(_.id,_.name):b?.([_.id]);}}],Be=u.filter(_=>_.visible),rt=Be.reduce((_,ae)=>_+ae.width,0);return jsxRuntime.jsxs("div",{className:"h-full",style:{backgroundColor:t.bgPrimary,minWidth:rt},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Jt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:Be.map((_,ae)=>{let Ee=ae===Be.length-1,Ue=_.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ue?"":"justify-center"}`,style:{width:`${_.width}px`,minWidth:`${_.minWidth??(Ue?200:60)}px`,maxWidth:`${_.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Ee?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:He=>{He.preventDefault(),Q({isOpen:true,x:He.clientX,y:He.clientY,type:"header",columnId:_.id});},onMouseEnter:He=>{He.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:He=>{He.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:_.label,children:_.label}),_.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:de===_.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:He=>{He.preventDefault(),He.stopPropagation(),be(_.id),J(He.clientX),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"}})})]},_.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(Cn,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>ze(!Pe),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),Pe&&jsxRuntime.jsxs("div",{ref:at,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:_=>_.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:()=>ze(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Ea},children:ct.map(({task:_,level:ae},Ee)=>{let Ue=Xt(_.id),He=Ce===_.id,W=He&&Oe==="above",ce=He&&Oe==="below",Ie=He&&Oe==="child",Dt={};return Ie&&(Dt.backgroundColor=`${t.accent}15`,Dt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":_.id,className:`flex items-center cursor-pointer group ${X===_.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ue?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ue?t.accentLight:Ie?`${t.accent}15`:Ee%2===0?t.bgPrimary:t.bgGrid,...Dt},onMouseEnter:()=>D(_.id),onMouseLeave:()=>D(null),onClick:Je=>{let ua=vo(e).map(q=>q.id),ve=navigator.platform.toUpperCase().indexOf("MAC")>=0?Je.metaKey:Je.ctrlKey;Fe(_.id,ua,ve,Je.shiftKey),s?.(_);},onDoubleClick:Je=>{Je.stopPropagation(),n?.(_);},onContextMenu:Je=>{Je.preventDefault(),Q({isOpen:true,x:Je.clientX,y:Je.clientY,type:"task",task:_}),p?.(_,Je);},whileHover:{backgroundColor:Ue?t.accentLight:t.hoverBg},children:[W&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ce&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Be.map((Je,va)=>{let ua=va===Be.length-1,E=Je.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${E?"justify-start":"justify-center"}`,style:{width:`${Je.width}px`,minWidth:`${Je.minWidth??(E?200:60)}px`,maxWidth:`${Je.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ua?"none":`1px solid ${M===_.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:$e(Je,_,E?ae:0)},`${_.id}-${Je.id}`)})]},_.id)})}),jsxRuntime.jsx(yo,{isOpen:A.isOpen,x:A.x,y:A.y,items:A.type==="header"&&A.columnId?tt(A.columnId):A.type==="task"&&A.task?Ge(A.task):[],onClose:()=>Q({...A,isOpen:false}),theme:t}),mt&&vt&&X&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:vt.x+12,top:vt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let _=ct.find(ae=>ae.task.id===X)?.task;return _?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:_.name})}):null})()}),document.body)]})}function dc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,p]=react.useState(e),[m,i]=react.useState(t),[u,d]=react.useState(null),[g,h]=react.useState(null),[C,T]=react.useState(null),[c,b]=react.useState(null),[y,l]=react.useState(0),[x,v]=react.useState(0),[S,k]=react.useState(null),[w,R]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:p,ghostWidth:m,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:g,setHoveredTaskId:h,activeZone:C,setActiveZone:T,draggedSegmentIndex:c,setDraggedSegmentIndex:b,draggedSegmentStartX:y,setDraggedSegmentStartX:l,segmentDragOffsetX:x,setSegmentDragOffsetX:v,hoveredSegmentIndex:S,setHoveredSegmentIndex:k,isHovered:w,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(K,te)=>{r("none"),d(null),h(null),p(K),i(te),v(0),b(null),l(0);}}}function Sn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:p,onClick:m,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:g,allTaskPositions:h=[],onDragMove:C,onHoverChange:T}){let c=dc(t,r),b=react.useRef(null),{dragMode:y,setDragMode:l,dragOffset:x,setDragOffset:v,ghostX:S,setGhostX:k,ghostWidth:w,setGhostWidth:R,connectionLine:M,setConnectionLine:D,hoveredTaskId:I,setHoveredTaskId:B,activeZone:K,setActiveZone:te,draggedSegmentIndex:ie,setDraggedSegmentIndex:de,draggedSegmentStartX:be,setDraggedSegmentStartX:$,segmentDragOffsetX:J,setSegmentDragOffsetX:U,hoveredSegmentIndex:G,setHoveredSegmentIndex:A,isHovered:Q,setIsHovered:X,isDragging:H,isResizing:Ce,isConnecting:Me,resetDragState:Oe}=c,ye=32,Ye=8,We=e.endDate&&e.endDate<new Date&&e.progress<100,et=e.isCriticalPath,vt=o.name==="neutral"||o.today==="#1C1917",Mt=e.status==="completed"||e.progress===100,mt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},le=e.isCriticalPath||We?"#DC2626":e.color?e.color:e.priority&&mt[e.priority]?mt[e.priority]:o.taskBarPrimary,Pe=(N=>N>=80?20:N>=60?15:N>=50?12:10)(r),ze=r<50,at=r<40;react.useEffect(()=>{if(T)if(Q&&!H&&!e.segments){let N=a<100;T({task:e,x:t,y:a,width:r,height:ye,showBelow:N});}else T(null);},[Q,H,e,t,a,r,ye,T]);let Et=N=>N.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Fe=()=>{let N=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${N} day${N!==1?"s":""}`},Xt=N=>Math.round(N/s)*s,Ot=N=>{let ee=Math.round(N/s),se=new Date(n);return se.setDate(se.getDate()+ee),se},Nt=(N,ee)=>{for(let se of h){if(se.id===e.id)continue;let De=5;if(N>=se.x-De&&N<=se.x+se.width+De&&ee>=se.y-De&&ee<=se.y+se.height+De)return se.id}return null},ct=react.useCallback((N,ee,se)=>{N.preventDefault(),N.stopPropagation();let De=b.current?.ownerSVGElement;if(!De)return;let $e=De.createSVGPoint();$e.x=N.clientX,$e.y=N.clientY;let tt=$e.matrixTransform(De.getScreenCTM()?.inverse()),Ge=se!==void 0?se:t,Be=ee;if(!Be){let rt=tt.x-Ge;N.shiftKey?(Be="connect",D({x:t+r,y:a+ye/2})):N.ctrlKey||N.metaKey?Be="move":N.altKey?Be=rt<r/2?"resize-start":"resize-end":at?rt<r/2?Be="move":Be="resize-end":ze?rt<=Pe/2?Be="resize-start":rt>=r-Pe/2?Be="resize-end":Be="move":rt<=Pe?Be="resize-start":rt>=r-Pe?Be="resize-end":Be="move";}l(Be),X(false),te(null),Be==="move"?v(tt.x-Ge):Be==="connect"?D({x:t+r,y:a+ye/2}):v(0),k(Ge),R(r);},[t,r,a,ye]),Jt=react.useCallback(N=>{if(y==="none")return;let ee=b.current?.ownerSVGElement;if(!ee)return;let se=ee.createSVGPoint();se.x=N.clientX,se.y=N.clientY;let De=se.matrixTransform(ee.getScreenCTM()?.inverse());if(y==="connect"){D({x:De.x,y:De.y});let $e=Nt(De.x,De.y);B($e);}else if(y==="move"){let $e=De.x-x,tt=Xt($e);k(tt),R(r);let Ge=Math.round((tt-t)/s);if(C?.(e.id,Ge,true),e.segments&&e.segments.length>0&&ie!==null){let Be=tt-be;U(Be);}}else if(y==="resize-start"){let $e=De.x,tt=Xt($e),Ge=t+r-tt;Ge>=s&&(k(tt),R(Ge));}else if(y==="resize-end"){let $e=De.x,Ge=Xt($e)-t;Ge>=s&&R(Ge);}},[y,t,r,s,x,e,Xt,ie,be,Nt,B,D,k,R,U,C]),Ea=react.useCallback(()=>{if(y!=="none"){if(y==="connect")I&&g&&g(e,I),D(null),B(null);else {let N=e.endDate.getTime()-e.startDate.getTime(),ee,se,De=true;if(y==="move"){if(ee=Ot(S),se=new Date(ee.getTime()+N),e.segments&&e.segments.length>0&&ie!==null){let $e=Math.round(J/s),tt=e.segments.map((_,ae)=>{if(ae===ie){let Ee=new Date(_.startDate),Ue=new Date(_.endDate);return Ee.setDate(Ee.getDate()+$e),Ue.setDate(Ue.getDate()+$e),{startDate:Ee,endDate:Ue}}return _}),Ge=tt.flatMap(_=>[_.startDate,_.endDate]),Be=new Date(Math.min(...Ge.map(_=>_.getTime()))),rt=new Date(Math.max(...Ge.map(_=>_.getTime())));d?.({...e,segments:tt},Be,rt),Oe(t,r);return}}else y==="resize-start"?(ee=Ot(S),se=e.endDate,ee>se&&(console.warn("Invalid date range: start date must be before or equal to end date"),De=false)):y==="resize-end"?(ee=e.startDate,se=Ot(S+w),se<ee&&(console.warn("Invalid date range: end date must be after or equal to start date"),De=false)):De=false;De&&ee&&se&&(se.getTime()<ee.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,ee,se));}C?.(e.id,0,false),Oe(t,r);}},[y,S,w,e,d,I,g,t,r,s,Ot,J,ie,Oe,C]);react.useEffect(()=>{if(y==="none")return;let N=se=>{Jt(se);},ee=()=>{Ea();};return window.addEventListener("mousemove",N),window.addEventListener("mouseup",ee),()=>{window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",ee);}},[y,Jt,Ea]);let oe=H&&!Me?S:t,ue=H&&!Me?w:r,pa=p.taskClass(e);return jsxRuntime.jsxs("g",{ref:b,onClick:()=>!H&&m?.(e),onDoubleClick:N=>{H||(N.stopPropagation(),i?.(e));},onContextMenu:N=>{N.preventDefault(),u?.(e,N);},onMouseEnter:()=>!H&&X(true),onMouseLeave:()=>{H||(X(false),te(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+40,height:ye,fill:"transparent",style:{pointerEvents:"all"}}),Q&&!H&&!ze&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Pe,height:ye,fill:K==="resize-start"?o.accent:"transparent",opacity:K==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-start"),onMouseDown:N=>ct(N,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Pe,y:a,width:r-Pe*2,height:ye,fill:K==="move"?o.accent:"transparent",opacity:K==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:N=>ct(N,"move")}),jsxRuntime.jsx("rect",{x:t+r-Pe,y:a,width:Pe,height:ye,fill:K==="resize-end"?o.accent:"transparent",opacity:K==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:N=>ct(N,"resize-end")})]}),Q&&!H&&at&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ye,fill:K==="move"?o.accent:"transparent",opacity:K==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:N=>ct(N,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ye,fill:K==="resize-end"?o.accent:"transparent",opacity:K==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:N=>ct(N,"resize-end")}),Q&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ye-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),H&&!Me&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:S,y:a,width:w,height:ye,rx:Ye,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:oe,y:a,width:ue,height:ye,rx:Ye,fill:le,"data-task-class":pa,initial:{opacity:0,scale:.95},animate:{opacity:H&&!Me?.15:e.parentId?.6:Q?.9:.8,scale:Q&&!H?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:N=>ct(N),style:{cursor:H?Me?"crosshair":Ce?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:oe,y:a,width:ue*(e.progress/100),height:ye,rx:Ye,fill:le,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((N,ee)=>{let se=(N.startDate.getTime()-n.getTime())/864e5*s,$e=(N.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-se+s,tt=H&&y==="move"&&ie===ee,Ge=G===ee,Be=tt?se+J:se;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!H&&A(ee),onMouseLeave:()=>!H&&A(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Be,y:a,width:$e,height:ye,rx:Ye,fill:le,initial:{opacity:0,scale:.95},animate:{opacity:tt||e.parentId?.6:Ge?.9:.8,scale:Ge&&!H?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:rt=>{rt.stopPropagation(),de(ee),$(se),ct(rt,void 0,se);},style:{cursor:H?Me?"crosshair":Ce?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Be,y:a,width:$e*(e.progress/100),height:ye,rx:Ye,fill:le,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ee}`)}),vt&&(We||et)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[et&&!We&&jsxRuntime.jsx("rect",{x:oe,y:a,width:ue,height:ye,rx:Ye,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),We&&jsxRuntime.jsx("rect",{x:oe,y:a,width:ue,height:ye,rx:Ye,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ue>60&&!e.segments&&(()=>{let N=p.taskLabel(e),ee=typeof N=="string"?N:e.name,se=ee.length>Math.floor(ue/8)?`${ee.substring(0,Math.floor(ue/8))}...`:ee;return jsxRuntime.jsx("text",{x:oe+12,y:a+ye/2,dominantBaseline:"middle",fill:Mt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Mt?"line-through":"none"},children:se})})(),ue>100&&e.progress>0&&e.progress<100&&!H&&!e.segments&&jsxRuntime.jsxs("text",{x:oe+ue-12,y:a+ye/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&ue>80&&!H&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:oe+ue-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:oe+ue-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Q||Ce)&&!Me&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:oe-2,y:a,width:16,height:ye,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>te("resize-start"),onMouseLeave:()=>te(null),onMouseDown:N=>{N.stopPropagation(),ct(N,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:oe+4,y:a+8,width:3,height:ye-16,rx:1.5,fill:K==="resize-start"||y==="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:oe+ue-14,y:a,width:16,height:ye,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>te("resize-end"),onMouseLeave:()=>te(null),onMouseDown:N=>{N.stopPropagation(),ct(N,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:oe+ue-7,y:a+8,width:3,height:ye-16,rx:1.5,fill:K==="resize-end"||y==="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:Q&&!H&&!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+18,cy:a+ye/2,r:14,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>te("connect"),onMouseLeave:()=>te(null),onMouseDown:N=>{N.stopPropagation(),ct(N,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+18,cy:a+ye/2,r:7,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:K==="connect"?1.3:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}}),jsxRuntime.jsx("text",{x:t+r+32,y:a+ye/2,dominantBaseline:"middle",fill:K==="connect"?o.accent:o.textTertiary,fontSize:K==="connect"?"11":"10",fontWeight:K==="connect"?"600":"400",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Me&&M&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ye/2,x2:M.x,y2:M.y,stroke:I?o.statusCompleted:o.accent,strokeWidth:I?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:I?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:M.x,cy:M.y,r:I?8:6,fill:I?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),I&&jsxRuntime.jsx(framerMotion.motion.text,{x:M.x+15,y:M.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:M.x+10},animate:{opacity:1,x:M.x+15},transition:{duration:.2},children:"Connect"})]}),(Q||H)&&!Me&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:oe-2,y:a-2,width:ue+4,height:ye+4,rx:Ye+2,fill:"none",stroke:H?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:H?.6:.4,initial:{opacity:0},animate:{opacity:H?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:S,y1:0,x2:S,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:S+w,y1:0,x2:S+w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Q&&!H&&!e.segments&&!T&&(()=>{let se=a<100,De=se?a+ye+13:a-82-13,$e=se?`M ${oe+ue/2-6} ${a+ye+3} L ${oe+ue/2} ${a+ye+13} L ${oe+ue/2+6} ${a+ye+3}`:`M ${oe+ue/2-6} ${a-13} L ${oe+ue/2} ${a-3} L ${oe+ue/2+6} ${a-13}`,tt=De+22,Ge=De+40,Be=De+55,rt=De+70,_=se?De+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:se?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:se?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:$e,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:oe+ue/2-120,y:De,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:oe+ue/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:oe+ue/2-110,y:Ge,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:oe+ue/2-70,y:Ge,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Et(e.startDate)}),jsxRuntime.jsx("text",{x:oe+ue/2-110,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:oe+ue/2-70,y:Be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Et(e.endDate)}),jsxRuntime.jsx("text",{x:oe+ue/2+10,y:Ge,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:oe+ue/2+65,y:Ge,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Fe()}),jsxRuntime.jsx("text",{x:oe+ue/2+10,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:oe+ue/2+65,y:Be,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:oe+ue/2-110,y:rt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:oe+ue/2-50,y:rt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ae=>ae.name).join(", ").substring(0,30),e.assignees.map(ae=>ae.name).join(", ").length>30?"...":""]})]}),!se&&jsxRuntime.jsx("text",{x:oe+ue/2,y:_,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:at?"Left: move \u2022 Right: resize":ze?"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 pc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:p}=e,m=82,i=13,u=p?o+n+i:o-m-i,d=p?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,g=u+22,h=u+40,C=u+55,T=u+70,c=x=>x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let x=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${x} day${x!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:p?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:p?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:u,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:g,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?c(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?c(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:b()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(x=>x.name).join(", ").substring(0,30),a.assignees.map(x=>x.name).join(", ").length>30?"...":""]})]})]})})}function Mn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:p=false}){let[m,i]=react.useState(false),[u,d]=react.useState(null),g=r-t,h=g>0,C=Math.abs(g)<5,c=5,b=20,y=!C&&a<=e,l,x;if(C)if(x=(e+a)/2,n==="squared")l=`M ${e} ${t} L ${a} ${r}`;else {let ie=Math.min(Math.abs(a-e)/3,30);l=`M ${e} ${t} C ${e+ie} ${t}, ${a-ie} ${r}, ${a} ${r}`;}else if(x=a-b,y){let de=e+15,be=a-b,$=h?t+20:t-20;x=be,n==="squared"?l=`M ${e} ${t} L ${de} ${t} L ${de} ${$} L ${be} ${$} L ${be} ${r} L ${a} ${r}`:h?l=`M ${e} ${t} L ${de-c} ${t} Q ${de} ${t} ${de} ${t+c} L ${de} ${$-c} Q ${de} ${$} ${de-c} ${$} L ${be+c} ${$} Q ${be} ${$} ${be} ${$+c} L ${be} ${r-c} Q ${be} ${r} ${be+c} ${r} L ${a} ${r}`:l=`M ${e} ${t} L ${de-c} ${t} Q ${de} ${t} ${de} ${t-c} L ${de} ${$+c} Q ${de} ${$} ${de-c} ${$} L ${be+c} ${$} Q ${be} ${$} ${be} ${$-c} L ${be} ${r+c} Q ${be} ${r} ${be+c} ${r} L ${a} ${r}`;}else n==="squared"?l=`M ${e} ${t} L ${x} ${t} L ${x} ${r} L ${a} ${r}`:h?l=`M ${e} ${t} L ${x-c} ${t} Q ${x} ${t} ${x} ${t+c} L ${x} ${r-c} Q ${x} ${r} ${x+c} ${r} L ${a} ${r}`:l=`M ${e} ${t} L ${x-c} ${t} Q ${x} ${t} ${x} ${t-c} L ${x} ${r+c} Q ${x} ${r} ${x+c} ${r} L ${a} ${r}`;let v=5,S=`M ${a} ${r} L ${a-v} ${r-v*.5} M ${a} ${r} L ${a-v} ${r+v*.5}`,k=o.dependency,w=o.dependencyHover||k,R="#f87171",M="rgba(248, 113, 113, 0.15)",D=x,I=(t+r)/2;if(u)if(C)D=Math.max(e+10,Math.min(a-10,u.x)),I=t;else if(y){let ie=e+15,de=a-b,be=h?t+20:t-20,$=[[e,t,ie,t],[ie,t,ie,be],[ie,be,de,be],[de,be,de,r],[de,r,a,r]],J=1/0,U={x:D,y:I};for(let G of $){let A=B(u.x,u.y,G[0],G[1],G[2],G[3]),Q=Math.hypot(u.x-A.x,u.y-A.y);Q<J&&(J=Q,U=A);}D=U.x,I=U.y;}else {let ie=[[e,t,x,t],[x,t,x,r],[x,r,a,r]],de=1/0,be={x:D,y:I};for(let $ of ie){let J=B(u.x,u.y,$[0],$[1],$[2],$[3]),U=Math.hypot(u.x-J.x,u.y-J.y);U<de&&(de=U,be=J);}D=be.x,I=be.y;}function B(ie,de,be,$,J,U){let G=J-be,A=U-$,Q=G*G+A*A;if(Q===0)return {x:be,y:$};let X=((ie-be)*G+(de-$)*A)/Q;return X=Math.max(0,Math.min(1,X)),{x:be+X*G,y:$+X*A}}let K=ie=>{let de=ie.currentTarget.ownerSVGElement;if(!de)return;let be=de.getBoundingClientRect();d({x:ie.clientX-be.left,y:ie.clientY-be.top});},te=()=>{i(false),d(null);};return p?jsxRuntime.jsxs("g",{onMouseLeave:te,onMouseMove:K,children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:l,fill:"none",stroke:w,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:l,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:w,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:ie=>{ie.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:D,cy:I,r:9,fill:M,stroke:R,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:D-3,y1:I-3,x2:D+3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:D+3,y1:I-3,x2:D-3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{onMouseEnter:()=>i(true),onMouseLeave:te,onMouseMove:K,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:l,fill:"none",stroke:m?w:k,strokeWidth:m?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:S,fill:"none",stroke:m?w:k,strokeWidth:m?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:m?4:3,fill:m?w:k,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:ie=>{ie.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:D,cy:I,r:9,fill:M,stroke:R,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:D-3,y1:I-3,x2:D+3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:D+3,y1:I-3,x2:D-3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Fn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),p=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:p+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-p/2,y:a+16-p/2,width:p,height:p,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(p+4)/2,y:a+16-(p+4)/2,width:p+4,height:p+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var fe={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,p=new Set,m=i=>{if(!n.has(i)){n.add(i),p.add(i);let u=r.get(i)||[];for(let d of u){if(!n.has(d)&&m(d))return true;if(p.has(d))return true}}return p.delete(i),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=fe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=fe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=fe.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=fe.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
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=fe.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=fe.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)=>fe.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=fe.findTaskById(e,t);return !a||!a.dependencies?[]:fe.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>fe.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>fe.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=fe.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=>fe.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=fe.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"]],p=s.map(m=>{let i=m.startDate&&m.endDate?fe.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?fe.formatDate(m.startDate):"N/A",m.endDate?fe.formatDate(m.endDate):"N/A",i>0?`${i} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:n,body:p,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=fe.flattenTasks(e).map(m=>{let i=m.startDate&&m.endDate?fe.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?fe.formatDate(m.startDate):"","End Date":m.endDate?fe.formatDate(m.endDate):"","Duration (days)":i>0?i:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(u=>u.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let p=a.utils.book_new();a.utils.book_append_sheet(p,s,"Gantt Tasks"),a.writeFile(p,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=fe.flattenTasks(e),o=new Map;r.forEach((g,h)=>{o.set(g.id,h+1);});let s=g=>g.toISOString().replace("Z",""),n=fe.getEarliestStartDate(e)||new Date,p=fe.getLatestEndDate(e)||new Date,m=r.map((g,h)=>{let C=o.get(g.id),T=g.startDate&&g.endDate?fe.calculateDuration(g.startDate,g.endDate):0,c=(g.dependencies||[]).filter(b=>o.has(b)).map(b=>`
113
113
  <PredecessorLink>
114
114
  <PredecessorUID>${o.get(b)}</PredecessorUID>
@@ -339,9 +339,9 @@
339
339
  </Calendars>
340
340
  <Tasks>${m}
341
341
  </Tasks>
342
- </Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(u),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=fe.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let u=i.startDate&&i.endDate?fe.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let h of i.dependencies){let C=t.find(T=>T.id===h);if(C){o(C);let T=r.get(h)?.ef||0;d=Math.max(d,T);}}let g=d+u;r.set(i.id,{es:d,ef:g});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,p=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?fe.calculateDuration(i.startDate,i.endDate):0,d=t.filter(C=>C.dependencies&&C.dependencies.includes(i.id)),g=s;if(d.length>0)for(let C of d){p(C);let T=n.get(C.id)?.ls||0;g=Math.min(g,T);}let h=g-u;n.set(i.id,{ls:h,lf:g});};a.forEach(p);let m=[];for(let i of a){let u=r.get(i.id),d=n.get(i.id);if(u&&d){let g=d.ls-u.es;Math.abs(g)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=fe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(fe.calculateCriticalPath(e).includes(t))return 0;let o=fe.getDependentTasks(e,t);if(o.length===0){let p=fe.getLatestEndDate(e);if(!p)return null;let m=fe.calculateDuration(a.endDate,p);return Math.max(0,m)}let s=o.filter(p=>p.startDate).map(p=>p.startDate.getTime()).sort((p,m)=>p-m)[0];if(!s)return null;let n=fe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>fe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=fe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=fe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let p=fe.calculateDuration(n.startDate,n.endDate),m;a!==void 0?(m=new Date(n.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let i=fe.calculateEndDate(m,p),u=d=>d.map(g=>g.id===n.id?{...g,startDate:m,endDate:i}:g.subtasks?{...g,subtasks:u(g.subtasks)}:g);s=u(s),s=fe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,p)=>{if(a===0)return [];let m=[],i=o.getTime(),u=1e3*60*60*24,d=fe.findTaskById(e,t);if(!d||!d.endDate)return [];let g=(h,C,T=new Set)=>{if(T.has(h))return;T.add(h);let c=fe.getDependentTasks(e,h);for(let b of c){if(!b.startDate||!b.endDate)continue;let y=r.findIndex(N=>N.id===b.id);if(y===-1)continue;let l=b.startDate.getTime(),v=(b.endDate.getTime()-l)/u,k=(l-i)/u*s,w=k+C*s,R=Math.max(v*s,s),M=p+y*n+12;m.push({taskId:b.id,taskName:b.name,originalX:k,previewX:w,width:R,y:M,rowIndex:y,daysDelta:C,color:b.color}),g(b.id,C,T);}};return g(t,a),m},splitTask:(e,t,a,r=3)=>{let o=fe.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 p=new Date(o.endDate);p.setDate(p.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:p}],i=u=>u.map(d=>d.id===o.id?{...d,endDate:p,segments:m}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function In({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,templates:p,dependencyLineStyle:m="curved",onTaskClick:i,onTaskDblClick:u,onTaskContextMenu:d,onTaskDateChange:g,onDependencyCreate:h,onDependencyDelete:C}){let[c,b]=react.useState([]),[y,l]=react.useState(null),x=react.useCallback($=>{l($);},[]),v=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),D=r==="day"?60:r==="week"?20:8,k=v*D*n,w=$=>{let Q=new Date(Date.UTC($.getFullYear(),$.getMonth(),$.getDate())),U=Q.getUTCDay()||7;Q.setUTCDate(Q.getUTCDate()+4-U);let G=new Date(Date.UTC(Q.getUTCFullYear(),0,1));return Math.ceil(((Q.getTime()-G.getTime())/864e5+1)/7)},R=$=>{let Q=$.getDay();return Q===0||Q===6},M=react.useCallback($=>{let Q=Math.round($/(D*n)),U=new Date(o);return U.setDate(U.getDate()+Q),U},[o,D,n]),N=react.useCallback(($,Q)=>{if(Q.startDate&&Q.endDate)return;let U=$.currentTarget.ownerSVGElement;if(!U)return;let G=U.createSVGPoint();G.x=$.clientX,G.y=$.clientY;let A=G.matrixTransform(U.getScreenCTM()?.inverse()),Z=M(A.x),J=new Date(Z);J.setDate(J.getDate()+1),g?.(Q,Z,J);},[M,g]),I=react.useMemo(()=>{let $=A=>A.map(Z=>{if(Z.subtasks&&Z.subtasks.length>0){let J=$(Z.subtasks),H=J.filter(Te=>Te.startDate&&Te.endDate);if(H.length>0){let Te=H.map(Ye=>Ye.startDate.getTime()),Me=H.map(Ye=>Ye.endDate.getTime()),Oe=new Date(Math.min(...Te)),xe=new Date(Math.max(...Me));return {...Z,subtasks:J,startDate:Oe,endDate:xe}}return {...Z,subtasks:J}}return Z}),Q=(A,Z=[])=>{for(let J of A)Z.push(J),J.subtasks&&J.subtasks.length>0&&(J.isExpanded===void 0||J.isExpanded)&&Q(J.subtasks,Z);return Z},U=$(e);return Q(U)},[e]),B=react.useCallback($=>{if(!$.startDate||!$.endDate)return {x:0,width:0};let Q=$.startDate.getTime(),U=$.endDate.getTime(),G=o.getTime(),A=(Q-G)/(1e3*60*60*24),Z=(U-Q)/(1e3*60*60*24),J=A*D*n,H=Math.max(D*n,40),Te=Math.max(Z*D*n,H);return {x:J,width:Te}},[o,D,n]),K=react.useMemo(()=>I.filter($=>$.startDate&&$.endDate).map($=>{let{x:Q,width:U}=B($),A=I.findIndex(Z=>Z.id===$.id)*a+12;return {id:$.id,x:Q,y:A,width:U,height:32}}),[I,B]),te=react.useCallback(($,Q,U)=>{if(!U||Q===0){b([]);return}let G=fe.calculateCascadePreview(e,$,Q,I,o,D*n,a,48);b(G);},[e,I,o,D,n,a,48]),se=react.useMemo(()=>{let $=[],Q=new Date(o);for(;Q<=s;){let A=(Q.getTime()-o.getTime())/864e5*D*n;if(r==="day")$.push({date:new Date(Q),label:Q.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:A}),Q.setDate(Q.getDate()+1);else if(r==="week"){let Z=w(Q);$.push({date:new Date(Q),label:`Week ${Z}`,x:A}),Q.setDate(Q.getDate()+7);}else $.push({date:new Date(Q),label:Q.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:A}),Q.setMonth(Q.getMonth()+1);}return $},[o,s,r,D,n]),le=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*D*n,[o,D,n]),ye=Math.max(I.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(k,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(k,1e3),height:48,fill:t.bgGrid}),se.map(($,Q)=>jsxRuntime.jsxs("g",{children:[Q>0&&jsxRuntime.jsx("line",{x1:$.x,y1:0,x2:$.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:$.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:$.label})]},`header-${Q}`)),le>=0&&le<=k&&jsxRuntime.jsx("circle",{cx:le,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(k,1e3),height:ye,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(k,1e3),height:ye,fill:t.bgPrimary}),se.map(($,Q)=>{let U=se[Q+1]?.x||k,G=R($.date);return jsxRuntime.jsxs("g",{children:[G&&jsxRuntime.jsx("rect",{x:$.x,y:0,width:U-$.x,height:I.length*a,fill:t.bgWeekend,opacity:1}),Q>0&&jsxRuntime.jsx("line",{x1:$.x,y1:0,x2:$.x,y2:I.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},Q)}),I.map(($,Q)=>{let U=$.startDate&&$.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:Q*a,width:k,height:a,fill:Q%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${$.id}`),!U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:Q*a,width:k,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:G=>N(G,$),onMouseEnter:G=>{G.currentTarget.setAttribute("fill",t.accentLight),G.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:G=>{G.currentTarget.setAttribute("fill","transparent"),G.currentTarget.setAttribute("opacity","1");}},`clickable-${$.id}`),jsxRuntime.jsx("text",{x:le>0?le:100,y:Q*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${$.id}`)]})]},`row-group-${$.id}`)}),I.map(($,Q)=>{if(!$.startDate||!$.endDate)return null;let{x:U,width:G}=B($),A=Q*a+12,Z=$.subtasks&&$.subtasks.length>0&&!$.isMilestone;return $.isMilestone?jsxRuntime.jsx(Fn,{task:$,x:U+G/2,y:A+16,theme:t,onClick:i},$.id):Z?jsxRuntime.jsxs("g",{onClick:()=>i?.($),onContextMenu:J=>{J.preventDefault(),J.stopPropagation(),d?.($,J);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:U,y:A,width:G,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:U,y1:A,x2:U+G,y2:A,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U,y1:A,x2:U,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U+G,y1:A,x2:U+G,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U,y1:A+32,x2:U+G,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),G>60&&jsxRuntime.jsx("text",{x:U+12,y:A+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:$.name})]},$.id):jsxRuntime.jsx(Sn,{task:$,x:U,y:A,width:G,theme:t,dayWidth:D*n,startDate:o,templates:p,onClick:i,onDoubleClick:u,onContextMenu:d,onDateChange:g,onDependencyCreate:h,allTaskPositions:K,onDragMove:te,onHoverChange:x},$.id)}),I.map(($,Q)=>!$.dependencies||$.dependencies.length===0||!$.startDate||!$.endDate?null:$.dependencies.map(U=>{let G=I.find(xe=>xe.id===U);if(!G||!G.startDate||!G.endDate)return null;let A=I.findIndex(xe=>xe.id===U),Z=B(G),J=B($),H=Z.x+Z.width,Te=A*a+28,Me=J.x,Oe=Q*a+28;return jsxRuntime.jsx(Mn,{x1:H,y1:Te,x2:Me,y2:Oe,theme:t,lineStyle:m,onDelete:()=>C?.($.id,U)},`dep-${U}-${$.id}`)})),c.map($=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:$.previewX,y:$.y-48,width:$.width,height:32,rx:8,fill:$.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs($.daysDelta)>0&&jsxRuntime.jsx("text",{x:$.previewX+$.width/2,y:$.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:$.daysDelta>0?`+${$.daysDelta}d`:`${$.daysDelta}d`})]},`cascade-preview-${$.taskId}`)),le>=0&&le<=k&&jsxRuntime.jsx("line",{x1:le,y1:0,x2:le,y2:ye,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),y&&jsxRuntime.jsx(pc,{tooltipData:y,theme:t})]})]})}var m0=['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"'],hc=()=>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"})]}),p0=()=>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"})}),u0=()=>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"})}),g0=()=>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"})}),f0=()=>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 Bn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:p,onDependencyDelete:m}){let[i,u]=react.useState(false),[d,g]=react.useState(false),[h,C]=react.useState([]),[T,c]=react.useState(""),[b,y]=react.useState(false),[l,x]=react.useState(true),v=react.useRef(null),D=react.useRef(null),k=react.useRef(null),{enabled:w=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:M="bottom-right",onCommand:N,suggestions:I=m0,maxHistory:B=50,persistHistory:K}=a,te=K?.storageKey||"gantt-ai-history",se=K?.maxMessages??5;react.useEffect(()=>{if(K?.enabled)try{let G=localStorage.getItem(te);if(G){let Z=JSON.parse(G).map(J=>({...J,timestamp:new Date(J.timestamp)}));C(Z.slice(-se));}}catch(G){console.warn("[GanttAIAssistant] Failed to load persisted history:",G);}},[K?.enabled,te,se]),react.useEffect(()=>{if(K?.enabled&&h.length>0)try{let G=h.filter(A=>!A.isLoading).slice(-se);localStorage.setItem(te,JSON.stringify(G));}catch(G){console.warn("[GanttAIAssistant] Failed to persist history:",G);}},[h,K?.enabled,te,se]),react.useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"});},[h]),react.useEffect(()=>{i&&!d&&v.current&&setTimeout(()=>v.current?.focus(),100);},[i,d]);let le=react.useCallback(G=>{if(G.success)switch(G.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":G.taskId&&G.updates&&o?.(G.taskId,G.updates);break;case "create_task":G.newTask&&s?.(G.newTask);break;case "delete_task":G.taskId&&n?.(G.taskId);break;case "link_tasks":G.dependencyFrom&&G.dependencyTo&&p?.(G.dependencyFrom,G.dependencyTo);break;case "unlink_tasks":G.taskId&&G.dependencyFrom&&m?.(G.taskId,G.dependencyFrom);break}},[o,s,n,p,m]),ye=react.useCallback(async G=>{if(!G.trim()||b)return;let A={id:`user-${Date.now()}`,role:"user",content:G,timestamp:new Date};C(J=>[...J.slice(-(B-1)),A]),c(""),x(false),y(true);let Z={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};C(J=>[...J,Z]);try{if(N){let J=await N(G,e);C(H=>{let Te=H.filter(Oe=>!Oe.isLoading),Me={id:`assistant-${Date.now()}`,role:"assistant",content:J.message,timestamp:new Date,command:J};return [...Te,Me]}),le(J);}else C(J=>[...J.filter(Te=>!Te.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(J){C(H=>[...H.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{y(false);}},[b,B,N,e,le]),$=G=>{G.preventDefault(),ye(T);},Q=G=>{c(G),v.current?.focus();};if(react.useEffect(()=>{let G=A=>{(A.metaKey||A.ctrlKey)&&A.key==="k"&&(A.preventDefault(),u(Z=>!Z),i||g(false)),A.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[i]),react.useEffect(()=>{if(!i)return;let G=Z=>{let J=Z.target;k.current&&!k.current.contains(J)&&u(false);},A=setTimeout(()=>{document.addEventListener("mousedown",G);},100);return ()=>{clearTimeout(A),document.removeEventListener("mousedown",G);}},[i]),!w)return null;let U={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(dt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!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 ${U[M]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>u(true),children:[jsxRuntime.jsx(hc,{}),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:k,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${U[M]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(hc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>g(G=>!G),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(g0,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(u0,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[h.length===0&&l&&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:I.slice(0,4).map((G,A)=>jsxRuntime.jsx("button",{onClick:()=>Q(G),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:G.length>30?G.slice(0,30)+"...":G},A))})]}),h.map(G=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${G.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${G.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:G.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:G.role==="user"?"white":t.textPrimary},children:[G.isLoading?jsxRuntime.jsx(f0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:G.content}),G.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:G.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:G.command.success?"#10B981":"#EF4444"},children:[G.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:G.command.type.replace(/_/g," ")})]})]})},G.id)),jsxRuntime.jsx("div",{ref:D})]}),jsxRuntime.jsxs("form",{onSubmit:$,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:v,type:"text",value:T,onChange:G=>c(G.target.value),placeholder:R,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!T.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:T.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:T.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(p0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function bc(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,u=true)=>{r(d=>{let g=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:g};if(!u)return {...d,present:g};let h=[...d.past,d.present];return h.length>t&&h.shift(),{past:h,present:g,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:u,future:[i.present,...i.future]}});},[]),p=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:d}});},[]),m=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:p,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function yc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let p=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=p?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!p&&m&&n.key==="y"){n.preventDefault(),t();return}if(p&&m&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var v0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${fe.formatDate(e.startDate)} - ${fe.formatDate(e.endDate)}`);let a=fe.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=>fe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function vc(e){return {...v0,...e}}var D0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},wc=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:p="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:g=true,persistExpandedState:h,aiAssistant:C,locale:T="en",customTranslations:c,showCreateTaskButton:b=false,createTaskLabel:y,onCreateTask:l,taskFilter:x,onTaskFilterChange:v,onThemeChange:D,onTaskClick:k,onTaskDblClick:w,onTaskContextMenu:R,onTaskUpdate:M,onProgressChange:N,onTaskEdit:I,onTaskAddSubtask:B,onTaskMarkIncomplete:K,onTaskSetInProgress:te,onDependencyCreate:se,onDependencyDelete:le,onBeforeTaskAdd:ye,onAfterTaskAdd:$,onBeforeTaskUpdate:Q,onAfterTaskUpdate:U,onBeforeTaskDelete:G,onAfterTaskDelete:A}=a,J=react.useContext(vn)?.theme,[H,Te]=react.useState(J||s||"dark"),[Me,Oe]=react.useState(n),[xe,Ye]=react.useState(p),[We,tt]=react.useState(1),[xt,At]=react.useState("all"),pt=x??xt,O=v??At,[ie,ke]=react.useState(0),[Pe,Ue]=react.useState(false),[rt,Pt]=react.useState(null),[Fe,Jt]=react.useState({isOpen:false,x:0,y:0,task:null}),[zt,Dt]=react.useState(null),[mt,Qt]=react.useState(null);react.useEffect(()=>{J&&J!==H&&Te(J);},[J]),react.useEffect(()=>{s&&s!==H&&Te(s);},[s]);let Ea=react.useCallback(F=>{Te(F),D?.(F);},[D]),{state:oe,setState:pe,undo:ua,redo:ue,canUndo:S,canRedo:q,clearHistory:be}=bc(t,50),Le=react.useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),ze=react.useRef(new Map),je=react.useRef(false);if(!je.current&&h){je.current=true;let F=typeof h=="string"?h:"gantt-expanded-tasks";try{let L=localStorage.getItem(F);if(L){let V=JSON.parse(L);Array.isArray(V)&&(ze.current=new Map(V));}}catch(L){console.warn("[GanttBoard] Error loading expanded state from localStorage:",L);}}let Re=react.useCallback(()=>{let F=Le();if(F)try{let L=Array.from(ze.current.entries());localStorage.setItem(F,JSON.stringify(L));}catch(L){console.warn("[GanttBoard] Error saving expanded state to localStorage:",L);}},[Le]);react.useEffect(()=>{let F=L=>L.map(V=>{let re=ze.current.get(V.id),ge=re!==void 0?{...V,isExpanded:re}:V;return ge.subtasks?.length?{...ge,subtasks:F(ge.subtasks)}:ge});ze.current.size>0?pe(F(t)):pe(t);},[t,pe]);let at=react.useRef(t),st=react.useRef(true);react.useEffect(()=>{if(st.current){st.current=false,at.current=oe;return}if(!r)return;let F=JSON.stringify(at.current),L=JSON.stringify(oe);F!==L&&(at.current=oe,r(oe));},[oe,r]);let _=react.useMemo(()=>ti(T,c),[T,c]),ae=react.useCallback(F=>[{id:"name",label:F.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:F.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:F.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:F.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:F.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:F.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:F.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:F.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Ee,Ke]=react.useState(()=>ae(_));react.useEffect(()=>{Ke(F=>F.map(L=>({...L,label:_.columns[L.id==="name"?"taskName":L.id]||L.label})));},[_]);let He=react.useMemo(()=>Ee.filter(L=>L.visible).reduce((L,V)=>L+V.width,0),[Ee]),W=react.useRef(Ee.filter(F=>F.visible).map(F=>F.id).join(","));react.useEffect(()=>{let F=Ee.filter(re=>re.visible),L=F.map(re=>re.id).join(","),V=W.current;if(L!==V){let re=F.some(De=>De.id!=="name"),ge=V.includes(",");re?!ge&&re&&Pt(null):Pt(null),W.current=L;}},[Ee]);let de=60,Be=.6,St=react.useMemo(()=>{let L=He+de,V=typeof window<"u"?window.innerWidth*Be:800,re=Math.max(L,V);return rt!==null?Math.max(200,Math.min(rt,re)):Math.max(200,L)},[rt,He]),Qe=react.useRef(null),va=react.useRef(null),ga=react.useRef(null),E=react.useMemo(()=>Ud(H),[H]),ve=react.useMemo(()=>({theme:E,themeName:H}),[E,H]),X=react.useMemo(()=>vc(d),[d]),Ae=react.useMemo(()=>{if(!g)return oe;let F=fe.calculateCriticalPath(oe),L=V=>V.map(re=>({...re,isCriticalPath:F.includes(re.id),subtasks:re.subtasks?L(re.subtasks):void 0}));return L(oe)},[oe,g]),ot=react.useMemo(()=>{if(pt==="all")return Ae;let F=L=>{let V=[];for(let re of L){let ge=re.subtasks?.length?F(re.subtasks):void 0,De=false;switch(pt){case "incomplete":De=re.progress<100;break;case "in_progress":De=re.progress>0&&re.progress<100;break;case "completed":De=re.progress===100;break}(De||ge&&ge.length>0)&&V.push({...re,subtasks:ge});}return V};return F(Ae)},[Ae,pt]),ne=D0(xe);yc({undo:ua,redo:ue,canUndo:S,canRedo:q,enabled:true}),react.useImperativeHandle(o,()=>({getTask:F=>fe.findTaskById(oe,F),addTask:(F,L)=>{pe(V=>{if(!L)return [...V,{...F,level:0}];let re=ge=>ge.map(De=>De.id===L?{...De,subtasks:[...De.subtasks||[],{...F,parentId:L,level:(De.level||0)+1}],isExpanded:true}:De.subtasks?{...De,subtasks:re(De.subtasks)}:De);return re(V)});},updateTask:(F,L)=>{pe(V=>{let re=ge=>ge.map(De=>De.id===F?{...De,...L}:De.subtasks?{...De,subtasks:re(De.subtasks)}:De);return re(V)});},deleteTask:F=>{pe(L=>{let V=re=>re.filter(ge=>ge.id===F?false:(ge.subtasks&&(ge.subtasks=V(ge.subtasks)),true));return V(L)});},deleteTasks:F=>{pe(L=>mi(L,F));},duplicateTask:F=>{pe(L=>pi(L,[F]));},splitTask:(F,L,V=3)=>{pe(re=>fe.splitTask(re,F,L,V));},calculateEndDate:fe.calculateEndDate,calculateDuration:fe.calculateDuration,validateDependency:(F,L)=>!fe.validateDependencies(oe,F,L),getAllTasks:()=>fe.flattenTasks(oe),getTasksByStatus:F=>fe.flattenTasks(oe).filter(L=>L.status===F),getTasksByParent:F=>F?fe.findTaskById(oe,F)?.subtasks||[]:oe.filter(V=>!V.parentId),getCriticalPath:()=>fe.flattenTasks(oe).filter(F=>F.isCriticalPath),indentTask:F=>{pe(L=>li(L,[F]));},outdentTask:F=>{pe(L=>di(L,[F]));},moveTask:(F,L)=>{pe(V=>ci(V,[F],L));},createSubtask:async F=>{let{tasks:L,newTask:V}=fi(oe,F);if(ye){let re=ye({...V,parentId:F});if((re instanceof Promise?await re:re)===false)return}pe(L),$&&$({...V,parentId:F});},scrollToTask:F=>{let V=fe.flattenTasks(oe).findIndex(re=>re.id===F);if(V!==-1&&Qe.current){let re=V*ne;Qe.current.scrollTo({top:re,behavior:"smooth"}),va.current&&va.current.scrollTo({top:re,behavior:"smooth"});}},highlightTask:(F,L=2e3)=>{},expandTask:F=>{pe(L=>{let V=re=>re.map(ge=>ge.id===F?{...ge,isExpanded:true}:ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge);return V(L)});},collapseTask:F=>{pe(L=>{let V=re=>re.map(ge=>ge.id===F?{...ge,isExpanded:false}:ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge);return V(L)});},expandAll:()=>{pe(F=>{let L=V=>V.map(re=>({...re,isExpanded:true,subtasks:re.subtasks?L(re.subtasks):void 0}));return L(F)});},collapseAll:()=>{pe(F=>{let L=V=>V.map(re=>({...re,isExpanded:false,subtasks:re.subtasks?L(re.subtasks):void 0}));return L(F)});},undo:ua,redo:ue,canUndo:()=>S,canRedo:()=>q,clearHistory:be,exportToPNG:async()=>{if(!ga.current||!Qe.current||!va.current)throw new Error("Gantt container not found");let F=ga.current,L=Qe.current.querySelector(".gantt-grid-scroll"),V=va.current,re=L?.scrollTop||0,ge=V.scrollTop,De=F.style.overflow,ht=F.style.height;try{let Zt=L?.querySelector(".gantt-taskgrid-content"),xa=V.querySelector("svg"),ka=Zt?.scrollHeight||L?.scrollHeight||600,Fa=xa?.getBoundingClientRect().height||V.scrollHeight,Rr=(F.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(ka,Fa)+20;L&&(L.scrollTop=0),V.scrollTop=0,F.style.overflow="visible",F.style.height=`${Rr}px`,await new Promise(wr=>setTimeout(wr,100));let kr=await kc__default.default(F,{backgroundColor:E.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:wr=>{let ro=window.getComputedStyle(wr),$r=parseInt(ro.zIndex,10);return !isNaN($r)&&$r>=50||ro.position==="fixed"}});return new Promise((wr,ro)=>{kr.toBlob($r=>{$r?wr($r):ro(new Error("Failed to create blob from canvas"));},"image/png");})}finally{F.style.overflow=De,F.style.height=ht,L&&(L.scrollTop=re),V.scrollTop=ge;}},exportToPDF:async F=>{await fe.exportToPDF(oe,F);},exportToExcel:async F=>{await fe.exportToExcel(oe,F);},exportToJSON:()=>fe.exportToJSON(oe),exportToCSV:()=>fe.exportToCSV(oe),importFromJSON:F=>{let L=fe.importFromJSON(F);pe(L);},getTasks:()=>oe,refresh:()=>{pe(F=>[...F]);},clearAll:()=>{pe([]);}}),[oe,ua,ue,S,q,be,E,ne]);let $e=react.useCallback(F=>{Ke(L=>L.map(V=>V.id===F?{...V,visible:!V.visible}:V));},[]),kt=react.useCallback((F,L)=>{Ke(V=>V.map(re=>{if(re.id!==F)return re;let ge=re.minWidth??100,De=re.maxWidth??800,ht=Math.max(ge,Math.min(De,L));return {...re,width:ht}}));},[]),Ie=react.useCallback(F=>{pe(L=>{let V=gi(L,F),re=ge=>{for(let De of ge){if(De.id===F){ze.current.set(F,De.isExpanded??true);return}De.subtasks?.length&&re(De.subtasks);}};return re(V),Re(),V}),a.onTaskToggleExpand?.(F);},[a,Re]),Ft=react.useCallback((F,L)=>{if(Q&&Q(F,L)===false)return;let re=fe.findTaskById(oe,F)?.progress,ge=ht=>ht.map(Zt=>Zt.id===F?{...Zt,...L}:Zt.subtasks?{...Zt,subtasks:ge(Zt.subtasks)}:Zt);pe(ge(oe));let De=fe.findTaskById(ge(oe),F);De&&(M?.(De),U?.(De),L.progress!==void 0&&re!==void 0&&L.progress!==re&&N?.(F,re,L.progress));},[oe,M,Q,U,N]),it=react.useCallback(F=>{F.length!==0&&(pe(L=>li(L,F)),a.onTaskIndent?.(F[0]));},[a]),fa=react.useCallback(F=>{F.length!==0&&(pe(L=>di(L,F)),a.onTaskOutdent?.(F[0]));},[a]),Ut=react.useCallback((F,L,V)=>{pe(re=>oc(re,F,L,V)),a.onTaskReparent?.(F,L,V);},[a]),Ve=react.useCallback((F,L)=>{F.length!==0&&(pe(V=>ci(V,F,L)),a.onTaskMove?.(F[0],L));},[a]),wt=react.useCallback(async F=>{let L=[];for(let V of F)G&&await Promise.resolve(G(V))===false||L.push(V);L.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(L):(pe(V=>mi(V,L)),L.forEach(V=>a.onTaskDelete?.(V))),A&&L.forEach(V=>A(V)));},[a,G,A]),la=react.useCallback(F=>{pe(L=>pi(L,F)),F.forEach(L=>a.onTaskDuplicate?.(L));},[a]),vr=react.useCallback((F,L)=>{pe(V=>{let{tasks:re,newTask:ge}=rc(V,F,L);return ye&&ye(ge)===false?V:(a.onTaskCreate?.(ge.parentId,ge.position||0),$?.(ge),re)});},[a,ye,$]),Hm=react.useCallback((F,L)=>{pe(V=>ui(V,F,L)),a.onTaskRename?.(F,L);},[a]),Zn=react.useCallback(F=>{pe(L=>{let{tasks:V}=fi(L,F);return a.onTaskCreate?.(F,0),V});},[a]),Wm=react.useCallback((F,L,V)=>{let re=F.startDate?Math.round((L.getTime()-F.startDate.getTime())/864e5):0,ge=Zt=>Zt.map(xa=>xa.id===F.id?{...xa,startDate:L,endDate:V,...F.segments&&{segments:F.segments}}:xa.subtasks?{...xa,subtasks:ge(xa.subtasks)}:xa),De=ge(oe);De=fe.autoScheduleDependents(De,F.id,re),pe(De);let ht={...F,startDate:L,endDate:V};M?.(ht);},[oe,M]),Gm=react.useCallback((F,L)=>{R?.(F,L),Jt({isOpen:true,x:L.clientX,y:L.clientY,task:F});},[R]),_m=react.useCallback((F,L)=>{let V=fe.splitTask(oe,F.id,L);pe(V),Jt({isOpen:false,x:0,y:0,task:null});},[oe]),hl=react.useCallback(F=>{let L=fe.findTaskById(oe,F.id)||F;w?.(L),I||Dt(L);},[oe,w,I]),bl=react.useCallback((F,L,V)=>{let re=new Map,ge=ka=>{ka.forEach(Fa=>{Fa.dependencies&&re.set(Fa.id,Fa.dependencies),Fa.subtasks&&ge(Fa.subtasks);});};ge(V);let De=re.get(L)||[];re.set(L,[...De,F]);let ht=new Set,Zt=new Set,xa=ka=>{if(!ht.has(ka)){ht.add(ka),Zt.add(ka);let Fa=re.get(ka)||[];for(let xr of Fa){if(!ht.has(xr)&&xa(xr))return true;if(Zt.has(xr))return true}}return Zt.delete(ka),false};return xa(L)},[]),yl=react.useCallback((F,L)=>{if(bl(F.id,L,oe)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
342
+ </Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(u),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=fe.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let u=i.startDate&&i.endDate?fe.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let h of i.dependencies){let C=t.find(T=>T.id===h);if(C){o(C);let T=r.get(h)?.ef||0;d=Math.max(d,T);}}let g=d+u;r.set(i.id,{es:d,ef:g});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,p=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?fe.calculateDuration(i.startDate,i.endDate):0,d=t.filter(C=>C.dependencies&&C.dependencies.includes(i.id)),g=s;if(d.length>0)for(let C of d){p(C);let T=n.get(C.id)?.ls||0;g=Math.min(g,T);}let h=g-u;n.set(i.id,{ls:h,lf:g});};a.forEach(p);let m=[];for(let i of a){let u=r.get(i.id),d=n.get(i.id);if(u&&d){let g=d.ls-u.es;Math.abs(g)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=fe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(fe.calculateCriticalPath(e).includes(t))return 0;let o=fe.getDependentTasks(e,t);if(o.length===0){let p=fe.getLatestEndDate(e);if(!p)return null;let m=fe.calculateDuration(a.endDate,p);return Math.max(0,m)}let s=o.filter(p=>p.startDate).map(p=>p.startDate.getTime()).sort((p,m)=>p-m)[0];if(!s)return null;let n=fe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>fe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=fe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=fe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let p=fe.calculateDuration(n.startDate,n.endDate),m;a!==void 0?(m=new Date(n.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let i=fe.calculateEndDate(m,p),u=d=>d.map(g=>g.id===n.id?{...g,startDate:m,endDate:i}:g.subtasks?{...g,subtasks:u(g.subtasks)}:g);s=u(s),s=fe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,p)=>{if(a===0)return [];let m=[],i=o.getTime(),u=1e3*60*60*24,d=fe.findTaskById(e,t);if(!d||!d.endDate)return [];let g=(h,C,T=new Set)=>{if(T.has(h))return;T.add(h);let c=fe.getDependentTasks(e,h);for(let b of c){if(!b.startDate||!b.endDate)continue;let y=r.findIndex(D=>D.id===b.id);if(y===-1)continue;let l=b.startDate.getTime(),v=(b.endDate.getTime()-l)/u,k=(l-i)/u*s,w=k+C*s,R=Math.max(v*s,s),M=p+y*n+12;m.push({taskId:b.id,taskName:b.name,originalX:k,previewX:w,width:R,y:M,rowIndex:y,daysDelta:C,color:b.color}),g(b.id,C,T);}};return g(t,a),m},splitTask:(e,t,a,r=3)=>{let o=fe.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 p=new Date(o.endDate);p.setDate(p.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:p}],i=u=>u.map(d=>d.id===o.id?{...d,endDate:p,segments:m}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function In({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,templates:p,dependencyLineStyle:m="curved",onTaskClick:i,onTaskDblClick:u,onTaskContextMenu:d,onTaskDateChange:g,onDependencyCreate:h,onDependencyDelete:C}){let[c,b]=react.useState([]),[y,l]=react.useState(null),x=react.useCallback($=>{l($);},[]),v=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),S=r==="day"?60:r==="week"?20:8,k=v*S*n,w=$=>{let J=new Date(Date.UTC($.getFullYear(),$.getMonth(),$.getDate())),U=J.getUTCDay()||7;J.setUTCDate(J.getUTCDate()+4-U);let G=new Date(Date.UTC(J.getUTCFullYear(),0,1));return Math.ceil(((J.getTime()-G.getTime())/864e5+1)/7)},R=$=>{let J=$.getDay();return J===0||J===6},M=react.useCallback($=>{let J=Math.round($/(S*n)),U=new Date(o);return U.setDate(U.getDate()+J),U},[o,S,n]),D=react.useCallback(($,J)=>{if(J.startDate&&J.endDate)return;let U=$.currentTarget.ownerSVGElement;if(!U)return;let G=U.createSVGPoint();G.x=$.clientX,G.y=$.clientY;let A=G.matrixTransform(U.getScreenCTM()?.inverse()),Q=M(A.x),X=new Date(Q);X.setDate(X.getDate()+1),g?.(J,Q,X);},[M,g]),I=react.useMemo(()=>{let $=A=>A.map(Q=>{if(Q.subtasks&&Q.subtasks.length>0){let X=$(Q.subtasks),H=X.filter(Ce=>Ce.startDate&&Ce.endDate);if(H.length>0){let Ce=H.map(Ye=>Ye.startDate.getTime()),Me=H.map(Ye=>Ye.endDate.getTime()),Oe=new Date(Math.min(...Ce)),ye=new Date(Math.max(...Me));return {...Q,subtasks:X,startDate:Oe,endDate:ye}}return {...Q,subtasks:X}}return Q}),J=(A,Q=[])=>{for(let X of A)Q.push(X),X.subtasks&&X.subtasks.length>0&&(X.isExpanded===void 0||X.isExpanded)&&J(X.subtasks,Q);return Q},U=$(e);return J(U)},[e]),B=react.useCallback($=>{if(!$.startDate||!$.endDate)return {x:0,width:0};let J=$.startDate.getTime(),U=$.endDate.getTime(),G=o.getTime(),A=(J-G)/(1e3*60*60*24),Q=(U-J)/(1e3*60*60*24),X=A*S*n,H=Math.max(S*n,40),Ce=Math.max(Q*S*n,H);return {x:X,width:Ce}},[o,S,n]),K=react.useMemo(()=>I.filter($=>$.startDate&&$.endDate).map($=>{let{x:J,width:U}=B($),A=I.findIndex(Q=>Q.id===$.id)*a+12;return {id:$.id,x:J,y:A,width:U,height:32}}),[I,B]),te=react.useCallback(($,J,U)=>{if(!U||J===0){b([]);return}let G=fe.calculateCascadePreview(e,$,J,I,o,S*n,a,48);b(G);},[e,I,o,S,n,a,48]),ie=react.useMemo(()=>{let $=[],J=new Date(o);for(;J<=s;){let A=(J.getTime()-o.getTime())/864e5*S*n;if(r==="day")$.push({date:new Date(J),label:J.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:A}),J.setDate(J.getDate()+1);else if(r==="week"){let Q=w(J);$.push({date:new Date(J),label:`Week ${Q}`,x:A}),J.setDate(J.getDate()+7);}else $.push({date:new Date(J),label:J.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:A}),J.setMonth(J.getMonth()+1);}return $},[o,s,r,S,n]),de=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*S*n,[o,S,n]),be=Math.max(I.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(k,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(k,1e3),height:48,fill:t.bgGrid}),ie.map(($,J)=>jsxRuntime.jsxs("g",{children:[J>0&&jsxRuntime.jsx("line",{x1:$.x,y1:0,x2:$.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:$.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:$.label})]},`header-${J}`)),de>=0&&de<=k&&jsxRuntime.jsx("circle",{cx:de,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(k,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(k,1e3),height:be,fill:t.bgPrimary}),ie.map(($,J)=>{let U=ie[J+1]?.x||k,G=R($.date);return jsxRuntime.jsxs("g",{children:[G&&jsxRuntime.jsx("rect",{x:$.x,y:0,width:U-$.x,height:I.length*a,fill:t.bgWeekend,opacity:1}),J>0&&jsxRuntime.jsx("line",{x1:$.x,y1:0,x2:$.x,y2:I.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},J)}),I.map(($,J)=>{let U=$.startDate&&$.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:J*a,width:k,height:a,fill:J%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${$.id}`),!U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:J*a,width:k,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:G=>D(G,$),onMouseEnter:G=>{G.currentTarget.setAttribute("fill",t.accentLight),G.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:G=>{G.currentTarget.setAttribute("fill","transparent"),G.currentTarget.setAttribute("opacity","1");}},`clickable-${$.id}`),jsxRuntime.jsx("text",{x:de>0?de:100,y:J*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${$.id}`)]})]},`row-group-${$.id}`)}),I.map(($,J)=>{if(!$.startDate||!$.endDate)return null;let{x:U,width:G}=B($),A=J*a+12,Q=$.subtasks&&$.subtasks.length>0&&!$.isMilestone;return $.isMilestone?jsxRuntime.jsx(Fn,{task:$,x:U+G/2,y:A+16,theme:t,onClick:i},$.id):Q?jsxRuntime.jsxs("g",{onClick:()=>i?.($),onContextMenu:X=>{X.preventDefault(),X.stopPropagation(),d?.($,X);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:U,y:A,width:G,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:U,y1:A,x2:U+G,y2:A,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U,y1:A,x2:U,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U+G,y1:A,x2:U+G,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U,y1:A+32,x2:U+G,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),G>60&&jsxRuntime.jsx("text",{x:U+12,y:A+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:$.name})]},$.id):jsxRuntime.jsx(Sn,{task:$,x:U,y:A,width:G,theme:t,dayWidth:S*n,startDate:o,templates:p,onClick:i,onDoubleClick:u,onContextMenu:d,onDateChange:g,onDependencyCreate:h,allTaskPositions:K,onDragMove:te,onHoverChange:x},$.id)}),I.map(($,J)=>!$.dependencies||$.dependencies.length===0||!$.startDate||!$.endDate?null:$.dependencies.map(U=>{let G=I.find(ye=>ye.id===U);if(!G||!G.startDate||!G.endDate)return null;let A=I.findIndex(ye=>ye.id===U),Q=B(G),X=B($),H=Q.x+Q.width,Ce=A*a+28,Me=X.x,Oe=J*a+28;return jsxRuntime.jsx(Mn,{x1:H,y1:Ce,x2:Me,y2:Oe,theme:t,lineStyle:m,onDelete:()=>C?.($.id,U)},`dep-${U}-${$.id}`)})),c.map($=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:$.previewX,y:$.y-48,width:$.width,height:32,rx:8,fill:$.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs($.daysDelta)>0&&jsxRuntime.jsx("text",{x:$.previewX+$.width/2,y:$.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:$.daysDelta>0?`+${$.daysDelta}d`:`${$.daysDelta}d`})]},`cascade-preview-${$.taskId}`)),de>=0&&de<=k&&jsxRuntime.jsx("line",{x1:de,y1:0,x2:de,y2:be,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),y&&jsxRuntime.jsx(pc,{tooltipData:y,theme:t})]})]})}var m0=['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"'],hc=()=>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"})]}),p0=()=>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"})}),u0=()=>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"})}),g0=()=>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"})}),f0=()=>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 Bn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:p,onDependencyDelete:m}){let[i,u]=react.useState(false),[d,g]=react.useState(false),[h,C]=react.useState([]),[T,c]=react.useState(""),[b,y]=react.useState(false),[l,x]=react.useState(true),v=react.useRef(null),S=react.useRef(null),k=react.useRef(null),{enabled:w=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:M="bottom-right",onCommand:D,suggestions:I=m0,maxHistory:B=50,persistHistory:K}=a,te=K?.storageKey||"gantt-ai-history",ie=K?.maxMessages??5;react.useEffect(()=>{if(K?.enabled)try{let G=localStorage.getItem(te);if(G){let Q=JSON.parse(G).map(X=>({...X,timestamp:new Date(X.timestamp)}));C(Q.slice(-ie));}}catch(G){console.warn("[GanttAIAssistant] Failed to load persisted history:",G);}},[K?.enabled,te,ie]),react.useEffect(()=>{if(K?.enabled&&h.length>0)try{let G=h.filter(A=>!A.isLoading).slice(-ie);localStorage.setItem(te,JSON.stringify(G));}catch(G){console.warn("[GanttAIAssistant] Failed to persist history:",G);}},[h,K?.enabled,te,ie]),react.useEffect(()=>{S.current&&S.current.scrollIntoView({behavior:"smooth"});},[h]),react.useEffect(()=>{i&&!d&&v.current&&setTimeout(()=>v.current?.focus(),100);},[i,d]);let de=react.useCallback(G=>{if(G.success)switch(G.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":G.taskId&&G.updates&&o?.(G.taskId,G.updates);break;case "create_task":G.newTask&&s?.(G.newTask);break;case "delete_task":G.taskId&&n?.(G.taskId);break;case "link_tasks":G.dependencyFrom&&G.dependencyTo&&p?.(G.dependencyFrom,G.dependencyTo);break;case "unlink_tasks":G.taskId&&G.dependencyFrom&&m?.(G.taskId,G.dependencyFrom);break}},[o,s,n,p,m]),be=react.useCallback(async G=>{if(!G.trim()||b)return;let A={id:`user-${Date.now()}`,role:"user",content:G,timestamp:new Date};C(X=>[...X.slice(-(B-1)),A]),c(""),x(false),y(true);let Q={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};C(X=>[...X,Q]);try{if(D){let X=await D(G,e);C(H=>{let Ce=H.filter(Oe=>!Oe.isLoading),Me={id:`assistant-${Date.now()}`,role:"assistant",content:X.message,timestamp:new Date,command:X};return [...Ce,Me]}),de(X);}else C(X=>[...X.filter(Ce=>!Ce.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(X){C(H=>[...H.filter(Me=>!Me.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${X instanceof Error?X.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[b,B,D,e,de]),$=G=>{G.preventDefault(),be(T);},J=G=>{c(G),v.current?.focus();};if(react.useEffect(()=>{let G=A=>{(A.metaKey||A.ctrlKey)&&A.key==="k"&&(A.preventDefault(),u(Q=>!Q),i||g(false)),A.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[i]),react.useEffect(()=>{if(!i)return;let G=Q=>{let X=Q.target;k.current&&!k.current.contains(X)&&u(false);},A=setTimeout(()=>{document.addEventListener("mousedown",G);},100);return ()=>{clearTimeout(A),document.removeEventListener("mousedown",G);}},[i]),!w)return null;let U={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!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 ${U[M]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>u(true),children:[jsxRuntime.jsx(hc,{}),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:k,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${U[M]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(hc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>g(G=>!G),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(g0,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(u0,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[h.length===0&&l&&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:I.slice(0,4).map((G,A)=>jsxRuntime.jsx("button",{onClick:()=>J(G),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:G.length>30?G.slice(0,30)+"...":G},A))})]}),h.map(G=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${G.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${G.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:G.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:G.role==="user"?"white":t.textPrimary},children:[G.isLoading?jsxRuntime.jsx(f0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:G.content}),G.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:G.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:G.command.success?"#10B981":"#EF4444"},children:[G.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:G.command.type.replace(/_/g," ")})]})]})},G.id)),jsxRuntime.jsx("div",{ref:S})]}),jsxRuntime.jsxs("form",{onSubmit:$,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:v,type:"text",value:T,onChange:G=>c(G.target.value),placeholder:R,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!T.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:T.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:T.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(p0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function bc(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,u=true)=>{r(d=>{let g=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:g};if(!u)return {...d,present:g};let h=[...d.past,d.present];return h.length>t&&h.shift(),{past:h,present:g,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:u,future:[i.present,...i.future]}});},[]),p=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:d}});},[]),m=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:p,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function yc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let p=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=p?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!p&&m&&n.key==="y"){n.preventDefault(),t();return}if(p&&m&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var v0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${fe.formatDate(e.startDate)} - ${fe.formatDate(e.endDate)}`);let a=fe.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=>fe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function vc(e){return {...v0,...e}}var D0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},wc=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:p="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:g=true,persistExpandedState:h,aiAssistant:C,locale:T="en",customTranslations:c,showCreateTaskButton:b=false,createTaskLabel:y,onCreateTask:l,taskFilter:x,onTaskFilterChange:v,onThemeChange:S,onTaskClick:k,onTaskDblClick:w,onTaskContextMenu:R,onTaskUpdate:M,onProgressChange:D,onTaskEdit:I,onTaskAddSubtask:B,onTaskMarkIncomplete:K,onTaskSetInProgress:te,onDependencyCreate:ie,onDependencyDelete:de,onBeforeTaskAdd:be,onAfterTaskAdd:$,onBeforeTaskUpdate:J,onAfterTaskUpdate:U,onBeforeTaskDelete:G,onAfterTaskDelete:A}=a,X=react.useContext(vn)?.theme,[H,Ce]=react.useState(X||s||"dark"),[Me,Oe]=react.useState(n),[ye,Ye]=react.useState(p),[We,et]=react.useState(1),[vt,Mt]=react.useState("all"),mt=x??vt,O=v??Mt,[le,xe]=react.useState(0),[Pe,ze]=react.useState(false),[at,Et]=react.useState(null),[Fe,Xt]=react.useState({isOpen:false,x:0,y:0,task:null}),[Ot,Nt]=react.useState(null),[ct,Jt]=react.useState(null);react.useEffect(()=>{X&&X!==H&&Ce(X);},[X]),react.useEffect(()=>{s&&s!==H&&Ce(s);},[s]);let Ea=react.useCallback(F=>{Ce(F),S?.(F);},[S]),{state:oe,setState:ue,undo:pa,redo:ya,canUndo:N,canRedo:ee,clearHistory:se}=bc(t,50),De=react.useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),$e=react.useRef(new Map),tt=react.useRef(false);if(!tt.current&&h){tt.current=true;let F=typeof h=="string"?h:"gantt-expanded-tasks";try{let L=localStorage.getItem(F);if(L){let V=JSON.parse(L);Array.isArray(V)&&($e.current=new Map(V));}}catch(L){console.warn("[GanttBoard] Error loading expanded state from localStorage:",L);}}let Ge=react.useCallback(()=>{let F=De();if(F)try{let L=Array.from($e.current.entries());localStorage.setItem(F,JSON.stringify(L));}catch(L){console.warn("[GanttBoard] Error saving expanded state to localStorage:",L);}},[De]);react.useEffect(()=>{let F=L=>L.map(V=>{let re=$e.current.get(V.id),ge=re!==void 0?{...V,isExpanded:re}:V;return ge.subtasks?.length?{...ge,subtasks:F(ge.subtasks)}:ge});$e.current.size>0?ue(F(t)):ue(t);},[t,ue]);let Be=react.useRef(t),rt=react.useRef(true);react.useEffect(()=>{if(rt.current){rt.current=false,Be.current=oe;return}if(!r)return;let F=JSON.stringify(Be.current),L=JSON.stringify(oe);F!==L&&(Be.current=oe,r(oe));},[oe,r]);let _=react.useMemo(()=>ti(T,c),[T,c]),ae=react.useCallback(F=>[{id:"name",label:F.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:F.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:F.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:F.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:F.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:F.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:F.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:F.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Ee,Ue]=react.useState(()=>ae(_));react.useEffect(()=>{Ue(F=>F.map(L=>({...L,label:_.columns[L.id==="name"?"taskName":L.id]||L.label})));},[_]);let He=react.useMemo(()=>Ee.filter(L=>L.visible).reduce((L,V)=>L+V.width,0),[Ee]),W=react.useRef(Ee.filter(F=>F.visible).map(F=>F.id).join(","));react.useEffect(()=>{let F=Ee.filter(re=>re.visible),L=F.map(re=>re.id).join(","),V=W.current;if(L!==V){let re=F.some(Ne=>Ne.id!=="name"),ge=V.includes(",");re?!ge&&re&&Et(null):Et(null),W.current=L;}},[Ee]);let ce=60,Ie=.6,Dt=react.useMemo(()=>{let L=He+ce,V=typeof window<"u"?window.innerWidth*Ie:800,re=Math.max(L,V);return at!==null?Math.max(200,Math.min(at,re)):Math.max(200,L)},[at,He]),Je=react.useRef(null),va=react.useRef(null),ua=react.useRef(null),E=react.useMemo(()=>Ud(H),[H]),ve=react.useMemo(()=>({theme:E,themeName:H}),[E,H]),q=react.useMemo(()=>vc(d),[d]),Ae=react.useMemo(()=>{if(!g)return oe;let F=fe.calculateCriticalPath(oe),L=V=>V.map(re=>({...re,isCriticalPath:F.includes(re.id),subtasks:re.subtasks?L(re.subtasks):void 0}));return L(oe)},[oe,g]),ot=react.useMemo(()=>{if(mt==="all")return Ae;let F=L=>{let V=[];for(let re of L){let ge=re.subtasks?.length?F(re.subtasks):void 0,Ne=false;switch(mt){case "incomplete":Ne=re.progress<100;break;case "in_progress":Ne=re.progress>0&&re.progress<100;break;case "completed":Ne=re.progress===100;break}(Ne||ge&&ge.length>0)&&V.push({...re,subtasks:ge});}return V};return F(Ae)},[Ae,mt]),ne=D0(ye);yc({undo:pa,redo:ya,canUndo:N,canRedo:ee,enabled:true}),react.useImperativeHandle(o,()=>({getTask:F=>fe.findTaskById(oe,F),addTask:(F,L)=>{ue(V=>{if(!L)return [...V,{...F,level:0}];let re=ge=>ge.map(Ne=>Ne.id===L?{...Ne,subtasks:[...Ne.subtasks||[],{...F,parentId:L,level:(Ne.level||0)+1}],isExpanded:true}:Ne.subtasks?{...Ne,subtasks:re(Ne.subtasks)}:Ne);return re(V)});},updateTask:(F,L)=>{ue(V=>{let re=ge=>ge.map(Ne=>Ne.id===F?{...Ne,...L}:Ne.subtasks?{...Ne,subtasks:re(Ne.subtasks)}:Ne);return re(V)});},deleteTask:F=>{ue(L=>{let V=re=>re.filter(ge=>ge.id===F?false:(ge.subtasks&&(ge.subtasks=V(ge.subtasks)),true));return V(L)});},deleteTasks:F=>{ue(L=>mi(L,F));},duplicateTask:F=>{ue(L=>pi(L,[F]));},splitTask:(F,L,V=3)=>{ue(re=>fe.splitTask(re,F,L,V));},calculateEndDate:fe.calculateEndDate,calculateDuration:fe.calculateDuration,validateDependency:(F,L)=>!fe.validateDependencies(oe,F,L),getAllTasks:()=>fe.flattenTasks(oe),getTasksByStatus:F=>fe.flattenTasks(oe).filter(L=>L.status===F),getTasksByParent:F=>F?fe.findTaskById(oe,F)?.subtasks||[]:oe.filter(V=>!V.parentId),getCriticalPath:()=>fe.flattenTasks(oe).filter(F=>F.isCriticalPath),indentTask:F=>{ue(L=>li(L,[F]));},outdentTask:F=>{ue(L=>di(L,[F]));},moveTask:(F,L)=>{ue(V=>ci(V,[F],L));},createSubtask:async F=>{let{tasks:L,newTask:V}=fi(oe,F);if(be){let re=be({...V,parentId:F});if((re instanceof Promise?await re:re)===false)return}ue(L),$&&$({...V,parentId:F});},scrollToTask:F=>{let V=fe.flattenTasks(oe).findIndex(re=>re.id===F);if(V!==-1&&Je.current){let re=V*ne;Je.current.scrollTo({top:re,behavior:"smooth"}),va.current&&va.current.scrollTo({top:re,behavior:"smooth"});}},highlightTask:(F,L=2e3)=>{},expandTask:F=>{ue(L=>{let V=re=>re.map(ge=>ge.id===F?{...ge,isExpanded:true}:ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge);return V(L)});},collapseTask:F=>{ue(L=>{let V=re=>re.map(ge=>ge.id===F?{...ge,isExpanded:false}:ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge);return V(L)});},expandAll:()=>{ue(F=>{let L=V=>V.map(re=>({...re,isExpanded:true,subtasks:re.subtasks?L(re.subtasks):void 0}));return L(F)});},collapseAll:()=>{ue(F=>{let L=V=>V.map(re=>({...re,isExpanded:false,subtasks:re.subtasks?L(re.subtasks):void 0}));return L(F)});},undo:pa,redo:ya,canUndo:()=>N,canRedo:()=>ee,clearHistory:se,exportToPNG:async()=>{if(!ua.current||!Je.current||!va.current)throw new Error("Gantt container not found");let F=ua.current,L=Je.current.querySelector(".gantt-grid-scroll"),V=va.current,re=L?.scrollTop||0,ge=V.scrollTop,Ne=F.style.overflow,ft=F.style.height;try{let Qt=L?.querySelector(".gantt-taskgrid-content"),xa=V.querySelector("svg"),ka=Qt?.scrollHeight||L?.scrollHeight||600,Fa=xa?.getBoundingClientRect().height||V.scrollHeight,Rr=(F.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(ka,Fa)+20;L&&(L.scrollTop=0),V.scrollTop=0,F.style.overflow="visible",F.style.height=`${Rr}px`,await new Promise(wr=>setTimeout(wr,100));let kr=await kc__default.default(F,{backgroundColor:E.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:wr=>{let ro=window.getComputedStyle(wr),$r=parseInt(ro.zIndex,10);return !isNaN($r)&&$r>=50||ro.position==="fixed"}});return new Promise((wr,ro)=>{kr.toBlob($r=>{$r?wr($r):ro(new Error("Failed to create blob from canvas"));},"image/png");})}finally{F.style.overflow=Ne,F.style.height=ft,L&&(L.scrollTop=re),V.scrollTop=ge;}},exportToPDF:async F=>{await fe.exportToPDF(oe,F);},exportToExcel:async F=>{await fe.exportToExcel(oe,F);},exportToJSON:()=>fe.exportToJSON(oe),exportToCSV:()=>fe.exportToCSV(oe),importFromJSON:F=>{let L=fe.importFromJSON(F);ue(L);},getTasks:()=>oe,refresh:()=>{ue(F=>[...F]);},clearAll:()=>{ue([]);}}),[oe,pa,ya,N,ee,se,E,ne]);let Re=react.useCallback(F=>{Ue(L=>L.map(V=>V.id===F?{...V,visible:!V.visible}:V));},[]),xt=react.useCallback((F,L)=>{Ue(V=>V.map(re=>{if(re.id!==F)return re;let ge=re.minWidth??100,Ne=re.maxWidth??800,ft=Math.max(ge,Math.min(Ne,L));return {...re,width:ft}}));},[]),Le=react.useCallback(F=>{ue(L=>{let V=gi(L,F),re=ge=>{for(let Ne of ge){if(Ne.id===F){$e.current.set(F,Ne.isExpanded??true);return}Ne.subtasks?.length&&re(Ne.subtasks);}};return re(V),Ge(),V}),a.onTaskToggleExpand?.(F);},[a,Ge]),At=react.useCallback((F,L)=>{if(J&&J(F,L)===false)return;let re=fe.findTaskById(oe,F)?.progress,ge=ft=>ft.map(Qt=>Qt.id===F?{...Qt,...L}:Qt.subtasks?{...Qt,subtasks:ge(Qt.subtasks)}:Qt);ue(ge(oe));let Ne=fe.findTaskById(ge(oe),F);Ne&&(M?.(Ne),U?.(Ne),L.progress!==void 0&&re!==void 0&&L.progress!==re&&D?.(F,re,L.progress));},[oe,M,J,U,D]),st=react.useCallback(F=>{F.length!==0&&(ue(L=>li(L,F)),a.onTaskIndent?.(F[0]));},[a]),ga=react.useCallback(F=>{F.length!==0&&(ue(L=>di(L,F)),a.onTaskOutdent?.(F[0]));},[a]),zt=react.useCallback((F,L,V)=>{ue(re=>oc(re,F,L,V)),a.onTaskReparent?.(F,L,V);},[a]),je=react.useCallback((F,L)=>{F.length!==0&&(ue(V=>ci(V,F,L)),a.onTaskMove?.(F[0],L));},[a]),kt=react.useCallback(async F=>{let L=[];for(let V of F)G&&await Promise.resolve(G(V))===false||L.push(V);L.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(L):(ue(V=>mi(V,L)),L.forEach(V=>a.onTaskDelete?.(V))),A&&L.forEach(V=>A(V)));},[a,G,A]),ia=react.useCallback(F=>{ue(L=>pi(L,F)),F.forEach(L=>a.onTaskDuplicate?.(L));},[a]),vr=react.useCallback((F,L)=>{ue(V=>{let{tasks:re,newTask:ge}=rc(V,F,L);return be&&be(ge)===false?V:(a.onTaskCreate?.(ge.parentId,ge.position||0),$?.(ge),re)});},[a,be,$]),Hm=react.useCallback((F,L)=>{ue(V=>ui(V,F,L)),a.onTaskRename?.(F,L);},[a]),Zn=react.useCallback(F=>{ue(L=>{let{tasks:V}=fi(L,F);return a.onTaskCreate?.(F,0),V});},[a]),Wm=react.useCallback((F,L,V)=>{let re=F.startDate?Math.round((L.getTime()-F.startDate.getTime())/864e5):0,ge=Qt=>Qt.map(xa=>xa.id===F.id?{...xa,startDate:L,endDate:V,...F.segments&&{segments:F.segments}}:xa.subtasks?{...xa,subtasks:ge(xa.subtasks)}:xa),Ne=ge(oe);Ne=fe.autoScheduleDependents(Ne,F.id,re),ue(Ne);let ft={...F,startDate:L,endDate:V};M?.(ft);},[oe,M]),Gm=react.useCallback((F,L)=>{R?.(F,L),Xt({isOpen:true,x:L.clientX,y:L.clientY,task:F});},[R]),_m=react.useCallback((F,L)=>{let V=fe.splitTask(oe,F.id,L);ue(V),Xt({isOpen:false,x:0,y:0,task:null});},[oe]),hl=react.useCallback(F=>{let L=fe.findTaskById(oe,F.id)||F;w?.(L),I||Nt(L);},[oe,w,I]),bl=react.useCallback((F,L,V)=>{let re=new Map,ge=ka=>{ka.forEach(Fa=>{Fa.dependencies&&re.set(Fa.id,Fa.dependencies),Fa.subtasks&&ge(Fa.subtasks);});};ge(V);let Ne=re.get(L)||[];re.set(L,[...Ne,F]);let ft=new Set,Qt=new Set,xa=ka=>{if(!ft.has(ka)){ft.add(ka),Qt.add(ka);let Fa=re.get(ka)||[];for(let xr of Fa){if(!ft.has(xr)&&xa(xr))return true;if(Qt.has(xr))return true}}return Qt.delete(ka),false};return xa(L)},[]),yl=react.useCallback((F,L)=>{if(bl(F.id,L,oe)){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===L){let De=ge.dependencies||[];if(!De.includes(F.id))return {...ge,dependencies:[...De,F.id]}}return ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge});pe(V(oe)),se?.(F.id,L);},[oe,se,bl]),vl=react.useCallback((F,L)=>{let V=re=>re.map(ge=>{if(ge.id===F&&ge.dependencies){let De=ge.dependencies.filter(ht=>ht!==L);return {...ge,dependencies:De}}return ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge});pe(V(oe)),le?.(F,L);},[oe,le]),{startDate:Vm,endDate:jm}=react.useMemo(()=>{let F=oe.filter(De=>De.startDate&&De.endDate);if(F.length===0){let De=new Date,ht=new Date(De);ht.setDate(ht.getDate()-30);let Zt=new Date(De);return Zt.setDate(Zt.getDate()+60),{startDate:ht,endDate:Zt}}let L=F.flatMap(De=>[De.startDate,De.endDate]).filter(De=>De!==void 0),V=new Date(Math.min(...L.map(De=>De.getTime()))),re=new Date(Math.max(...L.map(De=>De.getTime()))),ge=Me==="day"?7:Me==="week"?14:30;return V.setDate(V.getDate()-ge),re.setDate(re.getDate()+ge),{startDate:V,endDate:re}},[oe,Me]),Km=react.useCallback(async()=>{if(!ga.current||!Qe.current||!va.current)return;await new Promise(Rr=>setTimeout(Rr,200));let F=ga.current,L=Qe.current.querySelector(".gantt-grid-scroll"),V=va.current,re=L?.scrollTop||0,ge=L?.scrollLeft||0,De=V.scrollTop,ht=V.scrollLeft,Zt=F.style.overflow,xa=F.style.height,ka=L?.style.overflow||"",Fa=V.style.overflow,xr=F.style.width,Qo=V.style.width;try{let Rr=L?.querySelector(".gantt-taskgrid-content"),kr=V.querySelector("svg"),wr=kr?.getAttribute("height")?parseInt(kr.getAttribute("height"),10):kr?.getBoundingClientRect().height||0,ro=Rr?.scrollHeight||L?.scrollHeight||600,$r=Math.max(wr,V.scrollHeight),xl=kr?.getAttribute("width")?parseInt(kr.getAttribute("width"),10):kr?.getBoundingClientRect().width||V.scrollWidth,ep=F.querySelector('[class*="h-12"]')?.offsetHeight||48,es=Math.max(ro,$r,wr),ts=ep+es+50,as=(L?.offsetWidth||300)+xl+10;L&&(L.scrollTop=0,L.scrollLeft=0),V.scrollTop=0,V.scrollLeft=0,F.style.overflow="visible",F.style.height=`${ts}px`,F.style.width=`${as}px`,L&&(L.style.overflow="visible",L.style.height=`${es+50}px`),V.style.overflow="visible",V.style.height=`${es+50}px`,V.style.width=`${xl+10}px`,await new Promise(os=>setTimeout(os,150));let tp=await kc__default.default(F,{backgroundColor:E.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:as,height:ts,windowWidth:as+100,windowHeight:ts+100,scrollX:0,scrollY:0,ignoreElements:os=>{let kl=window.getComputedStyle(os),wl=parseInt(kl.zIndex,10);return !isNaN(wl)&&wl>=50||kl.position==="fixed"}}),rs=document.createElement("a");rs.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,rs.href=tp.toDataURL("image/png"),rs.click();}finally{F.style.overflow=Zt,F.style.height=xa,F.style.width=xr,L&&(L.style.overflow=ka,L.style.height="",L.scrollTop=re,L.scrollLeft=ge),V.style.overflow=Fa,V.style.height="",V.style.width=Qo,V.scrollTop=De,V.scrollLeft=ht;}},[E]),Ym=react.useCallback(async()=>{await fe.exportToPDF(oe);},[oe]),qm=react.useCallback(async()=>{await fe.exportToExcel(oe);},[oe]),Xm=react.useCallback(()=>{let F=fe.exportToCSV(oe),L=new Blob([F],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(L),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[oe]),Jm=react.useCallback(()=>{let F=fe.exportToJSON(oe),L=new Blob([F],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(L),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[oe]),Qm=react.useCallback(()=>{fe.exportToMSProject(oe,"Gantt Project","project.xml");},[oe]),Zm=F=>{F.preventDefault(),Ue(true);},ao=react.useRef(false);return react.useEffect(()=>{let F=va.current,L=Qe.current?.querySelector(".gantt-grid-scroll");if(!F||!L)return;let V=()=>{if(ao.current)return;ao.current=true;let ht=F.scrollTop;ke(ht),L.scrollTop=ht,requestAnimationFrame(()=>{ao.current=false;});},re=()=>{if(ao.current)return;ao.current=true;let ht=L.scrollTop;ke(ht),F.scrollTop=ht,requestAnimationFrame(()=>{ao.current=false;});},ge=ht=>{if(Pe&&L){let xa=L.parentElement?.getBoundingClientRect()?.left||0,ka=ht.clientX-xa,Fa=200,xr=He+de,Qo=window.innerWidth*Be,Rr=Math.max(xr,Qo);ka>=Fa&&ka<=Rr&&Pt(ka);}},De=()=>{Ue(false);};return F.addEventListener("scroll",V),L.addEventListener("scroll",re),document.addEventListener("mousemove",ge),document.addEventListener("mouseup",De),()=>{F.removeEventListener("scroll",V),L.removeEventListener("scroll",re),document.removeEventListener("mousemove",ge),document.removeEventListener("mouseup",De);}},[Pe,He]),jsxRuntime.jsx(ho.Provider,{value:_,children:jsxRuntime.jsx(ds.Provider,{value:ve,children:jsxRuntime.jsxs("div",{ref:ga,className:"flex flex-col h-full w-full",style:{backgroundColor:E.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(wn,{theme:E,timeScale:Me,onTimeScaleChange:Oe,zoom:We,onZoomChange:tt,currentTheme:H,onThemeChange:Ea,rowDensity:xe,onRowDensityChange:Ye,showThemeSelector:m,showCreateTaskButton:b,createTaskLabel:y,onCreateTask:l,taskFilter:pt,onTaskFilterChange:O,onExportPNG:i?Km:void 0,onExportPDF:i?Ym:void 0,onExportExcel:i?qm:void 0,onExportCSV:i?Xm:void 0,onExportJSON:i?Jm:void 0,onExportMSProject:i?Qm:void 0}),jsxRuntime.jsxs("div",{ref:Qe,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:St,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Dn,{tasks:ot,theme:E,rowHeight:ne,availableUsers:u,templates:X,onTaskClick:k,onTaskDblClick:hl,onTaskContextMenu:R,onTaskToggle:Ie,scrollTop:ie,columns:Ee,onToggleColumn:$e,onColumnResize:kt,onTaskUpdate:Ft,onTaskIndent:it,onTaskOutdent:fa,onTaskMove:Ve,onMultiTaskDelete:wt,onTaskDuplicate:la,onTaskCreate:vr,onTaskRename:Hm,onCreateSubtask:Zn,onOpenTaskModal:k?F=>k(F):void 0,onDeleteRequest:(F,L)=>Qt({taskId:F,taskName:L}),onTaskReparent:Ut})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:E.border,zIndex:15},onMouseDown:Zm}),jsxRuntime.jsx("div",{ref:va,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(In,{tasks:ot,theme:E,rowHeight:ne,timeScale:Me,startDate:Vm,endDate:jm,zoom:We,templates:X,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:k,onTaskDblClick:hl,onTaskContextMenu:Gm,onTaskDateChange:Wm,onDependencyCreate:yl,onDependencyDelete:vl})})]}),Fe.task&&jsxRuntime.jsx(yo,{isOpen:Fe.isOpen,x:Fe.x,y:Fe.y,theme:E,onClose:()=>Jt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let F=Fe.task;if(!F)return [];let L=fe.findTaskById(oe,F.id)||F;return L.subtasks&&L.subtasks.length>0?[{id:"addSubtask",label:_.contextMenu?.addSubtask||"Add Subtask",icon:$t.Add,onClick:()=>{B?B(L):Zn(L.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:_.contextMenu?.deleteTask||"Delete Task",icon:$t.Delete,onClick:()=>{Qt({taskId:L.id,taskName:L.name});}}]:[{id:"edit",label:_.contextMenu?.editTask||"Edit Task",icon:$t.Pencil,onClick:()=>{I?I(L):Dt(L);}},{id:"addSubtask",label:_.contextMenu?.addSubtask||"Add Subtask",icon:$t.Add,onClick:()=>{B?B(L):Zn(L.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:_.contextMenu?.markIncomplete||"Mark Incomplete",icon:$t.MarkIncomplete,onClick:()=>{K?K(L):Ft(L.id,{status:"todo",progress:0});},disabled:L.status==="todo"},{id:"setInProgress",label:_.contextMenu?.setInProgress||"Set In Progress",icon:$t.SetInProgress,onClick:()=>{te?te(L):Ft(L.id,{status:"in-progress"});},disabled:L.status==="in-progress"},{id:"markComplete",label:_.contextMenu?.markComplete||"Mark Complete",icon:$t.MarkComplete,onClick:()=>{Ft(L.id,{status:"completed",progress:100});},disabled:L.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:_.contextMenu?.splitTask||"Split Task",icon:$t.Split,onClick:()=>{if(!L.startDate||!L.endDate){console.warn("Cannot split task without dates");return}let re=L.startDate.getTime(),ge=L.endDate.getTime(),De=re+(ge-re)/2,ht=new Date(De);_m(L,ht);},disabled:!L.startDate||!L.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:_.contextMenu?.deleteTask||"Delete Task",icon:$t.Delete,onClick:()=>{Qt({taskId:L.id,taskName:L.name});}}]})()}),jsxRuntime.jsx(_r,{task:zt,isOpen:!!zt,onClose:()=>Dt(null),onTaskUpdate:F=>{zt&&(Ft(zt.id,F),Dt(null));},theme:H==="light"?"light":"dark",locale:T==="es"?"es":"en",availableUsers:u,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:()=>Qt(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:F=>F.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:E.bgSecondary,border:`1px solid ${E.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${E.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:E.textPrimary,fontFamily:"Inter, sans-serif"},children:[_.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:E.textSecondary,fontFamily:"Inter, sans-serif"},children:T==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:E.textSecondary,fontFamily:"Inter, sans-serif"},children:[T==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:E.textPrimary},children:['"',mt.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:E.bgPrimary,borderTop:`1px solid ${E.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Qt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:E.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=E.hoverBg;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:T==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{wt([mt.taskId]),Qt(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:F=>{F.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),T==="es"?"Eliminar":"Delete"]})]})]})})}),C?.enabled&&jsxRuntime.jsx(Bn,{tasks:oe,theme:E,config:C,onTasksUpdate:pe,onTaskUpdate:Ft,onTaskCreate:F=>{pe(L=>[...L,F]);},onTaskDelete:F=>{wt([F]);},onDependencyCreate:(F,L)=>{let V=fe.findTaskById(oe,F);V&&yl(V,L);},onDependencyDelete:vl})]})})})});var ki=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],wi=[{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 Nc({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:p=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:d,attachments:g=[],onUploadAttachments:h,onDeleteAttachment:C}){let T=[...ki,...i.filter(O=>!ki.some(ie=>ie.id===O.id))],c=qe[m]||qe.dark,[b,y]=react.useState(false),[l,x]=react.useState(false),[v,D]=react.useState(false),[k,w]=react.useState(false),[R,M]=react.useState({top:0,left:0}),[N,I]=react.useState(null),[B,K]=react.useState(new Date),[te,se]=react.useState({top:0,left:0}),[le,ye]=react.useState(false),[$,Q]=react.useState([]),U=react.useRef(null),G=react.useRef(null),A=react.useRef(null),Z=react.useRef(null),J=react.useRef(null),[H,Te]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Me,Oe]=react.useState({});react.useEffect(()=>{a?(Te({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)):(Te({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),ye(false),Q([]));},[a,e]),react.useEffect(()=>{let O=ie=>{U.current&&!U.current.contains(ie.target)&&y(false),G.current&&!G.current.contains(ie.target)&&x(false),A.current&&!A.current.contains(ie.target)&&D(false),Z.current&&!Z.current.contains(ie.target)&&w(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let xe=()=>{let O={};return H.name.trim()||(O.name="El nombre es requerido"),H.startDate&&H.endDate&&H.startDate>H.endDate&&(O.endDate="La fecha de fin debe ser posterior a la de inicio"),Oe(O),Object.keys(O).length===0},Ye=async O=>{if(O.preventDefault(),!!xe())try{let ie=p==="create"&&$.length>0?{...H,pendingFiles:$}:H;await s(ie),Q([]),t();}catch(ie){console.error("Error submitting task:",ie);}},We=(O,ie)=>{Te(ke=>{let Pe={...ke,[O]:ie};if(O==="status"){let Ue=ie;Ue==="todo"?Pe.progress=0:Ue==="in-progress"?(ke.progress===0||ke.progress===100)&&(Pe.progress=50):Ue==="completed"||Ue==="closed"?Pe.progress=100:(Ue==="in-review"||Ue==="review")&&(Pe.progress=75);}if(O==="progress"){let Ue=typeof ie=="number"?ie:parseInt(ie,10);Ue===100&&ke.status!=="completed"?Pe.status="completed":Ue>0&&Ue<100&&ke.status==="todo"?Pe.status="in-progress":Ue===0&&ke.status!=="todo"&&(Pe.status="todo");}return Pe}),Me[O]&&Oe(ke=>{let Pe={...ke};return delete Pe[O],Pe});},tt=T.find(O=>O.id===H.status)??ki[0],xt=wi.find(O=>O.id===H.priority)??wi[1],At=sr.find(O=>O.value===H.color)??sr[0],pt={backgroundColor:c.bgSecondary,border:`1px solid ${c.borderLight}`,color:c.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${c.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:tt.color||c.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:c.textSecondary},children:p==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:c.textTertiary},onMouseEnter:O=>{O.currentTarget.style.backgroundColor=c.hoverBg,O.currentTarget.style.color=c.textPrimary;},onMouseLeave:O=>{O.currentTarget.style.backgroundColor="transparent",O.currentTarget.style.color=c.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Ye,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:H.name,onChange:O=>We("name",O.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:c.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Me.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"}),Me.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:H.description||"",onChange:O=>We("description",O.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:c.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${c.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:U,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&y(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...pt,borderColor:tt.color,backgroundColor:`${tt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:tt.color}}),jsxRuntime.jsx("span",{style:{color:tt.color},children:tt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:tt.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:c.bgPrimary,border:`1px solid ${c.border}`},children:T.map(O=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{We("status",O.id),y(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:O.color}}),O.title,H.status===O.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},O.id))})})]}),jsxRuntime.jsxs("div",{ref:G,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&x(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:pt,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:xt.color}}),jsxRuntime.jsx("span",{children:xt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&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:c.bgPrimary,border:`1px solid ${c.border}`},children:wi.map(O=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{We("priority",O.id),x(false);},children:[jsxRuntime.jsx("span",{children:O.icon}),O.label,H.priority===O.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},O.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:A,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:pt,disabled:n,children:[H.assignees&&H.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:H.assignees.slice(0,3).map((O,ie)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:O.color||c.accent,borderColor:c.bgSecondary},children:O.initials},ie))}),H.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:c.textTertiary},children:["+",H.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:c.textTertiary}}),jsxRuntime.jsx("span",{style:{color:c.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:o.map(O=>{let ie=H.assignees?.some(ke=>ke.name===O.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:ke=>ke.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:ke=>ke.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ke=ie?(H.assignees||[]).filter(Pe=>Pe.name!==O.name):[...H.assignees||[],{name:O.name,avatar:O.avatar,initials:O.name.split(" ").map(Pe=>Pe[0]).join("").toUpperCase().slice(0,2),color:c.accent}];We("assignees",ke);},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:c.accent},children:O.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:O.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:ie&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:c.accent}})})]},O.id)})})})]}),jsxRuntime.jsxs("div",{ref:Z,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(k)w(false);else {if(Z.current){let O=Z.current.getBoundingClientRect(),ie=window.innerHeight,ke=120,Ue=ie-O.bottom<ke?O.top-ke-8:O.bottom+8;M({top:Ue,left:O.left});}w(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:pt,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:H.color}}),jsxRuntime.jsx("span",{children:At.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(dt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>w(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${R.top}px`,left:`${R.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:O=>O.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:sr.slice(0,18).map(O=>{let ie=H.color===O.value;return jsxRuntime.jsx("button",{type:"button",onClick:ke=>{ke.preventDefault(),ke.stopPropagation(),We("color",O.value),w(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:O.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:O.value,outline:ie?`2px solid ${O.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},O.value)})})})})]})})]}),u.length>0||d?jsxRuntime.jsx(nr,{selectedTags:H.tags||[],availableTags:u,onChange:O=>We("tags",O),onCreateTag:d,theme:c,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:c.textTertiary}}),jsxRuntime.jsxs("div",{ref:J,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!H.isMilestone)if(N==="start")I(null);else {if(J.current){let O=J.current.getBoundingClientRect(),ie=window.innerHeight,ke=320,Ue=ie-O.bottom<ke?O.top-ke-8:O.bottom+8;se({top:Ue,left:O.left});}I("start"),K(H.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...pt,opacity:H.isMilestone?.5:1,cursor:H.isMilestone?"not-allowed":"pointer"},disabled:n||H.isMilestone,children:H.startDate?H.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:c.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!H.isMilestone)if(N==="end")I(null);else {if(J.current){let O=J.current.getBoundingClientRect(),ie=window.innerHeight,ke=320,Ue=ie-O.bottom<ke?O.top-ke-8:O.bottom+8;se({top:Ue,left:O.left});}I("end"),K(H.endDate||H.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...pt,opacity:H.isMilestone?.5:1,cursor:H.isMilestone?"not-allowed":"pointer"},disabled:n||H.isMilestone,children:H.endDate?H.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(dt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>I(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${te.top}px`,left:`${te.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${c.border}`},children:[(()=>{let O=new Date,ie=new Date(O);ie.setDate(O.getDate()+1);let ke=new Date(O);ke.setDate(O.getDate()+7);let Pe=new Date(O);return Pe.setDate(O.getDate()+14),[{label:"Hoy",date:O},{label:"Ma\xF1ana",date:ie},{label:"Pr\xF3xima semana",date:ke},{label:"2 semanas",date:Pe}].map((rt,Pt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:c.textPrimary},onMouseEnter:Fe=>Fe.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:Fe=>Fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{N==="start"?(We("startDate",rt.date),(!H.endDate||rt.date>H.endDate)&&We("endDate",rt.date),I("end")):(We("endDate",rt.date),(!H.startDate||rt.date<H.startDate)&&We("startDate",rt.date),I(null));},children:rt.label},Pt))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${c.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:O=>O.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",onClick:()=>{We("startDate",void 0),We("endDate",void 0),I(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(B.getFullYear(),B.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:c.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:c.textPrimary},children:B.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>K(new Date(B.getFullYear(),B.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:c.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((O,ie)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:c.textTertiary},children:O},ie))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=B.getFullYear(),ie=B.getMonth(),ke=new Date(O,ie,1).getDay(),Pe=new Date(O,ie+1,0).getDate(),Ue=new Date,rt=[];for(let Fe=ke-1;Fe>=0;Fe--)rt.push({day:new Date(O,ie,-Fe).getDate(),date:new Date(O,ie-1,new Date(O,ie,-Fe).getDate()),isCurrentMonth:false});for(let Fe=1;Fe<=Pe;Fe++)rt.push({day:Fe,date:new Date(O,ie,Fe),isCurrentMonth:true});let Pt=42-rt.length;for(let Fe=1;Fe<=Pt;Fe++)rt.push({day:Fe,date:new Date(O,ie+1,Fe),isCurrentMonth:false});return rt.map((Fe,Jt)=>{let zt=Fe.date.toDateString()===Ue.toDateString(),Dt=H.startDate?.toDateString()===Fe.date.toDateString(),mt=H.endDate?.toDateString()===Fe.date.toDateString(),Qt=H.startDate&&H.endDate&&Fe.date>=H.startDate&&Fe.date<=H.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:Fe.isCurrentMonth?Dt||mt?"#FFF":c.textPrimary:c.textTertiary,backgroundColor:Dt?"#3B82F6":mt?"#7C3AED":Qt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:zt&&!Dt&&!mt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{N==="start"?(We("startDate",Fe.date),H.endDate&&Fe.date>H.endDate&&We("endDate",Fe.date),I("end")):(We("endDate",Fe.date),H.startDate&&Fe.date<H.startDate&&We("startDate",Fe.date),I(null));},children:Fe.day},Jt)})})()})]})]})]})})]}),Me.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Me.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:c.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:H.progress,onChange:O=>We("progress",parseInt(O.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:c.bgSecondary,accentColor:H.progress<30?"#EF4444":H.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:`${H.progress<30?"#EF4444":H.progress<70?"#F59E0B":"#10B981"}20`,color:H.progress<30?"#EF4444":H.progress<70?"#F59E0B":"#10B981"},children:[H.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>ye(!le),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:c.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${le?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:le&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[(h||g.length>0||p==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:c.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:c.textTertiary},children:["Adjuntos ",p==="create"?$.length>0&&`(${$.length})`:g.length>0&&`(${g.length})`]})]}),p==="create"?jsxRuntime.jsx(dr,{cardId:"pending",attachments:$.map((O,ie)=>({id:`pending-${ie}`,cardId:"pending",name:O.name,size:O.size,type:O.type,url:URL.createObjectURL(O),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:O=>Q(ie=>[...ie,...O]),onDelete:O=>{let ie=parseInt(O.replace("pending-",""),10);Q(ke=>ke.filter((Pe,Ue)=>Ue!==ie));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(dr,{cardId:a?.id||"new",attachments:g,onUpload:h&&a?.id?O=>h(a.id,O):void 0,onDelete:C,maxSizeMB:10,maxFiles:20}),p==="create"&&$.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:c.textTertiary},children:[$.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:H.isMilestone,onChange:O=>We("isMilestone",O.target.checked),className:"w-4 h-4 rounded",style:{accentColor:c.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:c.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:c.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:c.bgSecondary},children:r.filter(O=>O.id!==a?.id).map(O=>{let ie=H.dependencies?.includes(O.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ke=ie?(H.dependencies||[]).filter(Pe=>Pe!==O.id):[...H.dependencies||[],O.id];We("dependencies",ke);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:ie?`${c.accent}30`:c.bgPrimary,color:ie?c.accent:c.textSecondary,border:`1px solid ${ie?c.accent:c.borderLight}`},disabled:n,children:O.name},O.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${c.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:c.textSecondary},onMouseEnter:O=>O.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:c.accent,color:"#FFF"},onMouseEnter:O=>!n&&(O.currentTarget.style.opacity="0.9"),onMouseLeave:O=>!n&&(O.currentTarget.style.opacity="1"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:p==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Dc=`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=re=>re.map(ge=>{if(ge.id===L){let Ne=ge.dependencies||[];if(!Ne.includes(F.id))return {...ge,dependencies:[...Ne,F.id]}}return ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge});ue(V(oe)),ie?.(F.id,L);},[oe,ie,bl]),vl=react.useCallback((F,L)=>{let V=re=>re.map(ge=>{if(ge.id===F&&ge.dependencies){let Ne=ge.dependencies.filter(ft=>ft!==L);return {...ge,dependencies:Ne}}return ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge});ue(V(oe)),de?.(F,L);},[oe,de]),{startDate:Vm,endDate:jm}=react.useMemo(()=>{let F=oe.filter(Ne=>Ne.startDate&&Ne.endDate);if(F.length===0){let Ne=new Date,ft=new Date(Ne);ft.setDate(ft.getDate()-30);let Qt=new Date(Ne);return Qt.setDate(Qt.getDate()+60),{startDate:ft,endDate:Qt}}let L=F.flatMap(Ne=>[Ne.startDate,Ne.endDate]).filter(Ne=>Ne!==void 0),V=new Date(Math.min(...L.map(Ne=>Ne.getTime()))),re=new Date(Math.max(...L.map(Ne=>Ne.getTime()))),ge=Me==="day"?7:Me==="week"?14:30;return V.setDate(V.getDate()-ge),re.setDate(re.getDate()+ge),{startDate:V,endDate:re}},[oe,Me]),Km=react.useCallback(async()=>{if(!ua.current||!Je.current||!va.current)return;await new Promise(Rr=>setTimeout(Rr,200));let F=ua.current,L=Je.current.querySelector(".gantt-grid-scroll"),V=va.current,re=L?.scrollTop||0,ge=L?.scrollLeft||0,Ne=V.scrollTop,ft=V.scrollLeft,Qt=F.style.overflow,xa=F.style.height,ka=L?.style.overflow||"",Fa=V.style.overflow,xr=F.style.width,Qo=V.style.width;try{let Rr=L?.querySelector(".gantt-taskgrid-content"),kr=V.querySelector("svg"),wr=kr?.getAttribute("height")?parseInt(kr.getAttribute("height"),10):kr?.getBoundingClientRect().height||0,ro=Rr?.scrollHeight||L?.scrollHeight||600,$r=Math.max(wr,V.scrollHeight),xl=kr?.getAttribute("width")?parseInt(kr.getAttribute("width"),10):kr?.getBoundingClientRect().width||V.scrollWidth,ep=F.querySelector('[class*="h-12"]')?.offsetHeight||48,es=Math.max(ro,$r,wr),ts=ep+es+50,as=(L?.offsetWidth||300)+xl+10;L&&(L.scrollTop=0,L.scrollLeft=0),V.scrollTop=0,V.scrollLeft=0,F.style.overflow="visible",F.style.height=`${ts}px`,F.style.width=`${as}px`,L&&(L.style.overflow="visible",L.style.height=`${es+50}px`),V.style.overflow="visible",V.style.height=`${es+50}px`,V.style.width=`${xl+10}px`,await new Promise(os=>setTimeout(os,150));let tp=await kc__default.default(F,{backgroundColor:E.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:as,height:ts,windowWidth:as+100,windowHeight:ts+100,scrollX:0,scrollY:0,ignoreElements:os=>{let kl=window.getComputedStyle(os),wl=parseInt(kl.zIndex,10);return !isNaN(wl)&&wl>=50||kl.position==="fixed"}}),rs=document.createElement("a");rs.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,rs.href=tp.toDataURL("image/png"),rs.click();}finally{F.style.overflow=Qt,F.style.height=xa,F.style.width=xr,L&&(L.style.overflow=ka,L.style.height="",L.scrollTop=re,L.scrollLeft=ge),V.style.overflow=Fa,V.style.height="",V.style.width=Qo,V.scrollTop=Ne,V.scrollLeft=ft;}},[E]),Ym=react.useCallback(async()=>{await fe.exportToPDF(oe);},[oe]),qm=react.useCallback(async()=>{await fe.exportToExcel(oe);},[oe]),Xm=react.useCallback(()=>{let F=fe.exportToCSV(oe),L=new Blob([F],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(L),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[oe]),Jm=react.useCallback(()=>{let F=fe.exportToJSON(oe),L=new Blob([F],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(L),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[oe]),Qm=react.useCallback(()=>{fe.exportToMSProject(oe,"Gantt Project","project.xml");},[oe]),Zm=F=>{F.preventDefault(),ze(true);},ao=react.useRef(false);return react.useEffect(()=>{let F=va.current,L=Je.current?.querySelector(".gantt-grid-scroll");if(!F||!L)return;let V=()=>{if(ao.current)return;ao.current=true;let ft=F.scrollTop;xe(ft),L.scrollTop=ft,requestAnimationFrame(()=>{ao.current=false;});},re=()=>{if(ao.current)return;ao.current=true;let ft=L.scrollTop;xe(ft),F.scrollTop=ft,requestAnimationFrame(()=>{ao.current=false;});},ge=ft=>{if(Pe&&L){let xa=L.parentElement?.getBoundingClientRect()?.left||0,ka=ft.clientX-xa,Fa=200,xr=He+ce,Qo=window.innerWidth*Ie,Rr=Math.max(xr,Qo);ka>=Fa&&ka<=Rr&&Et(ka);}},Ne=()=>{ze(false);};return F.addEventListener("scroll",V),L.addEventListener("scroll",re),document.addEventListener("mousemove",ge),document.addEventListener("mouseup",Ne),()=>{F.removeEventListener("scroll",V),L.removeEventListener("scroll",re),document.removeEventListener("mousemove",ge),document.removeEventListener("mouseup",Ne);}},[Pe,He]),jsxRuntime.jsx(ho.Provider,{value:_,children:jsxRuntime.jsx(ds.Provider,{value:ve,children:jsxRuntime.jsxs("div",{ref:ua,className:"flex flex-col h-full w-full",style:{backgroundColor:E.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(wn,{theme:E,timeScale:Me,onTimeScaleChange:Oe,zoom:We,onZoomChange:et,currentTheme:H,onThemeChange:Ea,rowDensity:ye,onRowDensityChange:Ye,showThemeSelector:m,showCreateTaskButton:b,createTaskLabel:y,onCreateTask:l,taskFilter:mt,onTaskFilterChange:O,onExportPNG:i?Km:void 0,onExportPDF:i?Ym:void 0,onExportExcel:i?qm:void 0,onExportCSV:i?Xm:void 0,onExportJSON:i?Jm:void 0,onExportMSProject:i?Qm:void 0}),jsxRuntime.jsxs("div",{ref:Je,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:Dt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Dn,{tasks:ot,theme:E,rowHeight:ne,availableUsers:u,templates:q,onTaskClick:k,onTaskDblClick:hl,onTaskContextMenu:R,onTaskToggle:Le,scrollTop:le,columns:Ee,onToggleColumn:Re,onColumnResize:xt,onTaskUpdate:At,onTaskIndent:st,onTaskOutdent:ga,onTaskMove:je,onMultiTaskDelete:kt,onTaskDuplicate:ia,onTaskCreate:vr,onTaskRename:Hm,onCreateSubtask:Zn,onOpenTaskModal:k?F=>k(F):void 0,onDeleteRequest:(F,L)=>Jt({taskId:F,taskName:L}),onTaskReparent:zt})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:E.border,zIndex:15},onMouseDown:Zm}),jsxRuntime.jsx("div",{ref:va,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(In,{tasks:ot,theme:E,rowHeight:ne,timeScale:Me,startDate:Vm,endDate:jm,zoom:We,templates:q,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:k,onTaskDblClick:hl,onTaskContextMenu:Gm,onTaskDateChange:Wm,onDependencyCreate:yl,onDependencyDelete:vl})})]}),Fe.task&&jsxRuntime.jsx(yo,{isOpen:Fe.isOpen,x:Fe.x,y:Fe.y,theme:E,onClose:()=>Xt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let F=Fe.task;if(!F)return [];let L=fe.findTaskById(oe,F.id)||F;return L.subtasks&&L.subtasks.length>0?[{id:"addSubtask",label:_.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{B?B(L):Zn(L.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:_.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{Jt({taskId:L.id,taskName:L.name});}}]:[{id:"edit",label:_.contextMenu?.editTask||"Edit Task",icon:Rt.Pencil,onClick:()=>{I?I(L):Nt(L);}},{id:"addSubtask",label:_.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{B?B(L):Zn(L.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:_.contextMenu?.markIncomplete||"Mark Incomplete",icon:Rt.MarkIncomplete,onClick:()=>{K?K(L):At(L.id,{status:"todo",progress:0});},disabled:L.status==="todo"},{id:"setInProgress",label:_.contextMenu?.setInProgress||"Set In Progress",icon:Rt.SetInProgress,onClick:()=>{te?te(L):At(L.id,{status:"in-progress"});},disabled:L.status==="in-progress"},{id:"markComplete",label:_.contextMenu?.markComplete||"Mark Complete",icon:Rt.MarkComplete,onClick:()=>{At(L.id,{status:"completed",progress:100});},disabled:L.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:_.contextMenu?.splitTask||"Split Task",icon:Rt.Split,onClick:()=>{if(!L.startDate||!L.endDate){console.warn("Cannot split task without dates");return}let re=L.startDate.getTime(),ge=L.endDate.getTime(),Ne=re+(ge-re)/2,ft=new Date(Ne);_m(L,ft);},disabled:!L.startDate||!L.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:_.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{Jt({taskId:L.id,taskName:L.name});}}]})()}),jsxRuntime.jsx(_r,{task:Ot,isOpen:!!Ot,onClose:()=>Nt(null),onTaskUpdate:F=>{Ot&&(At(Ot.id,F),Nt(null));},theme:H==="light"?"light":"dark",locale:T==="es"?"es":"en",availableUsers:u,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ct&&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:()=>Jt(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:F=>F.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:E.bgSecondary,border:`1px solid ${E.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${E.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:E.textPrimary,fontFamily:"Inter, sans-serif"},children:[_.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:E.textSecondary,fontFamily:"Inter, sans-serif"},children:T==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:E.textSecondary,fontFamily:"Inter, sans-serif"},children:[T==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:E.textPrimary},children:['"',ct.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:E.bgPrimary,borderTop:`1px solid ${E.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Jt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:E.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=E.hoverBg;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:T==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{kt([ct.taskId]),Jt(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:F=>{F.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),T==="es"?"Eliminar":"Delete"]})]})]})})}),C?.enabled&&jsxRuntime.jsx(Bn,{tasks:oe,theme:E,config:C,onTasksUpdate:ue,onTaskUpdate:At,onTaskCreate:F=>{ue(L=>[...L,F]);},onTaskDelete:F=>{kt([F]);},onDependencyCreate:(F,L)=>{let V=fe.findTaskById(oe,F);V&&yl(V,L);},onDependencyDelete:vl})]})})})});var ki=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],wi=[{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 Nc({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:p=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:d,attachments:g=[],onUploadAttachments:h,onDeleteAttachment:C}){let T=[...ki,...i.filter(O=>!ki.some(le=>le.id===O.id))],c=qe[m]||qe.dark,[b,y]=react.useState(false),[l,x]=react.useState(false),[v,S]=react.useState(false),[k,w]=react.useState(false),[R,M]=react.useState({top:0,left:0}),[D,I]=react.useState(null),[B,K]=react.useState(new Date),[te,ie]=react.useState({top:0,left:0}),[de,be]=react.useState(false),[$,J]=react.useState([]),U=react.useRef(null),G=react.useRef(null),A=react.useRef(null),Q=react.useRef(null),X=react.useRef(null),[H,Ce]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Me,Oe]=react.useState({});react.useEffect(()=>{a?(Ce({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&be(true)):(Ce({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),be(false),J([]));},[a,e]),react.useEffect(()=>{let O=le=>{U.current&&!U.current.contains(le.target)&&y(false),G.current&&!G.current.contains(le.target)&&x(false),A.current&&!A.current.contains(le.target)&&S(false),Q.current&&!Q.current.contains(le.target)&&w(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let ye=()=>{let O={};return H.name.trim()||(O.name="El nombre es requerido"),H.startDate&&H.endDate&&H.startDate>H.endDate&&(O.endDate="La fecha de fin debe ser posterior a la de inicio"),Oe(O),Object.keys(O).length===0},Ye=async O=>{if(O.preventDefault(),!!ye())try{let le=p==="create"&&$.length>0?{...H,pendingFiles:$}:H;await s(le),J([]),t();}catch(le){console.error("Error submitting task:",le);}},We=(O,le)=>{Ce(xe=>{let Pe={...xe,[O]:le};if(O==="status"){let ze=le;ze==="todo"?Pe.progress=0:ze==="in-progress"?(xe.progress===0||xe.progress===100)&&(Pe.progress=50):ze==="completed"||ze==="closed"?Pe.progress=100:(ze==="in-review"||ze==="review")&&(Pe.progress=75);}if(O==="progress"){let ze=typeof le=="number"?le:parseInt(le,10);ze===100&&xe.status!=="completed"?Pe.status="completed":ze>0&&ze<100&&xe.status==="todo"?Pe.status="in-progress":ze===0&&xe.status!=="todo"&&(Pe.status="todo");}return Pe}),Me[O]&&Oe(xe=>{let Pe={...xe};return delete Pe[O],Pe});},et=T.find(O=>O.id===H.status)??ki[0],vt=wi.find(O=>O.id===H.priority)??wi[1],Mt=sr.find(O=>O.value===H.color)??sr[0],mt={backgroundColor:c.bgSecondary,border:`1px solid ${c.borderLight}`,color:c.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${c.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:et.color||c.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:c.textSecondary},children:p==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:c.textTertiary},onMouseEnter:O=>{O.currentTarget.style.backgroundColor=c.hoverBg,O.currentTarget.style.color=c.textPrimary;},onMouseLeave:O=>{O.currentTarget.style.backgroundColor="transparent",O.currentTarget.style.color=c.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Ye,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:H.name,onChange:O=>We("name",O.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:c.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Me.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"}),Me.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:H.description||"",onChange:O=>We("description",O.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:c.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${c.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:U,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&y(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...mt,borderColor:et.color,backgroundColor:`${et.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:et.color}}),jsxRuntime.jsx("span",{style:{color:et.color},children:et.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:et.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children: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:c.bgPrimary,border:`1px solid ${c.border}`},children:T.map(O=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:le=>le.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{We("status",O.id),y(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:O.color}}),O.title,H.status===O.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},O.id))})})]}),jsxRuntime.jsxs("div",{ref:G,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&x(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:mt,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:vt.color}}),jsxRuntime.jsx("span",{children:vt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&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:c.bgPrimary,border:`1px solid ${c.border}`},children:wi.map(O=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:le=>le.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{We("priority",O.id),x(false);},children:[jsxRuntime.jsx("span",{children:O.icon}),O.label,H.priority===O.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},O.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:A,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&S(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:mt,disabled:n,children:[H.assignees&&H.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:H.assignees.slice(0,3).map((O,le)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:O.color||c.accent,borderColor:c.bgSecondary},children:O.initials},le))}),H.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:c.textTertiary},children:["+",H.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:c.textTertiary}}),jsxRuntime.jsx("span",{style:{color:c.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:o.map(O=>{let le=H.assignees?.some(xe=>xe.name===O.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:xe=>xe.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:xe=>xe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let xe=le?(H.assignees||[]).filter(Pe=>Pe.name!==O.name):[...H.assignees||[],{name:O.name,avatar:O.avatar,initials:O.name.split(" ").map(Pe=>Pe[0]).join("").toUpperCase().slice(0,2),color:c.accent}];We("assignees",xe);},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:c.accent},children:O.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:O.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:le&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:c.accent}})})]},O.id)})})})]}),jsxRuntime.jsxs("div",{ref:Q,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(k)w(false);else {if(Q.current){let O=Q.current.getBoundingClientRect(),le=window.innerHeight,xe=120,ze=le-O.bottom<xe?O.top-xe-8:O.bottom+8;M({top:ze,left:O.left});}w(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:mt,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:H.color}}),jsxRuntime.jsx("span",{children:Mt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>w(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${R.top}px`,left:`${R.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:O=>O.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:sr.slice(0,18).map(O=>{let le=H.color===O.value;return jsxRuntime.jsx("button",{type:"button",onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),We("color",O.value),w(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:O.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:O.value,outline:le?`2px solid ${O.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},O.value)})})})})]})})]}),u.length>0||d?jsxRuntime.jsx(nr,{selectedTags:H.tags||[],availableTags:u,onChange:O=>We("tags",O),onCreateTag:d,theme:c,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:c.textTertiary}}),jsxRuntime.jsxs("div",{ref:X,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!H.isMilestone)if(D==="start")I(null);else {if(X.current){let O=X.current.getBoundingClientRect(),le=window.innerHeight,xe=320,ze=le-O.bottom<xe?O.top-xe-8:O.bottom+8;ie({top:ze,left:O.left});}I("start"),K(H.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...mt,opacity:H.isMilestone?.5:1,cursor:H.isMilestone?"not-allowed":"pointer"},disabled:n||H.isMilestone,children:H.startDate?H.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:c.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!H.isMilestone)if(D==="end")I(null);else {if(X.current){let O=X.current.getBoundingClientRect(),le=window.innerHeight,xe=320,ze=le-O.bottom<xe?O.top-xe-8:O.bottom+8;ie({top:ze,left:O.left});}I("end"),K(H.endDate||H.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...mt,opacity:H.isMilestone?.5:1,cursor:H.isMilestone?"not-allowed":"pointer"},disabled:n||H.isMilestone,children:H.endDate?H.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>I(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${te.top}px`,left:`${te.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${c.border}`},children:[(()=>{let O=new Date,le=new Date(O);le.setDate(O.getDate()+1);let xe=new Date(O);xe.setDate(O.getDate()+7);let Pe=new Date(O);return Pe.setDate(O.getDate()+14),[{label:"Hoy",date:O},{label:"Ma\xF1ana",date:le},{label:"Pr\xF3xima semana",date:xe},{label:"2 semanas",date:Pe}].map((at,Et)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:c.textPrimary},onMouseEnter:Fe=>Fe.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:Fe=>Fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{D==="start"?(We("startDate",at.date),(!H.endDate||at.date>H.endDate)&&We("endDate",at.date),I("end")):(We("endDate",at.date),(!H.startDate||at.date<H.startDate)&&We("startDate",at.date),I(null));},children:at.label},Et))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${c.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:O=>O.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",onClick:()=>{We("startDate",void 0),We("endDate",void 0),I(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(B.getFullYear(),B.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:c.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:c.textPrimary},children:B.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>K(new Date(B.getFullYear(),B.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:c.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((O,le)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:c.textTertiary},children:O},le))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=B.getFullYear(),le=B.getMonth(),xe=new Date(O,le,1).getDay(),Pe=new Date(O,le+1,0).getDate(),ze=new Date,at=[];for(let Fe=xe-1;Fe>=0;Fe--)at.push({day:new Date(O,le,-Fe).getDate(),date:new Date(O,le-1,new Date(O,le,-Fe).getDate()),isCurrentMonth:false});for(let Fe=1;Fe<=Pe;Fe++)at.push({day:Fe,date:new Date(O,le,Fe),isCurrentMonth:true});let Et=42-at.length;for(let Fe=1;Fe<=Et;Fe++)at.push({day:Fe,date:new Date(O,le+1,Fe),isCurrentMonth:false});return at.map((Fe,Xt)=>{let Ot=Fe.date.toDateString()===ze.toDateString(),Nt=H.startDate?.toDateString()===Fe.date.toDateString(),ct=H.endDate?.toDateString()===Fe.date.toDateString(),Jt=H.startDate&&H.endDate&&Fe.date>=H.startDate&&Fe.date<=H.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:Fe.isCurrentMonth?Nt||ct?"#FFF":c.textPrimary:c.textTertiary,backgroundColor:Nt?"#3B82F6":ct?"#7C3AED":Jt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ot&&!Nt&&!ct?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{D==="start"?(We("startDate",Fe.date),H.endDate&&Fe.date>H.endDate&&We("endDate",Fe.date),I("end")):(We("endDate",Fe.date),H.startDate&&Fe.date<H.startDate&&We("startDate",Fe.date),I(null));},children:Fe.day},Xt)})})()})]})]})]})})]}),Me.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Me.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:c.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:H.progress,onChange:O=>We("progress",parseInt(O.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:c.bgSecondary,accentColor:H.progress<30?"#EF4444":H.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:`${H.progress<30?"#EF4444":H.progress<70?"#F59E0B":"#10B981"}20`,color:H.progress<30?"#EF4444":H.progress<70?"#F59E0B":"#10B981"},children:[H.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>be(!de),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:c.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${de?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:de&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[(h||g.length>0||p==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:c.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:c.textTertiary},children:["Adjuntos ",p==="create"?$.length>0&&`(${$.length})`:g.length>0&&`(${g.length})`]})]}),p==="create"?jsxRuntime.jsx(dr,{cardId:"pending",attachments:$.map((O,le)=>({id:`pending-${le}`,cardId:"pending",name:O.name,size:O.size,type:O.type,url:URL.createObjectURL(O),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:O=>J(le=>[...le,...O]),onDelete:O=>{let le=parseInt(O.replace("pending-",""),10);J(xe=>xe.filter((Pe,ze)=>ze!==le));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(dr,{cardId:a?.id||"new",attachments:g,onUpload:h&&a?.id?O=>h(a.id,O):void 0,onDelete:C,maxSizeMB:10,maxFiles:20}),p==="create"&&$.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:c.textTertiary},children:[$.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:H.isMilestone,onChange:O=>We("isMilestone",O.target.checked),className:"w-4 h-4 rounded",style:{accentColor:c.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:c.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:c.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:c.bgSecondary},children:r.filter(O=>O.id!==a?.id).map(O=>{let le=H.dependencies?.includes(O.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let xe=le?(H.dependencies||[]).filter(Pe=>Pe!==O.id):[...H.dependencies||[],O.id];We("dependencies",xe);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:le?`${c.accent}30`:c.bgPrimary,color:le?c.accent:c.textSecondary,border:`1px solid ${le?c.accent:c.borderLight}`},disabled:n,children:O.name},O.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${c.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:c.textSecondary},onMouseEnter:O=>O.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:c.accent,color:"#FFF"},onMouseEnter:O=>!n&&(O.currentTarget.style.opacity="0.9"),onMouseLeave:O=>!n&&(O.currentTarget.style.opacity="1"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:p==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Dc=`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 Sc(e){return
386
386
  ${Ec(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 Ec(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function yr(e,t){let a=Ec(e),r=t.toLowerCase().trim(),o=a.find(p=>p.name.toLowerCase()===r);if(o)return o;let s=a.find(p=>p.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(p=>{let m=p.name.toLowerCase();return n.every(i=>m.includes(i))})}function Ci(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let g=new Date(r);return g.setDate(g.getDate()+1),g}if(a==="yesterday"||a==="ayer"){let g=new Date(r);return g.setDate(g.getDate()-1),g}if(a==="next week"||a==="la pr\xF3xima semana"){let g=new Date(r);return g.setDate(g.getDate()+7),g}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let h={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(h!==void 0){let C=new Date(r),T=C.getDay(),c=h-T;return c<=0&&(c+=7),C.setDate(C.getDate()+c),C}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let g=parseInt(s[1],10),h=s[2].toLowerCase(),C=new Date(r);return h==="day"||h==="d\xEDa"||h==="dias"?C.setDate(C.getDate()+g):h==="week"||h==="semana"||h==="semanas"?C.setDate(C.getDate()+g*7):(h==="month"||h==="mes"||h==="meses")&&C.setMonth(C.getMonth()+g),C}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let p=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(p&&p[1]&&p[2]&&p[3]){let g=parseInt(p[1],10),h=parseInt(p[2],10)-1,C=parseInt(p[3],10);return new Date(C,h,g)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let g=parseInt(i[1],10),h=m[i[2].toLowerCase()],C=i[3]?parseInt(i[3],10):r.getFullYear();if(h!==void 0)return new Date(C,h,g)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let g=u[d[1].toLowerCase()],h=parseInt(d[2],10),C=d[3]?parseInt(d[3],10):r.getFullYear();if(g!==void 0)return new Date(C,g,h)}return null}function Ti(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 Ni(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 Pc(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 Mc(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),u=r[2].trim(),d=yr(t,i),g=Ci(u);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!g)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let h=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,C=new Date(g);return C.setDate(C.getDate()+h),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:g,endDate:C},message:`Moved "${d.name}" to ${g.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),u=o[2].trim(),d=yr(t,i),g=Ti(u);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!g||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let h=new Date(d.endDate);return h.setDate(h.getDate()+g),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:h},message:`Extended "${d.name}" by ${g} days. New end date: ${h.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),u=s[2].trim(),d=yr(t,i),g=Ni(u);return d?g===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:g},message:`Set "${d.name}" progress to ${g}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),u=n[2].trim(),d=yr(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:u},message:`Renamed "${d.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let p=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]&&p[2]){let i=p[1].trim(),u=p[2].trim(),d=yr(t,i),g=yr(t,u);return d?g?{type:"link_tasks",taskId:g.id,taskName:g.name,dependencyFrom:d.id,dependencyTo:g.id,message:`Linked "${d.name}" \u2192 "${g.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let i=m[1].trim(),u=yr(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Ac(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 $0(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 O0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function $n(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let d=a.find(g=>g.id===u);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>$n(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let n=u=>{if(u)return typeof u=="string"?new Date(u):u},p=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||p&&m&&Math.abs(m.getTime()-p.getTime())<=864e5;return {id:e.id,name:e.title,startDate:p,endDate:m,progress:e.progress||0,status:$0(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 Fc(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:O0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Lc(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>$n(r,e,t))}var Di={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"}},Si={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"}},On={en:Di,es:Si};function Ei(e){return On[e]||On.en}function zn(e,t){let a=Ei(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}function $c(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(...$c(r.subtasks,t+1));return a}function q0({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 Oc({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n}){let{theme:p="dark",locale:m="en",customTranslations:i,showSearch:u=true,showHierarchy:d=true}=t,g=zn(m,i),h=p==="dark",[C,T]=react.useState(new Set),[c,b]=react.useState("startDate"),[y,l]=react.useState("asc"),[x,v]=react.useState("");react.useMemo(()=>{let M=new Set;function N(I){for(let B of I)B.subtasks?.length&&(M.add(B.id),N(B.subtasks));}N(e),T(M);},[e]);let D=react.useCallback(M=>{T(N=>{let I=new Set(N);return I.has(M)?I.delete(M):I.add(M),I}),a.onTaskToggleExpand?.(M);},[a]),k=react.useCallback(M=>{c===M?l(N=>N==="asc"?"desc":"asc"):(b(M),l("asc")),a.onSortChange?.({column:M,direction:y==="asc"?"desc":"asc"});},[c,y,a]),w=react.useMemo(()=>{let M=$c(e);if(x.trim()){let I=x.toLowerCase();M=M.filter(B=>B.name.toLowerCase().includes(I));}let N=[];for(let I of M){let B=I.level===0;I.level>0&&(B=true),(B||x.trim())&&N.push(I);}return x.trim()&&N.sort((I,B)=>{let K,te;switch(c){case "name":K=I.name.toLowerCase(),te=B.name.toLowerCase();break;case "startDate":K=I.startDate?.getTime()||0,te=B.startDate?.getTime()||0;break;case "endDate":K=I.endDate?.getTime()||0,te=B.endDate?.getTime()||0;break;case "progress":K=I.progress||0,te=B.progress||0;break;case "status":K=I.status||"todo",te=B.status||"todo";break;default:return 0}return K<te?y==="asc"?-1:1:K>te?y==="asc"?1:-1:0}),N},[e,x,c,y]),R=M=>M?(M instanceof Date?M:new Date(M)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[g.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:g.empty.noTasks}),jsxRuntime.jsx("p",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-hidden",h?"bg-[#0F1117]":"bg-white",s),style:n,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",h?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[u&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:f("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:x,onChange:M=>v(M.target.value),placeholder:g.toolbar.searchPlaceholder,className:f("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",h?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsxs("div",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[w.length," ",g.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:f("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",h?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>k("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>k("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>k("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>k("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>k("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w.map((M,N)=>{let I=C.has(M.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:N*.02},className:f("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",h?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+M.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(M),onDoubleClick:()=>a.onTaskDoubleClick?.(M),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&M.hasChildren&&jsxRuntime.jsx("button",{onClick:B=>{B.stopPropagation(),D(M.id);},className:f("p-0.5 rounded",h?"hover:bg-white/10":"hover:bg-gray-200"),children:I?jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")})}),d&&!M.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:B=>{B.stopPropagation(),a.onTaskUpdate?.({...M,progress:M.progress===100?0:100,status:M.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(q0,{status:M.status,progress:M.progress})}),jsxRuntime.jsx("span",{className:f("truncate",h?"text-white":"text-gray-900",M.progress===100&&(h?"line-through text-[#6B7280]":"line-through text-gray-400")),children:M.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:f("px-2 py-1 rounded-full text-xs font-medium",M.progress===100||M.status==="completed"?"bg-green-500/10 text-green-500":M.progress&&M.progress>0||M.status==="in-progress"?"bg-blue-500/10 text-blue-500":h?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:M.progress===100||M.status==="completed"?g.status.completed:M.progress&&M.progress>0||M.status==="in-progress"?g.status.inProgress:g.status.todo})}),jsxRuntime.jsxs("div",{className:f("col-span-2 flex items-center gap-1 text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),R(M.startDate)]}),jsxRuntime.jsxs("div",{className:f("col-span-2 flex items-center gap-1 text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),R(M.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:f("flex-1 h-1.5 rounded-full overflow-hidden",h?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",M.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${M.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:f("text-xs w-8",h?"text-[#9CA3AF]":"text-gray-500"),children:[M.progress||0,"%"]})]})})]},M.id)})}),w.length===0&&x&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:f("w-12 h-12 mx-auto mb-4",h?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f(h?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.noResults})]})})]})]})}var Pi={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"},Mi={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"},Ai={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"},Hn={dark:Pi,light:Mi,neutral:Ai};function zc(e){return Hn[e]||Hn.dark}var Fi={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"}},Li={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"}},Wn={en:Fi,es:Li};function Wo(e){return Wn[e]||Wn.en}function Gn(e,t){let a=Wo(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 Uc(e){let t=Wo(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 Hc(e,t=0,a=true){let r=Wo(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 gh(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 zi(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 jc({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 Yc({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:p,availableTags:m=[],onCreateTag:i,attachmentsByTask:u,comments:d,onAddComment:g,currentUser:h,onTaskOpen:C}){let{theme:T="dark",locale:c="en",customTranslations:b}=t,y=Gn(c,b),l=T==="dark",x={textTertiary:l?"#6B7280":"#9CA3AF",textSecondary:l?"#9CA3AF":"#6B7280",textPrimary:l?"#FFFFFF":"#111827",borderLight:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:l?"#1A1D25":"#FFFFFF",bgSecondary:l?"#0F1117":"#F9FAFB",hoverBg:l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[v,D]=react.useState(r||new Date),[k,w]=react.useState(null),[R,M]=react.useState(null),[N,I]=react.useState(null),[B,K]=react.useState(new Date),[te,se]=react.useState({}),le=4,ye=3,[$,Q]=react.useState(false),[U,G]=react.useState(false),[A,Z]=react.useState(false),[J,H]=react.useState(false),[Te,Me]=react.useState(null),[Oe,xe]=react.useState(""),[Ye,We]=react.useState(void 0),[tt,xt]=react.useState(null),[At,pt]=react.useState(false),[O,ie]=react.useState(false),[ke,Pe]=react.useState(null),[Ue,rt]=react.useState(false),[Pt,Fe]=react.useState(new Date),[Jt,zt]=react.useState(false),[Dt,mt]=react.useState(false),[Qt,Ea]=react.useState(false),[oe,pe]=react.useState(""),[ua,ue]=react.useState(false),[S,q]=react.useState(""),[be,Le]=react.useState(false),ze=react.useCallback(()=>{D(new Date(v.getFullYear(),v.getMonth()-1,1));},[v]),je=react.useCallback(()=>{D(new Date(v.getFullYear(),v.getMonth()+1,1));},[v]),Re=react.useCallback(()=>{D(new Date);},[]),at=react.useMemo(()=>{let E=v.getFullYear(),ve=v.getMonth(),X=new Date(E,ve,1),Ae=new Date(E,ve+1,0),ot=X.getDay(),ne=Ae.getDate(),$e=gh(e),kt=new Date;kt.setHours(0,0,0,0);let Ie=[],Ft=ot,it=new Date(E,ve,0).getDate();for(let Ut=Ft-1;Ut>=0;Ut--){let Ve=new Date(E,ve-1,it-Ut);Ie.push({date:Ve,isCurrentMonth:false,isToday:false,isWeekend:Ve.getDay()===0||Ve.getDay()===6,events:$e.filter(wt=>zi(Ve,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}for(let Ut=1;Ut<=ne;Ut++){let Ve=new Date(E,ve,Ut),wt=Ve.getTime()===kt.getTime();Ie.push({date:Ve,isCurrentMonth:true,isToday:wt,isWeekend:Ve.getDay()===0||Ve.getDay()===6,events:$e.filter(la=>zi(Ve,la)).map(la=>({id:la.id,title:la.name,start:la.startDate,end:la.endDate,task:la}))});}let fa=42-Ie.length;for(let Ut=1;Ut<=fa;Ut++){let Ve=new Date(E,ve+1,Ut);Ie.push({date:Ve,isCurrentMonth:false,isToday:false,isWeekend:Ve.getDay()===0||Ve.getDay()===6,events:$e.filter(wt=>zi(Ve,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}return Ie},[v,e]),st=c==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],_=v.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),ae=react.useCallback((E,ve)=>{if(!k)return;let X={...k,[E]:ve};w(X),a.onTaskUpdate?.(X);},[k,a]),Ee=react.useCallback(E=>{if(!k)return;let ve=k.progress||0;E==="completed"?ve=100:E==="todo"&&(ve=0);let X={...k,status:E,progress:ve};w(X),a.onTaskUpdate?.(X),Q(false);},[k,a]),Ke=react.useCallback((E,ve)=>{if(!k)return;let X={...k,startDate:E,endDate:ve};w(X),a.onTaskUpdate?.(X);},[k,a]),He=react.useCallback(()=>{Q(false),G(false),Z(false),I(null),Ea(false),pe(""),ue(false);},[]),W=react.useCallback(async E=>{if(E.preventDefault(),E.stopPropagation(),zt(false),!k||!a.onUploadAttachments)return;let ve=Array.from(E.dataTransfer.files);if(ve.length!==0){mt(true);try{await a.onUploadAttachments(k.id,ve);}finally{mt(false);}}},[k,a]),de=react.useCallback(async E=>{if(!k||!a.onUploadAttachments||!E.target.files)return;let ve=Array.from(E.target.files);if(ve.length!==0){mt(true);try{await a.onUploadAttachments(k.id,ve);}finally{mt(false);}E.target.value="";}},[k,a]),Be=react.useCallback(E=>{E.preventDefault(),E.stopPropagation(),zt(true);},[]),St=react.useCallback(E=>{E.preventDefault(),E.stopPropagation(),zt(false);},[]),Qe=react.useCallback(E=>E<1024?`${E} B`:E<1024*1024?`${(E/1024).toFixed(1)} KB`:`${(E/(1024*1024)).toFixed(1)} MB`,[]),va=react.useCallback(E=>E.startsWith("image/")?lucideReact.Image:E.includes("pdf")||E.includes("document")?lucideReact.FileText:lucideReact.File,[]),ga=react.useMemo(()=>!k||!u?[]:u.get(k.id)||[],[k,u]);return o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:[y.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:y.labels.noEvents}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:y.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-auto",l?"bg-[#0F1117]":"bg-white",n),style:p,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:f("text-xl font-semibold capitalize",l?"text-white":"text-gray-900"),children:_}),jsxRuntime.jsx("button",{onClick:Re,className:f("px-3 py-1.5 text-sm rounded-lg transition-colors",l?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:y.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:ze,className:f("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:f("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:je,className:f("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:st.map(E=>jsxRuntime.jsx("div",{className:f("py-2 text-center text-xs font-medium uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:E},E))}),jsxRuntime.jsx("div",{className:f("grid grid-cols-7 auto-rows-min gap-px rounded-lg",l?"bg-[#2D2D2D]":"bg-gray-300"),children:at.map((E,ve)=>{let X=E.date.getDay()===0||E.date.getDay()===6;return jsxRuntime.jsxs("div",{className:f("min-h-[120px] p-2 transition-colors flex flex-col relative group",l?X?"bg-[#1C1F26]":E.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":X?"bg-gray-100":E.isCurrentMonth?"bg-white":"bg-gray-50",E.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ae=te[ve]||le,ot=E.events.slice(0,Ae),ne=E.events.length-Ae;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[ot.map($e=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{w($e.task),a.onEventClick?.($e),C?.($e.task.id);},whileHover:{scale:1.02},className:f("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",$e.task.progress===100?l?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":l?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(jc,{task:$e.task}),jsxRuntime.jsx("span",{className:"truncate",children:$e.title})]})},$e.id)),ne>0&&jsxRuntime.jsxs("button",{onClick:$e=>{$e.stopPropagation(),se(kt=>({...kt,[ve]:Ae+ye}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",ne," ",c==="es"?"M\xC1S":"MORE"]}),Ae>le&&E.events.length>le&&jsxRuntime.jsx("button",{onClick:$e=>{$e.stopPropagation(),se(kt=>({...kt,[ve]:le}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:c==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ae=ve>=28,ot=ve%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:ne=>{ne.stopPropagation(),Te===ve?Me(null):(Me(ve),xe(""),We(void 0),xt(null),Pe(null),pt(false),ie(false),rt(false),Fe(E.date));},className:f("w-5 h-5 rounded flex items-center justify-center transition-all",Te===ve?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",l?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:f("w-3.5 h-3.5 transition-transform",Te===ve&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Te===ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Me(null),xe(""),We(void 0),xt(null),Pe(null),pt(false),ie(false),rt(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:f("absolute w-[320px] rounded-lg shadow-2xl z-50",Ae?"bottom-full mb-1":"top-full mt-1",ot?"right-0":"left-0",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>{ne.stopPropagation(),pt(false),ie(false),rt(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Oe,onChange:ne=>xe(ne.target.value),placeholder:c==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:f("w-full bg-transparent text-sm outline-none placeholder:opacity-40",l?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:ne=>{if(ne.key==="Enter"&&Oe.trim()){let $e=t.availableUsers?.find(Ie=>Ie.id===tt),kt=ke||E.date;a.onTaskCreate?.({name:Oe.trim(),startDate:kt,endDate:kt,priority:Ye,assignees:$e?[$e]:void 0}),xe(""),We(void 0),xt(null),Pe(null),Me(null);}ne.key==="Escape"&&(Me(null),xe(""),We(void 0),xt(null),Pe(null));}})}),jsxRuntime.jsxs("div",{className:f("px-2.5 py-2 flex items-center justify-between border-t",l?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:ne=>{ne.stopPropagation(),pt(!At),ie(false);},className:f("p-1 rounded transition-colors",Ye?Ye==="urgent"||Ye==="high"?"text-red-400 bg-red-500/20":Ye==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:At&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>ne.stopPropagation(),children:[{id:"urgent",label:c==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:c==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:c==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:c==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:c==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(ne=>jsxRuntime.jsxs("button",{onClick:()=>{We(ne.id),pt(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",Ye===ne.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",ne.color)}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:ne.label})]},ne.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:ne=>{ne.stopPropagation(),rt(!Ue),pt(false),ie(false),Fe(ke||E.date);},className:f("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",ke?"bg-[#7C3AED]/20 text-[#7C3AED]":l?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(ke||E.date).toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ue&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>ne.stopPropagation(),children:[jsxRuntime.jsx("div",{className:f("w-40 py-2 border-r",l?"border-white/10":"border-gray-200"),children:(()=>{let ne=new Date,$e=new Date(ne);$e.setDate(ne.getDate()+1);let kt=new Date(ne);kt.setDate(ne.getDate()+((6-ne.getDay()+7)%7||7));let Ie=new Date(ne);Ie.setDate(ne.getDate()+((1-ne.getDay()+7)%7||7));let Ft=new Date(ne);Ft.setDate(ne.getDate()+14);let it=new Date(ne);return it.setDate(ne.getDate()+28),[{label:c==="es"?"Hoy":"Today",date:ne,display:ne.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Ma\xF1ana":"Tomorrow",date:$e,display:$e.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Este fin de semana":"This weekend",date:kt,display:c==="es"?"s\xE1b.":"sat."},{label:c==="es"?"Pr\xF3xima semana":"Next week",date:Ie,display:c==="es"?"lun.":"mon."},{label:c==="es"?"2 semanas":"2 weeks",date:Ft,display:Ft.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"4 semanas":"4 weeks",date:it,display:it.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ut,Ve)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Pe(Ut.date),rt(false);},children:[jsxRuntime.jsx("span",{children:Ut.label}),jsxRuntime.jsx("span",{className:f("text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:Ut.display})]},Ve))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:f("text-xs font-medium",l?"text-white":"text-gray-900"),children:Pt.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Fe(new Date),className:f("px-1.5 py-0.5 rounded text-[10px] transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:c==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Fe(new Date(Pt.getFullYear(),Pt.getMonth()-1)),className:f("p-0.5 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Fe(new Date(Pt.getFullYear(),Pt.getMonth()+1)),className:f("p-0.5 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(c==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(ne=>jsxRuntime.jsx("div",{className:f("w-6 h-6 flex items-center justify-center text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:ne},ne))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ne=Pt.getFullYear(),$e=Pt.getMonth(),kt=new Date(ne,$e,1).getDay(),Ie=new Date(ne,$e+1,0).getDate(),Ft=new Date(ne,$e,0).getDate(),it=new Date,fa=[];for(let Ve=kt-1;Ve>=0;Ve--)fa.push({dayNum:Ft-Ve,isCurrentMonth:false,date:new Date(ne,$e-1,Ft-Ve)});for(let Ve=1;Ve<=Ie;Ve++)fa.push({dayNum:Ve,isCurrentMonth:true,date:new Date(ne,$e,Ve)});let Ut=42-fa.length;for(let Ve=1;Ve<=Ut;Ve++)fa.push({dayNum:Ve,isCurrentMonth:false,date:new Date(ne,$e+1,Ve)});return fa.map((Ve,wt)=>{let la=Ve.date.toDateString()===it.toDateString(),vr=(ke||E.date).toDateString()===Ve.date.toDateString();return jsxRuntime.jsx("button",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!Ve.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),Ve.isCurrentMonth&&(l?"text-white":"text-gray-900"),la&&"ring-1 ring-[#3B82F6]",vr&&"bg-[#7C3AED] text-white",!vr&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Pe(Ve.date),rt(false);},children:Ve.dayNum},wt)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:ne=>{ne.stopPropagation(),ie(!O),pt(false);},className:f("p-1 rounded transition-colors",tt?"text-[#7C3AED] bg-[#7C3AED]/20":l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:tt?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(ne=>ne.id===tt)?.color||"#7C3AED"},children:t.availableUsers?.find(ne=>ne.id===tt)?.initials||t.availableUsers?.find(ne=>ne.id===tt)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:O&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>ne.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{xt(null),ie(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",!tt&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded-full flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:l?"text-[#9CA3AF]":"text-gray-500",children:c==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(ne=>jsxRuntime.jsxs("button",{onClick:()=>{xt(ne.id),ie(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",tt===ne.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:ne.color||"#7C3AED"},children:ne.initials||ne.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:ne.name})]},ne.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:f("px-3 py-2 text-xs",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Oe.trim()){let ne=t.availableUsers?.find(kt=>kt.id===tt),$e=ke||E.date;a.onTaskCreate?.({name:Oe.trim(),startDate:$e,endDate:$e,priority:Ye,assignees:ne?[ne]:void 0}),xe(""),We(void 0),xt(null),Pe(null),Me(null);}},disabled:!Oe.trim(),className:f("px-2.5 py-1 rounded text-xs font-medium transition-colors",Oe.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":l?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:c==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:f("text-sm font-medium",E.isToday?"text-[#3B82F6]":E.isCurrentMonth?l?"text-white":"text-gray-900":l?"text-[#6B7280]":"text-gray-400"),children:E.date.getDate()})]})]},ve)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>{w(null),q("");},className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:f("w-4 h-4",l?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[c==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:f("text-xs font-mono",l?"text-[#6B7280]":"text-gray-400"),children:k.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",l?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>{w(null),q("");},className:f("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let E=k.progress===100?0:100,X={...k,progress:E,status:E===100?"completed":"todo"};w(X),a.onTaskUpdate?.(X);},className:f("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",k.progress===100?"bg-green-500 border-green-500":l?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:k.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:f("text-xl font-semibold flex-1",k.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:k.name})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{He(),Q(!$);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",k.progress===100||k.status==="completed"?"bg-green-500/20 text-green-400":k.progress&&k.progress>0||k.status==="in-progress"?"bg-blue-500/20 text-blue-400":l?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:k.progress===100||k.status==="completed"?c==="es"?"COMPLETADO":"DONE":k.progress&&k.progress>0||k.status==="in-progress"?c==="es"?"EN PROGRESO":"IN PROGRESS":c==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Q(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:c==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:c==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:c==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(E=>jsxRuntime.jsxs("button",{onClick:()=>Ee(E.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",(k.status===E.id||E.id==="completed"&&k.progress===100||E.id==="in-progress"&&k.progress&&k.progress>0&&k.progress<100||E.id==="todo"&&(!k.progress||k.progress===0)&&k.status!=="in-progress"&&k.status!=="completed")&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",E.id==="completed"?"bg-green-500":E.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:E.label})]},E.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Q(false),G(false),I(null),Z(!A);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[k.assignees&&k.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[k.assignees.slice(0,3).map((E,ve)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:E.color||"#8B5CF6"},title:E.name,children:E.initials||E.name.slice(0,2).toUpperCase()},ve)),k.assignees.length>3&&jsxRuntime.jsxs("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:["+",k.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:f("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:A&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Z(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(E=>{let ve=k.assignees?.some(X=>X.name===E.name);return jsxRuntime.jsxs("button",{onClick:()=>{let X=k.assignees||[],Ae;ve?Ae=X.filter(ot=>ot.name!==E.name):Ae=[...X,{name:E.name,avatar:E.avatar,initials:E.initials||E.name.slice(0,2).toUpperCase(),color:E.color||"#8B5CF6"}],ae("assignees",Ae);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50",ve&&(l?"bg-white/5":"bg-gray-50")),children:[E.avatar?jsxRuntime.jsx("img",{src:E.avatar,alt:E.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:E.color||"#8B5CF6"},children:E.initials||E.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:f("flex-1 text-left",l?"text-white":"text-gray-900"),children:E.name}),ve&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},E.id||E.name)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{I(N?null:"start"),K(k.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[k.startDate?.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(c==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:f("mx-1",l?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),k.endDate?.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(c==="es"?"Fin":"End"),(k.startDate||k.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:E=>{E.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>I(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:f("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:f("w-44 py-2 border-r",l?"border-white/10":"border-gray-200"),children:[(()=>{let E=new Date,ve=new Date(E);ve.setDate(E.getDate()+1);let X=new Date(E);X.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let Ae=new Date(E);Ae.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let ot=new Date(E);ot.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let ne=new Date(E);ne.setDate(E.getDate()+14);let $e=new Date(E);return $e.setDate(E.getDate()+28),[{label:c==="es"?"Hoy":"Today",date:E,display:E.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Ma\xF1ana":"Tomorrow",date:ve,display:ve.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Este fin de semana":"This weekend",date:X,display:c==="es"?"s\xE1b.":"sat."},{label:c==="es"?"Pr\xF3xima semana":"Next week",date:Ae,display:c==="es"?"lun.":"mon."},{label:c==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ot,display:ot.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"2 semanas":"2 weeks",date:ne,display:ne.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"4 semanas":"4 weeks",date:$e,display:$e.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ie,Ft)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(N==="start"){let it=k.endDate&&Ie.date>k.endDate?Ie.date:k.endDate;Ke(Ie.date,it),I("end");}else {let it=k.startDate&&Ie.date<k.startDate?Ie.date:k.startDate;Ke(it,Ie.date),I(null);}},children:[jsxRuntime.jsx("span",{children:Ie.label}),jsxRuntime.jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:Ie.display})]},Ft))})(),jsxRuntime.jsx("div",{className:f("border-t mt-2 pt-2",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Ke(void 0,void 0),I(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:c==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:f("text-xs mb-3 px-2 py-1 rounded",l?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:N==="start"?c==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":c==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:f("font-medium",l?"text-white":"text-gray-900"),children:B.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>K(new Date),className:f("p-1 rounded text-sm transition-colors",l?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:c==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>K(new Date(B.getFullYear(),B.getMonth()-1)),className:f("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>K(new Date(B.getFullYear(),B.getMonth()+1)),className:f("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(c==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(E=>jsxRuntime.jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",l?"text-[#6B7280]":"text-gray-400"),children:E},E))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let E=B.getFullYear(),ve=B.getMonth(),X=new Date(E,ve,1).getDay(),Ae=new Date(E,ve+1,0).getDate(),ot=new Date(E,ve,0).getDate(),ne=new Date,$e=[];for(let Ie=X-1;Ie>=0;Ie--)$e.push({day:ot-Ie,isCurrentMonth:false,date:new Date(E,ve-1,ot-Ie)});for(let Ie=1;Ie<=Ae;Ie++)$e.push({day:Ie,isCurrentMonth:true,date:new Date(E,ve,Ie)});let kt=42-$e.length;for(let Ie=1;Ie<=kt;Ie++)$e.push({day:Ie,isCurrentMonth:false,date:new Date(E,ve+1,Ie)});return $e.map((Ie,Ft)=>{let it=Ie.date.toDateString()===ne.toDateString(),fa=k.startDate?.toDateString()===Ie.date.toDateString(),Ut=k.endDate?.toDateString()===Ie.date.toDateString(),Ve=fa||Ut,wt=k.startDate&&k.endDate&&Ie.date>=k.startDate&&Ie.date<=k.endDate;return jsxRuntime.jsx("button",{className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Ie.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),Ie.isCurrentMonth&&(l?"text-white":"text-gray-900"),it&&"ring-2 ring-[#3B82F6]",fa&&"bg-[#3B82F6] text-white",Ut&&!fa&&"bg-[#7C3AED] text-white",wt&&!Ve&&(l?"bg-[#7C3AED]/20":"bg-purple-100"),!Ve&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let la=new Date(Ie.date);if(N==="start"){let vr=k.endDate&&la>k.endDate?la:k.endDate;Ke(la,vr),I("end");}else {let vr=k.startDate&&la<k.startDate?la:k.startDate;Ke(vr,la),I(null);}},children:Ie.day},Ft)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{He(),G(!U);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",k.priority==="high"||k.priority==="urgent"?"bg-red-500/20 text-red-400":k.priority==="medium"?"bg-yellow-500/20 text-yellow-400":k.priority==="low"?"bg-green-500/20 text-green-400":l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:k.priority?k.priority==="high"||k.priority==="urgent"?c==="es"?"Urgente":"Urgent":k.priority==="medium"?c==="es"?"Media":"Medium":c==="es"?"Baja":"Low":c==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>G(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:c==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:c==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:c==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:c==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:c==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(E=>jsxRuntime.jsxs("button",{onClick:()=>{ae("priority",E.id),G(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",k.priority===E.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",E.color)}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:E.label})]},E.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:k.startDate&&k.endDate?`${Math.ceil((k.endDate.getTime()-k.startDate.getTime())/(1e3*60*60*24))} ${c==="es"?"d\xEDas":"days"}`:c==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full border-2",l?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[J?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:k.progress||0,onChange:E=>{let ve=parseInt(E.target.value),X=k.status;ve===100?X="completed":ve>0?X="in-progress":X="todo";let Ae={...k,progress:ve,status:X};w(Ae),a.onTaskUpdate?.(Ae);},onBlur:()=>H(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",l?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>H(true),className:f("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",k.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${k.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium min-w-[40px]",l?"text-white":"text-gray-900"),children:[k.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(nr,{selectedTags:k.tags||[],availableTags:m,onChange:E=>{ae("tags",E);},onCreateTag:i,theme:x})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:f("w-4 h-4 mt-1.5",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24 mt-1",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[k.dependencies&&k.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:k.dependencies.map(E=>{let ve=e.find(X=>X.id===E);return jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",l?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ve?.name||E.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let X=(k.dependencies||[]).filter(Ae=>Ae!==E);ae("dependencies",X);},className:f("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},E)})}),jsxRuntime.jsxs("button",{onClick:()=>{He(),Ea(!Qt);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Qt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ea(false),pe("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("p-2 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:oe,onChange:E=>pe(E.target.value),placeholder:c==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",l?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:e.length>0?e.filter(E=>E.id!==k.id).filter(E=>oe===""||E.name.toLowerCase().includes(oe.toLowerCase())).map(E=>{let ve=k.dependencies?.includes(E.id);return jsxRuntime.jsxs("button",{onClick:()=>{let X=k.dependencies||[],Ae;ve?Ae=X.filter(ot=>ot!==E.id):Ae=[...X,E.id],ae("dependencies",Ae);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",ve&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ve?"bg-blue-500 border-blue-500":l?"border-white/30":"border-gray-300"),children:ve&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:f("block truncate",l?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:E.id.slice(0,8)})]})]},E.id)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-500"),children:c==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{He(),ue(!ua);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:k.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:sr.find(E=>E.value===k.color)?.name||(c==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ua&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ue(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:sr.map(E=>{let ve=k.color===E.value;return jsxRuntime.jsx("button",{onClick:()=>{ae("color",E.value),ue(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",ve&&"ring-2 ring-offset-2",l?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:E.value,outlineColor:ve?E.value:void 0},title:E.name,children:ve&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},E.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:k.isMilestone||false,onChange:E=>ae("isMilestone",E.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",k.isMilestone?"bg-purple-500 border-purple-500":l?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:c==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:c==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:k.description||"",onChange:E=>ae("description",E.target.value),placeholder:c==="es"?"Agregar descripci\xF3n...":"Add description...",className:f("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",l?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-2 text-sm mt-2 transition-colors",l?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),c==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:c==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),c==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:c==="es"?"Agregar subtarea":"Add subtask"}),k.subtasks&&k.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:k.subtasks.map(E=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",E.progress===100?"bg-green-500 border-green-500":l?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:E.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:f("text-sm",E.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:E.name})]},E.id))}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),c==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:c==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:f("p-1 rounded transition-colors",l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),c==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:[c==="es"?"Adjuntos":"Attachments",ga.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",ga.length,")"]})]}),ga.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:ga.map(E=>{let ve=va(E.type),X=E.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[X&&E.thumbnailUrl?jsxRuntime.jsx("img",{src:E.thumbnailUrl,alt:E.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(ve,{className:f("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:f("text-sm font-medium truncate block hover:underline",l?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("p",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:Qe(E.size)})]}),a.onDeleteAttachment&&jsxRuntime.jsx("button",{onClick:()=>a.onDeleteAttachment?.(E.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",l?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:c==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},E.id)})}),jsxRuntime.jsxs("div",{onDragOver:Be,onDragLeave:St,onDrop:W,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Jt?l?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":l?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",Dt&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:de,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||Dt}),Dt?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:f("w-6 h-6 mx-auto mb-2",Jt?"text-blue-500":l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:Jt?c==="es"?"Suelta los archivos aqu\xED":"Drop files here":c==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!a.onUploadAttachments&&jsxRuntime.jsx("p",{className:f("text-xs mt-1",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:f("w-80 border-l flex flex-col",l?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:[c==="es"?"Actividad":"Activity",d&&d.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d&&d.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:d.map(E=>{let ve=(()=>{let X=new Date,Ae=new Date(E.createdAt),ot=X.getTime()-Ae.getTime(),ne=Math.floor(ot/6e4),$e=Math.floor(ne/60),kt=Math.floor($e/24);return ne<1?c==="es"?"ahora":"now":ne<60?c==="es"?`hace ${ne}m`:`${ne}m ago`:$e<24?c==="es"?`hace ${$e}h`:`${$e}h ago`:c==="es"?`hace ${kt}d`:`${kt}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:E.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:f("text-sm font-medium",l?"text-white":"text-gray-900"),children:E.user?.name||(c==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:ve})]}),jsxRuntime.jsx("p",{className:f("text-sm break-words",l?"text-[#9CA3AF]":"text-gray-600"),children:E.content})]})]},E.id)})}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:f("w-10 h-10 mb-3",l?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#6B7280]":"text-gray-500"),children:c==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:f("p-4 border-t",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[h&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:h.color||"#8B5CF6"},children:h.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:f("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",l?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",value:S,onChange:E=>q(E.target.value),onKeyDown:async E=>{if(E.key==="Enter"&&!E.shiftKey&&k&&S.trim()&&g){E.preventDefault(),Le(true);try{await g(k.id,S.trim()),q("");}finally{Le(false);}}},placeholder:c==="es"?"Escribe un comentario...":"Write a comment...",disabled:be||!g,className:f("flex-1 bg-transparent text-sm outline-none",l?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(be||!g)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:async()=>{if(k&&S.trim()&&g){Le(true);try{await g(k.id,S.trim()),q("");}finally{Le(false);}}},disabled:be||!S.trim()||!g,className:f("p-1.5 rounded transition-colors",S.trim()&&g?"bg-blue-500 text-white hover:bg-blue-600":l?"text-[#6B7280]":"text-gray-400",be&&"opacity-50 cursor-not-allowed"),children:be?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:R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>M(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:f("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:f("px-4 py-3 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:f("font-medium",l?"text-white":"text-gray-900"),children:R.date.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>M(null),className:f("p-1 rounded",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:R.events.map(E=>jsxRuntime.jsxs("button",{onClick:()=>{M(null),w(E.task),C?.(E.task.id);},className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(jc,{task:E.task}),jsxRuntime.jsx("span",{className:f("text-sm truncate flex-1",l?"text-white":"text-gray-900"),children:E.title}),E.task.priority==="high"||E.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},E.id))})]})]})})]})}var Ui={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"},Hi={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"},Wi={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"},Vn={dark:Ui,light:Hi,neutral:Wi};function qc(e){return Vn[e]||Vn.dark}function hh({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:p}){let[m,i]=react.useState(false),u=react.useMemo(()=>t.filter(h=>e.cardIds.includes(h.id)),[t,e.cardIds]),d=react.useMemo(()=>{let h=u.length,C=new Set(u.flatMap(b=>b.assignedUserIds||[])).size,T=u.map(b=>b.priority).filter(Boolean),c=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:h,uniqueAssignees:C,priorities:T,labels:c}},[u]),g=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:f("card-stack",!e.isExpanded&&"card-stack-collapsed",p),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:g,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:f("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:h=>{h.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:u.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:u.map(h=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(h),children:a(h)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(h),children:[jsxRuntime.jsx("h4",{children:h.title}),h.description&&jsxRuntime.jsxs("p",{children:[h.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:C=>{C.stopPropagation(),s?.(e.id,h.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},h.id))})})]})}var Jc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Vo(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 jo(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 Qc(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function Zc({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:p}){let m=react.useMemo(()=>({...Jc,...n}),[n]),[i,u]=react.useState(new Set),d=react.useRef(null),g=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(l=>{let x=l.timestamp.toISOString().split("T")[0],v=y.get(x);v?v.push(l):y.set(x,[l]);}),Array.from(y.entries()).sort((l,x)=>x[0].localeCompare(l[0])).map(([l,x])=>({date:new Date(l),events:x.sort((v,D)=>D.timestamp.getTime()-v.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:h,uniqueTypes:C}=react.useMemo(()=>{let y=new Set,l=new Set;return e.forEach(x=>{y.add(x.userId),l.add(x.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(l)}},[e]),T=y=>{u(l=>{let x=new Set(l);return x.has(y)?x.delete(y):x.add(y),x});},c=y=>{let x=new Date().getTime()-y.getTime(),v=Math.floor(x/6e4),D=Math.floor(x/36e5),k=Math.floor(x/864e5);return v<1?"just now":v<60?`${v}m ago`:D<24?`${D}h ago`:k<7?`${k}d ago`:y.toLocaleDateString()},b=react.useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return react.useEffect(()=>{if(s&&d.current){let y=d.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:f("history-timeline-empty",p),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:f("history-timeline",m.compact&&"compact",p),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let l=y.target.value;a({...t,types:l?[l]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),C.map(y=>jsxRuntime.jsxs("option",{value:y,children:[jo(y)," ",y.replace("_"," ")]},y))]}),h.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let l=y.target.value;a({...t,users:l?[l]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),h.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>a({...t,searchTerm:y.target.value})})]}),b>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:g.map(y=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&y.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:y.events.map((l,x)=>{let v=i.has(l.id),D=s===l.id,k=Qc(l.type);return jsxRuntime.jsxs("div",{"data-event-id":l.id,className:f("history-timeline-event",v&&"expanded",D&&"selected"),onClick:()=>o?.(l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:k},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:jo(l.type)})}),x<y.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:k}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&l.userAvatar&&jsxRuntime.jsx("img",{src:l.userAvatar,alt:l.userName||l.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:l.userName||l.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Vo(l)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?c(l.timestamp):l.timestamp.toLocaleString()})]}),Object.keys(l.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),T(l.id);},children:[v?"\u25BC":"\u25B6"," Show changes"]}),v&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(l.changes).map(([w,R])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(R.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(R.to)})]})]},w)),l.metadata&&Object.keys(l.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(l.metadata).map(([w,R])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(R)})]},w))]})]})]})]},l.id)})})]},y.date?.toISOString()||"all"))})]})}function tm({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:p,onSpeedChange:m,className:i}){let u=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),g=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:f("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:f("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&jo(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&Vo(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:h=>p(parseInt(h.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${g}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((h,C)=>jsxRuntime.jsx("div",{className:f("history-replay-progress-marker",C===e.currentIndex&&"active"),style:{left:`${C/(e.totalEvents-1)*100}%`},onClick:()=>p(C),title:Vo(h)},h.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:u.map(h=>jsxRuntime.jsxs("button",{className:f("history-replay-speed-btn",e.speed===h&&"active"),onClick:()=>m(h),children:[h,"x"]},h))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(h=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:h},h))})]})]})]})]}):jsxRuntime.jsxs("div",{className:f("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Gi(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 _i(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 am(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 rm(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function wh(e,t,a,r,o,s=100){let n=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),p=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(u=>{let d=a/2,g=r/2;u.vx+=(d-u.x)*o.centerForce*i,u.vy+=(g-u.y)*o.centerForce*i,n.forEach(h=>{if(u.id===h.id)return;let C=u.x-h.x,T=u.y-h.y,c=Math.sqrt(C*C+T*T)||1,b=o.chargeStrength*i/(c*c);u.vx+=C/c*b,u.vy+=T/c*b;});}),t.forEach(u=>{let d=p.get(typeof u.source=="string"?u.source:u.source.id),g=p.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!g)return;let h=g.x-d.x,C=g.y-d.y,T=Math.sqrt(h*h+C*C)||1,c=(T-o.linkDistance)/T*o.forceStrength*i;d.vx+=h*c,d.vy+=C*c,g.vx-=h*c,g.vy-=C*c;}),n.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return n}function om({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:p,className:m}){let i=react.useRef(null),[u,d]=react.useState([]),[g,h]=react.useState(null),[C,T]=react.useState(null),[c,b]=react.useState(null),[y,l]=react.useState(1),[x,v]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let B=wh(e,t,a.width,a.height,a,150);d(B);},[e,t,a]);let D=react.useCallback((B,K)=>{a.enableDragging&&(K.stopPropagation(),h(B));},[a.enableDragging]),k=react.useCallback(B=>{if(!g||!i.current)return;let te=i.current.getBoundingClientRect(),se=(B.clientX-te.left-x.x)/y,le=(B.clientY-te.top-x.y)/y;d(ye=>ye.map($=>$.id===g?{...$,x:se,y:le,fx:se,fy:le}:$));},[g,y,x]),w=react.useCallback(()=>{h(null);},[]),R=react.useCallback((B,K)=>{K.stopPropagation(),p?.({type:"node-click",node:B,position:{x:K.clientX,y:K.clientY}});},[p]),M=react.useCallback((B,K)=>{K.stopPropagation(),p?.({type:"edge-click",edge:B,position:{x:K.clientX,y:K.clientY}});},[p]),N=react.useCallback(B=>{let K=u.find(te=>te.id===B);return K?{x:K.x,y:K.y}:{x:0,y:0}},[u]),I=react.useCallback(B=>{if(B.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return B.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let K=B.card.priority;return K==="URGENT"?"#ef4444":K==="HIGH"?"#f59e0b":K==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return B.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:f("relationships-graph-empty",m),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:f("relationships-graph",m),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>l(B=>Math.min(B+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>l(B=>Math.max(B-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{l(1),v({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(B=>B.type))).map(B=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Gi(B)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[am(B)," ",_i(B)]})]},B))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:k,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${y})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(B=>{let K=N(typeof B.source=="string"?B.source:B.source.id),te=N(typeof B.target=="string"?B.target:B.target.id),se=rm(B.type),le=c===B.id,ye=B.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-edge",le&&"hovered",ye&&"critical"),onMouseEnter:()=>b(B.id),onMouseLeave:()=>b(null),onClick:$=>M(B,$),children:[jsxRuntime.jsx("line",{x1:K.x,y1:K.y,x2:te.x,y2:te.y,stroke:Gi(B.type),strokeWidth:ye?a.edgeWidth*2:a.edgeWidth,strokeOpacity:le?1:.6,markerEnd:se?"url(#arrowhead)":void 0}),a.showEdgeLabels&&le&&jsxRuntime.jsx("text",{x:(K.x+te.x)/2,y:(K.y+te.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:_i(B.type)})]},B.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(B=>{let K=C===B.id,te=B.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-node",K&&"hovered",te&&"critical"),transform:`translate(${B.x}, ${B.y})`,onMouseDown:se=>D(B.id,se),onMouseEnter:()=>T(B.id),onMouseLeave:()=>T(null),onClick:se=>R(B,se),children:[jsxRuntime.jsx("circle",{r:te?a.nodeSize*1.2:a.nodeSize,fill:I(B),stroke:te?"#fbbf24":"#ffffff",strokeWidth:te?3:2,opacity:K?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:B.card.title.length>20?B.card.title.substring(0,20)+"...":B.card.title})]},B.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 im({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[p,m]=react.useState(false),[i,u]=react.useState(null),[d,g]=react.useState(null),h=react.useRef(null),C=p||o;react.useEffect(()=>{e&&h.current&&h.current.focus();},[e]),react.useEffect(()=>{let y=l=>{l.key==="Escape"&&!C&&T();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,C]);let T=()=>{C||(n(""),u(null),g(null),t());},c=async()=>{if(!(!s.trim()||C)){m(true),u(null),g(null);try{let y=await r(s.trim());g(y);}catch(y){u(y instanceof Error?y.message:"Failed to generate plan");}finally{m(false);}}},b=()=>{d&&(a(d),T());};return e?jsxRuntime.jsxs(dt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:T}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-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:y=>y.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:T,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((y,l)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:y.title},l))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((y,l)=>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:y.title}),y.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="URGENT"?"bg-red-500/20 text-red-400":y.priority==="HIGH"?"bg-orange-500/20 text-orange-400":y.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:y.priority})]})},l)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:h,value:s,onChange:y=>n(y.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:C}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,l)=>jsxRuntime.jsx("button",{onClick:()=>n(y),disabled:C,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:y},l))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:C&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:T,disabled:C,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick: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:c,disabled:!s.trim()||C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:C?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Vi={"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 Th={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Nh={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 Dh(e,t,a){let r=Vi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Ko(e){return `$${e.toFixed(4)}`}var ji=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Dh(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,g)=>d+g.cost,0),s=a.reduce((d,g)=>d+g.inputTokens,0),n=a.reduce((d,g)=>d+g.outputTokens,0),p=a.filter(d=>d.success),m=a.reduce((d,g)=>d+g.duration,0),i={},u={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?m/r:0,successRate:r>0?p.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let p=this.operations.filter(u=>u.timestamp>=n).length,m=Math.max(0,o-p),i=p/o*100;return {used:p,limit:o,remaining:m,percentUsed:i,isExceeded:p>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Qr=new ji;function cm({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Qr.getStats()),[s,n]=react.useState(Qr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(Qr.getStats()),n(Qr.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let p=Qr.getRecentOperations(5);return jsxRuntime.jsxs(dt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:m=>m.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ko(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([m,i])=>{let u=r.costsByFeature[m]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:m.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ko(u)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),p.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:p.map(m=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ko(m.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function um({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,p]=react.useState(""),[m,i]=react.useState(""),[u,d]=react.useState(""),[g,h]=react.useState(false),[C,T]=react.useState(null),[c,b]=react.useState(null),[y,l]=react.useState(null),x=react.useRef(null),v=g||o;react.useEffect(()=>{e&&x.current&&x.current.focus();},[e]),react.useEffect(()=>{let M=N=>{N.key==="Escape"&&!v&&D();};if(e)return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,v]);let D=()=>{v||(p(""),i(""),d(""),T(null),b(null),l(null),t());},k=async()=>{if(!(!n.trim()||v)){h(true),T(null),b(null),l(null);try{let M=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:u||void 0});b(M.tasks.tasks),l({from_cache:M.from_cache,tokens_used:M.tokens_used,mock_mode:M.mock_mode,similarity:M.similarity,tokens_saved:M.tokens_saved});}catch(M){T(M instanceof Error?M.message:"Failed to generate tasks");}finally{h(false);}}},w=()=>{c&&(a(c),D());};if(!e)return null;let R=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(dt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:D}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:M=>M.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:D,disabled:v,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:c?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[y?.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"}),y?.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 (",R,"% 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:[y?.tokens_used||0," tokens"]}),y?.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:[y.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:[c.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:c.map((M,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:M.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),M.start," \u2192 ",M.end]}),jsxRuntime.jsxs("span",{children:[M.duration," days"]}),M.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",M.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${M.priority==="high"?"bg-red-500/20 text-red-400":M.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:M.priority})]})},M.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:x,value:n,onChange:M=>p(M.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:v}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:M=>i(M.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:v})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:M=>d(M.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:v})]})]}),C&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:C}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((M,N)=>jsxRuntime.jsx("button",{onClick:()=>p(M),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:M},N))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:v&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:D,disabled:v,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),c?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:k,disabled:!n.trim()||v,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:v?"Generating...":"Generate Tasks"})]})]})]})})]})}function Yn({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(c=>{t&&an(()=>Promise.resolve(t(c)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,l)=>{console.warn(`Retry attempt ${y} after ${l}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=react.useCallback(async(c,b,y)=>{r(l=>{let x=l.cards.find(M=>M.id===c);if(!x)return l;let v=x.columnId,D={...x,columnId:b,position:y},k=l.cards.map(M=>M.id===c?D:M),w=l.columns.map(M=>{if(M.id===v)return {...M,cardIds:M.cardIds.filter(N=>N!==c)};if(M.id===b){let N=k.filter(I=>I.columnId===b).sort((I,B)=>I.position-B.position);return {...M,cardIds:N.map(I=>I.id)}}return M}),R={...l,cards:k,columns:w};return o(R),R});},[o]),n=react.useCallback(async(c,b)=>{r(y=>{let l=y.cards.map(v=>v.id===c?{...v,...b}:v),x={...y,cards:l};return o(x),x});},[o]),p=react.useCallback(async c=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let l={...c,id:b},x=y.columns.map(D=>D.id===c.columnId?{...D,cardIds:[...D.cardIds,b]}:D),v={...y,cards:[...y.cards,l],columns:x};return o(v),v});},[o]),m=react.useCallback(async c=>{r(b=>{let y=b.cards.find(D=>D.id===c);if(!y)return b;let l=b.cards.filter(D=>D.id!==c),x=b.columns.map(D=>D.id===y.columnId?{...D,cardIds:D.cardIds.filter(k=>k!==c)}:D),v={...b,cards:l,columns:x};return o(v),v});},[o]),i=react.useCallback(async c=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let l={...c,id:b,cardIds:[]},x={...y,columns:[...y.columns,l]};return o(x),x});},[o]),u=react.useCallback(async(c,b)=>{r(y=>{let l=y.columns.map(v=>v.id===c?{...v,...b}:v),x={...y,columns:l};return o(x),x});},[o]),d=react.useCallback(async c=>{r(b=>{let y=b.cards.filter(v=>v.columnId!==c),l=b.columns.filter(v=>v.id!==c),x={...b,cards:y,columns:l};return o(x),x});},[o]),g=react.useCallback(c=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return p(c),b},[p]),h=react.useCallback(c=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(c),b},[i]),C=react.useCallback(()=>{r(c=>{let b={...c,cards:[],columns:[]};return o(b),b});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:p,onCardDelete:m,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:d},setBoard:r,helpers:{addCard:g,addColumn:h,deleteCard:m,deleteColumn:d,clearBoard:C}}}function fm({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Yn({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(m,i,u={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(d=>d.columnId===m).length,...u});},addColumn:(m,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:m,position:i??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var Yo={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},bm={by:"none",order:"asc"};function ym({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Yo,...e}),[s,n]=react.useState({...bm,...t}),p=react.useCallback(T=>{o(c=>({...c,...T}));},[]),m=react.useCallback(T=>{n(c=>({...c,...T}));},[]),i=react.useCallback(()=>{o(Yo),n(bm);},[]),u=react.useCallback(()=>{a&&o({...Yo,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Yo,dateFilter:"overdue"});},[]),g=react.useCallback(()=>{o({...Yo,priorities:["HIGH","URGENT"]});},[]),h=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),C=react.useCallback(T=>{let c=[...T];if(r.search){let b=r.search.toLowerCase();c=c.filter(y=>y.title.toLowerCase().includes(b)||y.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,y=b.getFullYear(),l=String(b.getMonth()+1).padStart(2,"0"),x=String(b.getDate()).padStart(2,"0"),v=`${y}-${l}-${x}`;c=c.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let k=D.endDate||D.dueDate;if(!k)return false;let w;if(typeof k=="string")w=k.split("T")[0]||k;else {let R=k.getUTCFullYear(),M=String(k.getUTCMonth()+1).padStart(2,"0"),N=String(k.getUTCDate()).padStart(2,"0");w=`${R}-${M}-${N}`;}switch(r.dateFilter){case "overdue":return w<v;case "today":return w===v;case "this-week":let R=new Date(v+"T00:00:00"),M=new Date(w+"T00:00:00"),N=new Date(R);return N.setDate(N.getDate()+7),M>=R&&M<=N;case "custom":if(r.dateRange){let I=typeof k=="string"?new Date(k):k;return I>=r.dateRange.start&&I<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(c=c.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(c=c.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(l=>r.assignees.includes(l)))),r.labels.length>0&&(c=c.filter(b=>b.labels&&b.labels.some(y=>r.labels.includes(y)))),r.columns.length>0&&(c=c.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&c.sort((b,y)=>{let l=0;switch(s.by){case "created":let x=b.createdAt?new Date(b.createdAt).getTime():0,v=y.createdAt?new Date(y.createdAt).getTime():0;l=x-v;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},k=D[b.priority||"LOW"],w=D[y.priority||"LOW"];l=k-w;break;case "dueDate":let R=b.endDate||b.dueDate,M=y.endDate||y.dueDate;if(!R)return 1;if(!M)return -1;let N=typeof R=="string"?new Date(R).getTime():R.getTime(),I=typeof M=="string"?new Date(M).getTime():M.getTime();l=N-I;break;case "title":l=b.title.localeCompare(y.title);break;case "estimate":let B=b.estimatedTime||0,K=y.estimatedTime||0;l=B-K;break;default:l=0;}return s.order==="asc"?l:-l}),c},[r,s]);return {filters:r,sort:s,setFilters:p,setSort:m,resetFilters:i,filterMyTasks:u,filterOverdue:d,filterHighPriority:g,applyFilters:C,hasActiveFilters:h}}var xm,km;if(typeof window<"u")try{let e=Zo("ai");xm=e.generateObject,km=e.generateText;}catch{}function wm(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(xm&&km&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(g){let h=g instanceof Error?g:new Error("Failed to generate plan");throw o(h),h}finally{a(false);}},[s]),p=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(g){let h=g instanceof Error?g:new Error("Failed to suggest assignee");throw o(h),h}finally{a(false);}},[s]),m=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(g){let h=g instanceof Error?g:new Error("Failed to predict risks");throw o(h),h}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(g){let h=g instanceof Error?g:new Error("Failed to generate subtasks");throw o(h),h}finally{a(false);}},[s]),u=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(g){let h=g instanceof Error?g:new Error("Failed to estimate effort");throw o(h),h}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:p,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function Yi(){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 Cm(e){let{cards:t}=e,[a,r]=Yi(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,g)=>{if(!g){r({selectedCardIds:[d],lastSelectedCardId:d});return}let h=g.ctrlKey||g.metaKey,C=g.shiftKey;if(h)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(T=>T!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(C&&a.lastSelectedCardId){let T=t.find(b=>b.id===d),c=t.find(b=>b.id===a.lastSelectedCardId);if(T&&c&&T.columnId===c.columnId){let b=t.filter(w=>w.columnId===T.columnId).sort((w,R)=>w.position-R.position),y=b.findIndex(w=>w.id===a.lastSelectedCardId),l=b.findIndex(w=>w.id===d),[x,v]=y<l?[y,l]:[l,y],D=b.slice(x,v+1).map(w=>w.id),k=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:k,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(g=>g!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),p=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),u=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:p,selectAll:m,toggleCard:i,getSelectedCards:u}}var Tm={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Nm(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Tm,...a}),[a]),[s,n]=react.useState([]),p=react.useCallback((T,c,b,y,l)=>{if(c.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:T,cardIds:c,columnId:b,strategy:y,color:l,isExpanded:true,position:s.filter(v=>v.columnId===b).length,createdAt:new Date};n(v=>[...v,x]);},[o.minCardsPerStack,s]),m=react.useCallback(T=>{n(c=>c.filter(b=>b.id!==T));},[]),i=react.useCallback(T=>{n(c=>c.map(b=>b.id===T?{...b,isExpanded:!b.isExpanded}:b));},[]),u=react.useCallback((T,c)=>{n(b=>b.map(y=>y.id===T&&!y.cardIds.includes(c)?{...y,cardIds:[...y.cardIds,c]}:y));},[]),d=react.useCallback((T,c)=>{n(b=>b.map(y=>{if(y.id===T){let l=y.cardIds.filter(x=>x!==c);return l.length<o.minCardsPerStack?null:{...y,cardIds:l}}return y}).filter(y=>y!==null));},[o.minCardsPerStack]),g=react.useCallback(T=>s.filter(c=>c.columnId===T).sort((c,b)=>c.position-b.position),[s]),h=react.useCallback(async T=>{let c=t.filter(v=>v.columnId===T);if(c.length<o.minCardsPerStack*2)return [];let b=[],y=new Map;c.forEach(v=>{v.labels&&v.labels.length>0&&v.labels.forEach(D=>{y.has(D)||y.set(D,[]),y.get(D).push(v);});}),y.forEach((v,D)=>{v.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:v.map(k=>k.id),columnId:T,strategy:"labels",color:"#3b82f6"},reason:`${v.length} cards with label "${D}"`,confidence:.85});});let l=new Map;c.forEach(v=>{v.assignedUserIds&&v.assignedUserIds.length>0&&v.assignedUserIds.forEach(D=>{l.has(D)||l.set(D,[]),l.get(D).push(v);});}),l.forEach((v,D)=>{v.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:v.map(k=>k.id),columnId:T,strategy:"assignee",color:"#8b5cf6"},reason:`${v.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(c.forEach(v=>{v.priority&&(x.has(v.priority)||x.set(v.priority,[]),x.get(v.priority).push(v));}),x.forEach((v,D)=>{if(v.length>=o.minCardsPerStack){let k={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";b.push({stack:{title:`${k} ${D} Priority`,cardIds:v.map(w=>w.id),columnId:T,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${v.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let v of c){let k=(await r.findSimilar(v,c)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(k.length>=o.minCardsPerStack-1){let w=[v.id,...k.map(M=>M.card.id)],R=k.reduce((M,N)=>M+N.similarity,0)/k.length;b.push({stack:{title:`\u2728 Similar to "${v.title.substring(0,30)}${v.title.length>30?"...":""}"`,cardIds:w,columnId:T,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${k.length+1} similar tasks`,confidence:R});}}return b.filter(v=>v.confidence>=o.autoStackConfidenceThreshold).sort((v,D)=>D.confidence-v.confidence).slice(0,5)},[t,o,r]),C=react.useCallback(T=>{p(T.stack.title,T.stack.cardIds,T.stack.columnId,T.stack.strategy,T.stack.color);},[p]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(c=>c.columnId)).forEach(async c=>{let b=await h(c),y=b[0];b.length>0&&y&&y.confidence>=.9&&C(y);});},[]),{stacks:s,createStack:p,deleteStack:m,toggleStack:i,addToStack:u,removeFromStack:d,getStacksForColumn:g,getSuggestions:h,applySuggestion:C,config:o}}var Dm=react.createContext(null);function Sm({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(m=>{let{Column:i}=Zo("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=Zo("@libxai/core");n.set(m.id,new i(m));});let p=null;if(t?.board){let{Board:m}=Zo("@libxai/core");p=new m(t.board);}r.current=new core.BoardStore({board:p,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Dm.Provider,{value:{store:o},children:e})}function qn(){let e=react.useContext(Dm);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Xo(){let e=qn(),[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 p=react.useCallback(y=>{e.updateBoard(y);},[e]),m=react.useCallback(y=>{e.addColumn(y);},[e]),i=react.useCallback((y,l)=>{e.updateColumn(y,l);},[e]),u=react.useCallback(y=>{e.deleteColumn(y);},[e]),d=react.useCallback(y=>e.getColumn(y),[e]),g=react.useCallback(y=>{e.addCard(y);},[e]),h=react.useCallback((y,l)=>{e.updateCard(y,l);},[e]),C=react.useCallback(y=>{e.deleteCard(y);},[e]),T=react.useCallback((y,l,x)=>{e.moveCard(y,l,x);},[e]),c=react.useCallback(y=>e.getCard(y),[e]),b=react.useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:r,cards:s,updateBoard:p,addColumn:m,updateColumn:i,deleteColumn:u,getColumn:d,addCard:g,updateCard:h,deleteCard:C,moveCard:T,getCard:c,getCardsByColumn:b}}function Pm(e){let{cards:t}=Xo();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 Mm(e="position",t="asc"){let{cards:a}=Xo();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let p={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?p[o.priority]:0,i=s.priority?p[s.priority]:0;n=m-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 Xn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Nl.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 p=await Promise.resolve(n.apply(s,a));p!==void 0&&(o=p,a[0]=p);}catch(p){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,p,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Gh=new Xn;function Fm({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:p=0,getItemKey:m}){let i=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:p}),d=u.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},h=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:g,className:o,children:jsxRuntime.jsx("div",{style:h,children:d.map(C=>{let T=e[C.index];if(!T)return null;let c=m?m(T,C.index):C.index,b={position:"absolute",top:n?0:C.start,left:n?C.start:0,width:n?C.size:"100%",height:n?"100%":C.size};return jsxRuntime.jsx("div",{style:b,"data-index":C.index,children:r(T,C.index)},c)})})})}function Lm(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 Bm({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:p=16,getItemKey:m,horizontal:i=true}){let u=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:p}),g=d.getVirtualItems(),h={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},C={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:h,className:s,children:jsxRuntime.jsx("div",{style:C,children:g.map(T=>{let c=e[T.index];if(!c)return null;let b=m?m(c,T.index):T.index,y={position:"absolute",top:0,left:T.start,width:T.size,height:"100%"};return jsxRuntime.jsx("div",{style:y,"data-index":T.index,children:o(c,T.index)},b)})})})}function Rm(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 $m(e,t=10){return e>t}var Qi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Zi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},el={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},tl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},al={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},rl={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},ol={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},nl={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)"},sl={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)"},il={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},ll={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}},dl={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}},Jn={spacing:Qi,borderRadius:Zi,fontSize:el,fontWeight:tl,lineHeight:al,zIndex:rl,duration:ol,easing:nl,shadows:sl,opacity:il,kanban:ll,gantt:dl};function Om(e,t,a){return e[t]??a}function cl(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)?cl(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function jh(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function ml(e="asakaa"){let t=cl(Jn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=jh(o);a.push(` ${s}: ${n};`);}return `:root {
389
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function Ec(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function yr(e,t){let a=Ec(e),r=t.toLowerCase().trim(),o=a.find(p=>p.name.toLowerCase()===r);if(o)return o;let s=a.find(p=>p.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(p=>{let m=p.name.toLowerCase();return n.every(i=>m.includes(i))})}function Ci(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let g=new Date(r);return g.setDate(g.getDate()+1),g}if(a==="yesterday"||a==="ayer"){let g=new Date(r);return g.setDate(g.getDate()-1),g}if(a==="next week"||a==="la pr\xF3xima semana"){let g=new Date(r);return g.setDate(g.getDate()+7),g}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let h={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(h!==void 0){let C=new Date(r),T=C.getDay(),c=h-T;return c<=0&&(c+=7),C.setDate(C.getDate()+c),C}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let g=parseInt(s[1],10),h=s[2].toLowerCase(),C=new Date(r);return h==="day"||h==="d\xEDa"||h==="dias"?C.setDate(C.getDate()+g):h==="week"||h==="semana"||h==="semanas"?C.setDate(C.getDate()+g*7):(h==="month"||h==="mes"||h==="meses")&&C.setMonth(C.getMonth()+g),C}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let p=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(p&&p[1]&&p[2]&&p[3]){let g=parseInt(p[1],10),h=parseInt(p[2],10)-1,C=parseInt(p[3],10);return new Date(C,h,g)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let g=parseInt(i[1],10),h=m[i[2].toLowerCase()],C=i[3]?parseInt(i[3],10):r.getFullYear();if(h!==void 0)return new Date(C,h,g)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let g=u[d[1].toLowerCase()],h=parseInt(d[2],10),C=d[3]?parseInt(d[3],10):r.getFullYear();if(g!==void 0)return new Date(C,g,h)}return null}function Ti(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 Ni(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 Pc(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 Mc(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),u=r[2].trim(),d=yr(t,i),g=Ci(u);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!g)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let h=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,C=new Date(g);return C.setDate(C.getDate()+h),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:g,endDate:C},message:`Moved "${d.name}" to ${g.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),u=o[2].trim(),d=yr(t,i),g=Ti(u);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!g||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let h=new Date(d.endDate);return h.setDate(h.getDate()+g),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:h},message:`Extended "${d.name}" by ${g} days. New end date: ${h.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),u=s[2].trim(),d=yr(t,i),g=Ni(u);return d?g===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:g},message:`Set "${d.name}" progress to ${g}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),u=n[2].trim(),d=yr(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:u},message:`Renamed "${d.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let p=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]&&p[2]){let i=p[1].trim(),u=p[2].trim(),d=yr(t,i),g=yr(t,u);return d?g?{type:"link_tasks",taskId:g.id,taskName:g.name,dependencyFrom:d.id,dependencyTo:g.id,message:`Linked "${d.name}" \u2192 "${g.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let i=m[1].trim(),u=yr(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Ac(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 $0(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 O0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function $n(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let d=a.find(g=>g.id===u);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>$n(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let n=u=>{if(u)return typeof u=="string"?new Date(u):u},p=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||p&&m&&Math.abs(m.getTime()-p.getTime())<=864e5;return {id:e.id,name:e.title,startDate:p,endDate:m,progress:e.progress||0,status:$0(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 Fc(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:O0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Lc(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>$n(r,e,t))}var Di={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"}},Si={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"}},On={en:Di,es:Si};function Ei(e){return On[e]||On.en}function zn(e,t){let a=Ei(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}function $c(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(...$c(r.subtasks,t+1));return a}function q0({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 Oc({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n}){let{theme:p="dark",locale:m="en",customTranslations:i,showSearch:u=true,showHierarchy:d=true}=t,g=zn(m,i),h=p==="dark",[C,T]=react.useState(new Set),[c,b]=react.useState("startDate"),[y,l]=react.useState("asc"),[x,v]=react.useState("");react.useMemo(()=>{let M=new Set;function D(I){for(let B of I)B.subtasks?.length&&(M.add(B.id),D(B.subtasks));}D(e),T(M);},[e]);let S=react.useCallback(M=>{T(D=>{let I=new Set(D);return I.has(M)?I.delete(M):I.add(M),I}),a.onTaskToggleExpand?.(M);},[a]),k=react.useCallback(M=>{c===M?l(D=>D==="asc"?"desc":"asc"):(b(M),l("asc")),a.onSortChange?.({column:M,direction:y==="asc"?"desc":"asc"});},[c,y,a]),w=react.useMemo(()=>{let M=$c(e);if(x.trim()){let I=x.toLowerCase();M=M.filter(B=>B.name.toLowerCase().includes(I));}let D=[];for(let I of M){let B=I.level===0;I.level>0&&(B=true),(B||x.trim())&&D.push(I);}return x.trim()&&D.sort((I,B)=>{let K,te;switch(c){case "name":K=I.name.toLowerCase(),te=B.name.toLowerCase();break;case "startDate":K=I.startDate?.getTime()||0,te=B.startDate?.getTime()||0;break;case "endDate":K=I.endDate?.getTime()||0,te=B.endDate?.getTime()||0;break;case "progress":K=I.progress||0,te=B.progress||0;break;case "status":K=I.status||"todo",te=B.status||"todo";break;default:return 0}return K<te?y==="asc"?-1:1:K>te?y==="asc"?1:-1:0}),D},[e,x,c,y]),R=M=>M?(M instanceof Date?M:new Date(M)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[g.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",h?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:g.empty.noTasks}),jsxRuntime.jsx("p",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-hidden",h?"bg-[#0F1117]":"bg-white",s),style:n,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",h?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[u&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:f("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:x,onChange:M=>v(M.target.value),placeholder:g.toolbar.searchPlaceholder,className:f("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",h?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsxs("div",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[w.length," ",g.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:f("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",h?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>k("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>k("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>k("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>k("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>k("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w.map((M,D)=>{let I=C.has(M.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:D*.02},className:f("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",h?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+M.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(M),onDoubleClick:()=>a.onTaskDoubleClick?.(M),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&M.hasChildren&&jsxRuntime.jsx("button",{onClick:B=>{B.stopPropagation(),S(M.id);},className:f("p-0.5 rounded",h?"hover:bg-white/10":"hover:bg-gray-200"),children:I?jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")})}),d&&!M.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:B=>{B.stopPropagation(),a.onTaskUpdate?.({...M,progress:M.progress===100?0:100,status:M.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(q0,{status:M.status,progress:M.progress})}),jsxRuntime.jsx("span",{className:f("truncate",h?"text-white":"text-gray-900",M.progress===100&&(h?"line-through text-[#6B7280]":"line-through text-gray-400")),children:M.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:f("px-2 py-1 rounded-full text-xs font-medium",M.progress===100||M.status==="completed"?"bg-green-500/10 text-green-500":M.progress&&M.progress>0||M.status==="in-progress"?"bg-blue-500/10 text-blue-500":h?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:M.progress===100||M.status==="completed"?g.status.completed:M.progress&&M.progress>0||M.status==="in-progress"?g.status.inProgress:g.status.todo})}),jsxRuntime.jsxs("div",{className:f("col-span-2 flex items-center gap-1 text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),R(M.startDate)]}),jsxRuntime.jsxs("div",{className:f("col-span-2 flex items-center gap-1 text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),R(M.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:f("flex-1 h-1.5 rounded-full overflow-hidden",h?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",M.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${M.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:f("text-xs w-8",h?"text-[#9CA3AF]":"text-gray-500"),children:[M.progress||0,"%"]})]})})]},M.id)})}),w.length===0&&x&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:f("w-12 h-12 mx-auto mb-4",h?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f(h?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.noResults})]})})]})]})}var Pi={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"},Mi={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"},Ai={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"},Hn={dark:Pi,light:Mi,neutral:Ai};function zc(e){return Hn[e]||Hn.dark}var Fi={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"}},Li={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"}},Wn={en:Fi,es:Li};function Wo(e){return Wn[e]||Wn.en}function Gn(e,t){let a=Wo(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 Uc(e){let t=Wo(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 Hc(e,t=0,a=true){let r=Wo(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 gh(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 zi(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 jc({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 Yc({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:p,availableTags:m=[],onCreateTag:i,attachmentsByTask:u,comments:d,onAddComment:g,currentUser:h,onTaskOpen:C}){let{theme:T="dark",locale:c="en",customTranslations:b}=t,y=Gn(c,b),l=T==="dark",x={textTertiary:l?"#6B7280":"#9CA3AF",textSecondary:l?"#9CA3AF":"#6B7280",textPrimary:l?"#FFFFFF":"#111827",borderLight:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:l?"#1A1D25":"#FFFFFF",bgSecondary:l?"#0F1117":"#F9FAFB",hoverBg:l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[v,S]=react.useState(r||new Date),[k,w]=react.useState(null),[R,M]=react.useState(null),[D,I]=react.useState(null),[B,K]=react.useState(new Date),[te,ie]=react.useState({}),de=4,be=3,[$,J]=react.useState(false),[U,G]=react.useState(false),[A,Q]=react.useState(false),[X,H]=react.useState(false),[Ce,Me]=react.useState(null),[Oe,ye]=react.useState(""),[Ye,We]=react.useState(void 0),[et,vt]=react.useState(null),[Mt,mt]=react.useState(false),[O,le]=react.useState(false),[xe,Pe]=react.useState(null),[ze,at]=react.useState(false),[Et,Fe]=react.useState(new Date),[Xt,Ot]=react.useState(false),[Nt,ct]=react.useState(false),[Jt,Ea]=react.useState(false),[oe,ue]=react.useState(""),[pa,ya]=react.useState(false),[N,ee]=react.useState(""),[se,De]=react.useState(false),$e=react.useCallback(()=>{S(new Date(v.getFullYear(),v.getMonth()-1,1));},[v]),tt=react.useCallback(()=>{S(new Date(v.getFullYear(),v.getMonth()+1,1));},[v]),Ge=react.useCallback(()=>{S(new Date);},[]),Be=react.useMemo(()=>{let E=v.getFullYear(),ve=v.getMonth(),q=new Date(E,ve,1),Ae=new Date(E,ve+1,0),ot=q.getDay(),ne=Ae.getDate(),Re=gh(e),xt=new Date;xt.setHours(0,0,0,0);let Le=[],At=ot,st=new Date(E,ve,0).getDate();for(let zt=At-1;zt>=0;zt--){let je=new Date(E,ve-1,st-zt);Le.push({date:je,isCurrentMonth:false,isToday:false,isWeekend:je.getDay()===0||je.getDay()===6,events:Re.filter(kt=>zi(je,kt)).map(kt=>({id:kt.id,title:kt.name,start:kt.startDate,end:kt.endDate,task:kt}))});}for(let zt=1;zt<=ne;zt++){let je=new Date(E,ve,zt),kt=je.getTime()===xt.getTime();Le.push({date:je,isCurrentMonth:true,isToday:kt,isWeekend:je.getDay()===0||je.getDay()===6,events:Re.filter(ia=>zi(je,ia)).map(ia=>({id:ia.id,title:ia.name,start:ia.startDate,end:ia.endDate,task:ia}))});}let ga=42-Le.length;for(let zt=1;zt<=ga;zt++){let je=new Date(E,ve+1,zt);Le.push({date:je,isCurrentMonth:false,isToday:false,isWeekend:je.getDay()===0||je.getDay()===6,events:Re.filter(kt=>zi(je,kt)).map(kt=>({id:kt.id,title:kt.name,start:kt.startDate,end:kt.endDate,task:kt}))});}return Le},[v,e]),rt=c==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],_=v.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),ae=react.useCallback((E,ve)=>{if(!k)return;let q={...k,[E]:ve};w(q),a.onTaskUpdate?.(q);},[k,a]),Ee=react.useCallback(E=>{if(!k)return;let ve=k.progress||0;E==="completed"?ve=100:E==="todo"&&(ve=0);let q={...k,status:E,progress:ve};w(q),a.onTaskUpdate?.(q),J(false);},[k,a]),Ue=react.useCallback((E,ve)=>{if(!k)return;let q={...k,startDate:E,endDate:ve};w(q),a.onTaskUpdate?.(q);},[k,a]),He=react.useCallback(()=>{J(false),G(false),Q(false),I(null),Ea(false),ue(""),ya(false);},[]),W=react.useCallback(async E=>{if(E.preventDefault(),E.stopPropagation(),Ot(false),!k||!a.onUploadAttachments)return;let ve=Array.from(E.dataTransfer.files);if(ve.length!==0){ct(true);try{await a.onUploadAttachments(k.id,ve);}finally{ct(false);}}},[k,a]),ce=react.useCallback(async E=>{if(!k||!a.onUploadAttachments||!E.target.files)return;let ve=Array.from(E.target.files);if(ve.length!==0){ct(true);try{await a.onUploadAttachments(k.id,ve);}finally{ct(false);}E.target.value="";}},[k,a]),Ie=react.useCallback(E=>{E.preventDefault(),E.stopPropagation(),Ot(true);},[]),Dt=react.useCallback(E=>{E.preventDefault(),E.stopPropagation(),Ot(false);},[]),Je=react.useCallback(E=>E<1024?`${E} B`:E<1024*1024?`${(E/1024).toFixed(1)} KB`:`${(E/(1024*1024)).toFixed(1)} MB`,[]),va=react.useCallback(E=>E.startsWith("image/")?lucideReact.Image:E.includes("pdf")||E.includes("document")?lucideReact.FileText:lucideReact.File,[]),ua=react.useMemo(()=>!k||!u?[]:u.get(k.id)||[],[k,u]);return o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:[y.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:y.labels.noEvents}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:y.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-auto",l?"bg-[#0F1117]":"bg-white",n),style:p,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:f("text-xl font-semibold capitalize",l?"text-white":"text-gray-900"),children:_}),jsxRuntime.jsx("button",{onClick:Ge,className:f("px-3 py-1.5 text-sm rounded-lg transition-colors",l?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:y.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:$e,className:f("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:f("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:tt,className:f("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:rt.map(E=>jsxRuntime.jsx("div",{className:f("py-2 text-center text-xs font-medium uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:E},E))}),jsxRuntime.jsx("div",{className:f("grid grid-cols-7 auto-rows-min gap-px rounded-lg",l?"bg-[#2D2D2D]":"bg-gray-300"),children:Be.map((E,ve)=>{let q=E.date.getDay()===0||E.date.getDay()===6;return jsxRuntime.jsxs("div",{className:f("min-h-[120px] p-2 transition-colors flex flex-col relative group",l?q?"bg-[#1C1F26]":E.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":q?"bg-gray-100":E.isCurrentMonth?"bg-white":"bg-gray-50",E.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ae=te[ve]||de,ot=E.events.slice(0,Ae),ne=E.events.length-Ae;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[ot.map(Re=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{w(Re.task),a.onEventClick?.(Re),C?.(Re.task.id);},whileHover:{scale:1.02},className:f("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Re.task.progress===100?l?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":l?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(jc,{task:Re.task}),jsxRuntime.jsx("span",{className:"truncate",children:Re.title})]})},Re.id)),ne>0&&jsxRuntime.jsxs("button",{onClick:Re=>{Re.stopPropagation(),ie(xt=>({...xt,[ve]:Ae+be}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",ne," ",c==="es"?"M\xC1S":"MORE"]}),Ae>de&&E.events.length>de&&jsxRuntime.jsx("button",{onClick:Re=>{Re.stopPropagation(),ie(xt=>({...xt,[ve]:de}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:c==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ae=ve>=28,ot=ve%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:ne=>{ne.stopPropagation(),Ce===ve?Me(null):(Me(ve),ye(""),We(void 0),vt(null),Pe(null),mt(false),le(false),at(false),Fe(E.date));},className:f("w-5 h-5 rounded flex items-center justify-center transition-all",Ce===ve?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",l?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:f("w-3.5 h-3.5 transition-transform",Ce===ve&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ce===ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Me(null),ye(""),We(void 0),vt(null),Pe(null),mt(false),le(false),at(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:f("absolute w-[320px] rounded-lg shadow-2xl z-50",Ae?"bottom-full mb-1":"top-full mt-1",ot?"right-0":"left-0",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>{ne.stopPropagation(),mt(false),le(false),at(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Oe,onChange:ne=>ye(ne.target.value),placeholder:c==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:f("w-full bg-transparent text-sm outline-none placeholder:opacity-40",l?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:ne=>{if(ne.key==="Enter"&&Oe.trim()){let Re=t.availableUsers?.find(Le=>Le.id===et),xt=xe||E.date;a.onTaskCreate?.({name:Oe.trim(),startDate:xt,endDate:xt,priority:Ye,assignees:Re?[Re]:void 0}),ye(""),We(void 0),vt(null),Pe(null),Me(null);}ne.key==="Escape"&&(Me(null),ye(""),We(void 0),vt(null),Pe(null));}})}),jsxRuntime.jsxs("div",{className:f("px-2.5 py-2 flex items-center justify-between border-t",l?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:ne=>{ne.stopPropagation(),mt(!Mt),le(false);},className:f("p-1 rounded transition-colors",Ye?Ye==="urgent"||Ye==="high"?"text-red-400 bg-red-500/20":Ye==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Mt&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>ne.stopPropagation(),children:[{id:"urgent",label:c==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:c==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:c==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:c==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:c==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(ne=>jsxRuntime.jsxs("button",{onClick:()=>{We(ne.id),mt(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",Ye===ne.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",ne.color)}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:ne.label})]},ne.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:ne=>{ne.stopPropagation(),at(!ze),mt(false),le(false),Fe(xe||E.date);},className:f("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",xe?"bg-[#7C3AED]/20 text-[#7C3AED]":l?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(xe||E.date).toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ze&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>ne.stopPropagation(),children:[jsxRuntime.jsx("div",{className:f("w-40 py-2 border-r",l?"border-white/10":"border-gray-200"),children:(()=>{let ne=new Date,Re=new Date(ne);Re.setDate(ne.getDate()+1);let xt=new Date(ne);xt.setDate(ne.getDate()+((6-ne.getDay()+7)%7||7));let Le=new Date(ne);Le.setDate(ne.getDate()+((1-ne.getDay()+7)%7||7));let At=new Date(ne);At.setDate(ne.getDate()+14);let st=new Date(ne);return st.setDate(ne.getDate()+28),[{label:c==="es"?"Hoy":"Today",date:ne,display:ne.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Ma\xF1ana":"Tomorrow",date:Re,display:Re.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Este fin de semana":"This weekend",date:xt,display:c==="es"?"s\xE1b.":"sat."},{label:c==="es"?"Pr\xF3xima semana":"Next week",date:Le,display:c==="es"?"lun.":"mon."},{label:c==="es"?"2 semanas":"2 weeks",date:At,display:At.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"4 semanas":"4 weeks",date:st,display:st.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((zt,je)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Pe(zt.date),at(false);},children:[jsxRuntime.jsx("span",{children:zt.label}),jsxRuntime.jsx("span",{className:f("text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:zt.display})]},je))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:f("text-xs font-medium",l?"text-white":"text-gray-900"),children:Et.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Fe(new Date),className:f("px-1.5 py-0.5 rounded text-[10px] transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:c==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Fe(new Date(Et.getFullYear(),Et.getMonth()-1)),className:f("p-0.5 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Fe(new Date(Et.getFullYear(),Et.getMonth()+1)),className:f("p-0.5 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(c==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(ne=>jsxRuntime.jsx("div",{className:f("w-6 h-6 flex items-center justify-center text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:ne},ne))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ne=Et.getFullYear(),Re=Et.getMonth(),xt=new Date(ne,Re,1).getDay(),Le=new Date(ne,Re+1,0).getDate(),At=new Date(ne,Re,0).getDate(),st=new Date,ga=[];for(let je=xt-1;je>=0;je--)ga.push({dayNum:At-je,isCurrentMonth:false,date:new Date(ne,Re-1,At-je)});for(let je=1;je<=Le;je++)ga.push({dayNum:je,isCurrentMonth:true,date:new Date(ne,Re,je)});let zt=42-ga.length;for(let je=1;je<=zt;je++)ga.push({dayNum:je,isCurrentMonth:false,date:new Date(ne,Re+1,je)});return ga.map((je,kt)=>{let ia=je.date.toDateString()===st.toDateString(),vr=(xe||E.date).toDateString()===je.date.toDateString();return jsxRuntime.jsx("button",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!je.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),je.isCurrentMonth&&(l?"text-white":"text-gray-900"),ia&&"ring-1 ring-[#3B82F6]",vr&&"bg-[#7C3AED] text-white",!vr&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Pe(je.date),at(false);},children:je.dayNum},kt)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:ne=>{ne.stopPropagation(),le(!O),mt(false);},className:f("p-1 rounded transition-colors",et?"text-[#7C3AED] bg-[#7C3AED]/20":l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:et?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(ne=>ne.id===et)?.color||"#7C3AED"},children:t.availableUsers?.find(ne=>ne.id===et)?.initials||t.availableUsers?.find(ne=>ne.id===et)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:O&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:ne=>ne.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{vt(null),le(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",!et&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded-full flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:l?"text-[#9CA3AF]":"text-gray-500",children:c==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(ne=>jsxRuntime.jsxs("button",{onClick:()=>{vt(ne.id),le(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",et===ne.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:ne.color||"#7C3AED"},children:ne.initials||ne.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:ne.name})]},ne.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:f("px-3 py-2 text-xs",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Oe.trim()){let ne=t.availableUsers?.find(xt=>xt.id===et),Re=xe||E.date;a.onTaskCreate?.({name:Oe.trim(),startDate:Re,endDate:Re,priority:Ye,assignees:ne?[ne]:void 0}),ye(""),We(void 0),vt(null),Pe(null),Me(null);}},disabled:!Oe.trim(),className:f("px-2.5 py-1 rounded text-xs font-medium transition-colors",Oe.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":l?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:c==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:f("text-sm font-medium",E.isToday?"text-[#3B82F6]":E.isCurrentMonth?l?"text-white":"text-gray-900":l?"text-[#6B7280]":"text-gray-400"),children:E.date.getDate()})]})]},ve)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>{w(null),ee("");},className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:f("w-4 h-4",l?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[c==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:f("text-xs font-mono",l?"text-[#6B7280]":"text-gray-400"),children:k.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",l?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>{w(null),ee("");},className:f("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let E=k.progress===100?0:100,q={...k,progress:E,status:E===100?"completed":"todo"};w(q),a.onTaskUpdate?.(q);},className:f("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",k.progress===100?"bg-green-500 border-green-500":l?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:k.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:f("text-xl font-semibold flex-1",k.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:k.name})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{He(),J(!$);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",k.progress===100||k.status==="completed"?"bg-green-500/20 text-green-400":k.progress&&k.progress>0||k.status==="in-progress"?"bg-blue-500/20 text-blue-400":l?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:k.progress===100||k.status==="completed"?c==="es"?"COMPLETADO":"DONE":k.progress&&k.progress>0||k.status==="in-progress"?c==="es"?"EN PROGRESO":"IN PROGRESS":c==="es"?"POR HACER":"TO DO"}),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:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:c==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:c==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:c==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(E=>jsxRuntime.jsxs("button",{onClick:()=>Ee(E.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",(k.status===E.id||E.id==="completed"&&k.progress===100||E.id==="in-progress"&&k.progress&&k.progress>0&&k.progress<100||E.id==="todo"&&(!k.progress||k.progress===0)&&k.status!=="in-progress"&&k.status!=="completed")&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",E.id==="completed"?"bg-green-500":E.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:E.label})]},E.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{J(false),G(false),I(null),Q(!A);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[k.assignees&&k.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[k.assignees.slice(0,3).map((E,ve)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:E.color||"#8B5CF6"},title:E.name,children:E.initials||E.name.slice(0,2).toUpperCase()},ve)),k.assignees.length>3&&jsxRuntime.jsxs("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:["+",k.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:f("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:A&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Q(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(E=>{let ve=k.assignees?.some(q=>q.name===E.name);return jsxRuntime.jsxs("button",{onClick:()=>{let q=k.assignees||[],Ae;ve?Ae=q.filter(ot=>ot.name!==E.name):Ae=[...q,{name:E.name,avatar:E.avatar,initials:E.initials||E.name.slice(0,2).toUpperCase(),color:E.color||"#8B5CF6"}],ae("assignees",Ae);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50",ve&&(l?"bg-white/5":"bg-gray-50")),children:[E.avatar?jsxRuntime.jsx("img",{src:E.avatar,alt:E.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:E.color||"#8B5CF6"},children:E.initials||E.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:f("flex-1 text-left",l?"text-white":"text-gray-900"),children:E.name}),ve&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},E.id||E.name)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{I(D?null:"start"),K(k.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[k.startDate?.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(c==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:f("mx-1",l?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),k.endDate?.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(c==="es"?"Fin":"End"),(k.startDate||k.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:E=>{E.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>I(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:f("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:f("w-44 py-2 border-r",l?"border-white/10":"border-gray-200"),children:[(()=>{let E=new Date,ve=new Date(E);ve.setDate(E.getDate()+1);let q=new Date(E);q.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let Ae=new Date(E);Ae.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let ot=new Date(E);ot.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let ne=new Date(E);ne.setDate(E.getDate()+14);let Re=new Date(E);return Re.setDate(E.getDate()+28),[{label:c==="es"?"Hoy":"Today",date:E,display:E.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Ma\xF1ana":"Tomorrow",date:ve,display:ve.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Este fin de semana":"This weekend",date:q,display:c==="es"?"s\xE1b.":"sat."},{label:c==="es"?"Pr\xF3xima semana":"Next week",date:Ae,display:c==="es"?"lun.":"mon."},{label:c==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ot,display:ot.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"2 semanas":"2 weeks",date:ne,display:ne.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"4 semanas":"4 weeks",date:Re,display:Re.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Le,At)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(D==="start"){let st=k.endDate&&Le.date>k.endDate?Le.date:k.endDate;Ue(Le.date,st),I("end");}else {let st=k.startDate&&Le.date<k.startDate?Le.date:k.startDate;Ue(st,Le.date),I(null);}},children:[jsxRuntime.jsx("span",{children:Le.label}),jsxRuntime.jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:Le.display})]},At))})(),jsxRuntime.jsx("div",{className:f("border-t mt-2 pt-2",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Ue(void 0,void 0),I(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:c==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:f("text-xs mb-3 px-2 py-1 rounded",l?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:D==="start"?c==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":c==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:f("font-medium",l?"text-white":"text-gray-900"),children:B.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>K(new Date),className:f("p-1 rounded text-sm transition-colors",l?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:c==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>K(new Date(B.getFullYear(),B.getMonth()-1)),className:f("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>K(new Date(B.getFullYear(),B.getMonth()+1)),className:f("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(c==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(E=>jsxRuntime.jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",l?"text-[#6B7280]":"text-gray-400"),children:E},E))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let E=B.getFullYear(),ve=B.getMonth(),q=new Date(E,ve,1).getDay(),Ae=new Date(E,ve+1,0).getDate(),ot=new Date(E,ve,0).getDate(),ne=new Date,Re=[];for(let Le=q-1;Le>=0;Le--)Re.push({day:ot-Le,isCurrentMonth:false,date:new Date(E,ve-1,ot-Le)});for(let Le=1;Le<=Ae;Le++)Re.push({day:Le,isCurrentMonth:true,date:new Date(E,ve,Le)});let xt=42-Re.length;for(let Le=1;Le<=xt;Le++)Re.push({day:Le,isCurrentMonth:false,date:new Date(E,ve+1,Le)});return Re.map((Le,At)=>{let st=Le.date.toDateString()===ne.toDateString(),ga=k.startDate?.toDateString()===Le.date.toDateString(),zt=k.endDate?.toDateString()===Le.date.toDateString(),je=ga||zt,kt=k.startDate&&k.endDate&&Le.date>=k.startDate&&Le.date<=k.endDate;return jsxRuntime.jsx("button",{className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Le.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),Le.isCurrentMonth&&(l?"text-white":"text-gray-900"),st&&"ring-2 ring-[#3B82F6]",ga&&"bg-[#3B82F6] text-white",zt&&!ga&&"bg-[#7C3AED] text-white",kt&&!je&&(l?"bg-[#7C3AED]/20":"bg-purple-100"),!je&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let ia=new Date(Le.date);if(D==="start"){let vr=k.endDate&&ia>k.endDate?ia:k.endDate;Ue(ia,vr),I("end");}else {let vr=k.startDate&&ia<k.startDate?ia:k.startDate;Ue(vr,ia),I(null);}},children:Le.day},At)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{He(),G(!U);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",k.priority==="high"||k.priority==="urgent"?"bg-red-500/20 text-red-400":k.priority==="medium"?"bg-yellow-500/20 text-yellow-400":k.priority==="low"?"bg-green-500/20 text-green-400":l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:k.priority?k.priority==="high"||k.priority==="urgent"?c==="es"?"Urgente":"Urgent":k.priority==="medium"?c==="es"?"Media":"Medium":c==="es"?"Baja":"Low":c==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>G(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:c==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:c==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:c==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:c==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:c==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(E=>jsxRuntime.jsxs("button",{onClick:()=>{ae("priority",E.id),G(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",k.priority===E.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",E.color)}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:E.label})]},E.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:k.startDate&&k.endDate?`${Math.ceil((k.endDate.getTime()-k.startDate.getTime())/(1e3*60*60*24))} ${c==="es"?"d\xEDas":"days"}`:c==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full border-2",l?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[X?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:k.progress||0,onChange:E=>{let ve=parseInt(E.target.value),q=k.status;ve===100?q="completed":ve>0?q="in-progress":q="todo";let Ae={...k,progress:ve,status:q};w(Ae),a.onTaskUpdate?.(Ae);},onBlur:()=>H(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",l?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>H(true),className:f("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",k.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${k.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium min-w-[40px]",l?"text-white":"text-gray-900"),children:[k.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(nr,{selectedTags:k.tags||[],availableTags:m,onChange:E=>{ae("tags",E);},onCreateTag:i,theme:x})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:f("w-4 h-4 mt-1.5",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24 mt-1",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[k.dependencies&&k.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:k.dependencies.map(E=>{let ve=e.find(q=>q.id===E);return jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",l?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ve?.name||E.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let q=(k.dependencies||[]).filter(Ae=>Ae!==E);ae("dependencies",q);},className:f("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},E)})}),jsxRuntime.jsxs("button",{onClick:()=>{He(),Ea(!Jt);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Jt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ea(false),ue("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("p-2 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:oe,onChange:E=>ue(E.target.value),placeholder:c==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",l?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:e.length>0?e.filter(E=>E.id!==k.id).filter(E=>oe===""||E.name.toLowerCase().includes(oe.toLowerCase())).map(E=>{let ve=k.dependencies?.includes(E.id);return jsxRuntime.jsxs("button",{onClick:()=>{let q=k.dependencies||[],Ae;ve?Ae=q.filter(ot=>ot!==E.id):Ae=[...q,E.id],ae("dependencies",Ae);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",ve&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ve?"bg-blue-500 border-blue-500":l?"border-white/30":"border-gray-300"),children:ve&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:f("block truncate",l?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:E.id.slice(0,8)})]})]},E.id)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-500"),children:c==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{He(),ya(!pa);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:k.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:sr.find(E=>E.value===k.color)?.name||(c==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:pa&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ya(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:sr.map(E=>{let ve=k.color===E.value;return jsxRuntime.jsx("button",{onClick:()=>{ae("color",E.value),ya(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",ve&&"ring-2 ring-offset-2",l?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:E.value,outlineColor:ve?E.value:void 0},title:E.name,children:ve&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},E.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:k.isMilestone||false,onChange:E=>ae("isMilestone",E.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",k.isMilestone?"bg-purple-500 border-purple-500":l?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:c==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:c==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:k.description||"",onChange:E=>ae("description",E.target.value),placeholder:c==="es"?"Agregar descripci\xF3n...":"Add description...",className:f("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",l?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-2 text-sm mt-2 transition-colors",l?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),c==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:c==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),c==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:c==="es"?"Agregar subtarea":"Add subtask"}),k.subtasks&&k.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:k.subtasks.map(E=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",E.progress===100?"bg-green-500 border-green-500":l?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:E.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:f("text-sm",E.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:E.name})]},E.id))}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),c==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:c==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:f("p-1 rounded transition-colors",l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),c==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:[c==="es"?"Adjuntos":"Attachments",ua.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",ua.length,")"]})]}),ua.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:ua.map(E=>{let ve=va(E.type),q=E.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[q&&E.thumbnailUrl?jsxRuntime.jsx("img",{src:E.thumbnailUrl,alt:E.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(ve,{className:f("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:f("text-sm font-medium truncate block hover:underline",l?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("p",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:Je(E.size)})]}),a.onDeleteAttachment&&jsxRuntime.jsx("button",{onClick:()=>a.onDeleteAttachment?.(E.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",l?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:c==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},E.id)})}),jsxRuntime.jsxs("div",{onDragOver:Ie,onDragLeave:Dt,onDrop:W,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Xt?l?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":l?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",Nt&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:ce,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||Nt}),Nt?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:f("w-6 h-6 mx-auto mb-2",Xt?"text-blue-500":l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:Xt?c==="es"?"Suelta los archivos aqu\xED":"Drop files here":c==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!a.onUploadAttachments&&jsxRuntime.jsx("p",{className:f("text-xs mt-1",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:f("w-80 border-l flex flex-col",l?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:[c==="es"?"Actividad":"Activity",d&&d.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d&&d.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:d.map(E=>{let ve=(()=>{let q=new Date,Ae=new Date(E.createdAt),ot=q.getTime()-Ae.getTime(),ne=Math.floor(ot/6e4),Re=Math.floor(ne/60),xt=Math.floor(Re/24);return ne<1?c==="es"?"ahora":"now":ne<60?c==="es"?`hace ${ne}m`:`${ne}m ago`:Re<24?c==="es"?`hace ${Re}h`:`${Re}h ago`:c==="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:E.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:f("text-sm font-medium",l?"text-white":"text-gray-900"),children:E.user?.name||(c==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:ve})]}),jsxRuntime.jsx("p",{className:f("text-sm break-words",l?"text-[#9CA3AF]":"text-gray-600"),children:E.content})]})]},E.id)})}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:f("w-10 h-10 mb-3",l?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#6B7280]":"text-gray-500"),children:c==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:f("p-4 border-t",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[h&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:h.color||"#8B5CF6"},children:h.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:f("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",l?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",value:N,onChange:E=>ee(E.target.value),onKeyDown:async E=>{if(E.key==="Enter"&&!E.shiftKey&&k&&N.trim()&&g){E.preventDefault(),De(true);try{await g(k.id,N.trim()),ee("");}finally{De(false);}}},placeholder:c==="es"?"Escribe un comentario...":"Write a comment...",disabled:se||!g,className:f("flex-1 bg-transparent text-sm outline-none",l?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(se||!g)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:async()=>{if(k&&N.trim()&&g){De(true);try{await g(k.id,N.trim()),ee("");}finally{De(false);}}},disabled:se||!N.trim()||!g,className:f("p-1.5 rounded transition-colors",N.trim()&&g?"bg-blue-500 text-white hover:bg-blue-600":l?"text-[#6B7280]":"text-gray-400",se&&"opacity-50 cursor-not-allowed"),children:se?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:R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>M(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:f("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:f("px-4 py-3 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:f("font-medium",l?"text-white":"text-gray-900"),children:R.date.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>M(null),className:f("p-1 rounded",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:R.events.map(E=>jsxRuntime.jsxs("button",{onClick:()=>{M(null),w(E.task),C?.(E.task.id);},className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(jc,{task:E.task}),jsxRuntime.jsx("span",{className:f("text-sm truncate flex-1",l?"text-white":"text-gray-900"),children:E.title}),E.task.priority==="high"||E.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},E.id))})]})]})})]})}var Ui={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"},Hi={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"},Wi={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"},Vn={dark:Ui,light:Hi,neutral:Wi};function qc(e){return Vn[e]||Vn.dark}function hh({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:p}){let[m,i]=react.useState(false),u=react.useMemo(()=>t.filter(h=>e.cardIds.includes(h.id)),[t,e.cardIds]),d=react.useMemo(()=>{let h=u.length,C=new Set(u.flatMap(b=>b.assignedUserIds||[])).size,T=u.map(b=>b.priority).filter(Boolean),c=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:h,uniqueAssignees:C,priorities:T,labels:c}},[u]),g=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:f("card-stack",!e.isExpanded&&"card-stack-collapsed",p),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:g,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:f("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:h=>{h.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:u.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:u.map(h=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(h),children:a(h)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(h),children:[jsxRuntime.jsx("h4",{children:h.title}),h.description&&jsxRuntime.jsxs("p",{children:[h.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:C=>{C.stopPropagation(),s?.(e.id,h.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},h.id))})})]})}var Jc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Vo(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 jo(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 Qc(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function Zc({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:p}){let m=react.useMemo(()=>({...Jc,...n}),[n]),[i,u]=react.useState(new Set),d=react.useRef(null),g=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(l=>{let x=l.timestamp.toISOString().split("T")[0],v=y.get(x);v?v.push(l):y.set(x,[l]);}),Array.from(y.entries()).sort((l,x)=>x[0].localeCompare(l[0])).map(([l,x])=>({date:new Date(l),events:x.sort((v,S)=>S.timestamp.getTime()-v.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:h,uniqueTypes:C}=react.useMemo(()=>{let y=new Set,l=new Set;return e.forEach(x=>{y.add(x.userId),l.add(x.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(l)}},[e]),T=y=>{u(l=>{let x=new Set(l);return x.has(y)?x.delete(y):x.add(y),x});},c=y=>{let x=new Date().getTime()-y.getTime(),v=Math.floor(x/6e4),S=Math.floor(x/36e5),k=Math.floor(x/864e5);return v<1?"just now":v<60?`${v}m ago`:S<24?`${S}h ago`:k<7?`${k}d ago`:y.toLocaleDateString()},b=react.useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return react.useEffect(()=>{if(s&&d.current){let y=d.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:f("history-timeline-empty",p),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:f("history-timeline",m.compact&&"compact",p),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let l=y.target.value;a({...t,types:l?[l]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),C.map(y=>jsxRuntime.jsxs("option",{value:y,children:[jo(y)," ",y.replace("_"," ")]},y))]}),h.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let l=y.target.value;a({...t,users:l?[l]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),h.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>a({...t,searchTerm:y.target.value})})]}),b>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:g.map(y=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&y.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:y.events.map((l,x)=>{let v=i.has(l.id),S=s===l.id,k=Qc(l.type);return jsxRuntime.jsxs("div",{"data-event-id":l.id,className:f("history-timeline-event",v&&"expanded",S&&"selected"),onClick:()=>o?.(l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:k},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:jo(l.type)})}),x<y.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:k}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&l.userAvatar&&jsxRuntime.jsx("img",{src:l.userAvatar,alt:l.userName||l.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:l.userName||l.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Vo(l)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?c(l.timestamp):l.timestamp.toLocaleString()})]}),Object.keys(l.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),T(l.id);},children:[v?"\u25BC":"\u25B6"," Show changes"]}),v&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(l.changes).map(([w,R])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(R.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(R.to)})]})]},w)),l.metadata&&Object.keys(l.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(l.metadata).map(([w,R])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(R)})]},w))]})]})]})]},l.id)})})]},y.date?.toISOString()||"all"))})]})}function tm({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:p,onSpeedChange:m,className:i}){let u=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),g=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:f("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:f("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&jo(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&Vo(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:h=>p(parseInt(h.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${g}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((h,C)=>jsxRuntime.jsx("div",{className:f("history-replay-progress-marker",C===e.currentIndex&&"active"),style:{left:`${C/(e.totalEvents-1)*100}%`},onClick:()=>p(C),title:Vo(h)},h.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:u.map(h=>jsxRuntime.jsxs("button",{className:f("history-replay-speed-btn",e.speed===h&&"active"),onClick:()=>m(h),children:[h,"x"]},h))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(h=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:h},h))})]})]})]})]}):jsxRuntime.jsxs("div",{className:f("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Gi(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 _i(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 am(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 rm(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function wh(e,t,a,r,o,s=100){let n=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),p=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(u=>{let d=a/2,g=r/2;u.vx+=(d-u.x)*o.centerForce*i,u.vy+=(g-u.y)*o.centerForce*i,n.forEach(h=>{if(u.id===h.id)return;let C=u.x-h.x,T=u.y-h.y,c=Math.sqrt(C*C+T*T)||1,b=o.chargeStrength*i/(c*c);u.vx+=C/c*b,u.vy+=T/c*b;});}),t.forEach(u=>{let d=p.get(typeof u.source=="string"?u.source:u.source.id),g=p.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!g)return;let h=g.x-d.x,C=g.y-d.y,T=Math.sqrt(h*h+C*C)||1,c=(T-o.linkDistance)/T*o.forceStrength*i;d.vx+=h*c,d.vy+=C*c,g.vx-=h*c,g.vy-=C*c;}),n.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return n}function om({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:p,className:m}){let i=react.useRef(null),[u,d]=react.useState([]),[g,h]=react.useState(null),[C,T]=react.useState(null),[c,b]=react.useState(null),[y,l]=react.useState(1),[x,v]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let B=wh(e,t,a.width,a.height,a,150);d(B);},[e,t,a]);let S=react.useCallback((B,K)=>{a.enableDragging&&(K.stopPropagation(),h(B));},[a.enableDragging]),k=react.useCallback(B=>{if(!g||!i.current)return;let te=i.current.getBoundingClientRect(),ie=(B.clientX-te.left-x.x)/y,de=(B.clientY-te.top-x.y)/y;d(be=>be.map($=>$.id===g?{...$,x:ie,y:de,fx:ie,fy:de}:$));},[g,y,x]),w=react.useCallback(()=>{h(null);},[]),R=react.useCallback((B,K)=>{K.stopPropagation(),p?.({type:"node-click",node:B,position:{x:K.clientX,y:K.clientY}});},[p]),M=react.useCallback((B,K)=>{K.stopPropagation(),p?.({type:"edge-click",edge:B,position:{x:K.clientX,y:K.clientY}});},[p]),D=react.useCallback(B=>{let K=u.find(te=>te.id===B);return K?{x:K.x,y:K.y}:{x:0,y:0}},[u]),I=react.useCallback(B=>{if(B.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return B.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let K=B.card.priority;return K==="URGENT"?"#ef4444":K==="HIGH"?"#f59e0b":K==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return B.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:f("relationships-graph-empty",m),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:f("relationships-graph",m),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>l(B=>Math.min(B+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>l(B=>Math.max(B-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{l(1),v({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(B=>B.type))).map(B=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Gi(B)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[am(B)," ",_i(B)]})]},B))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:k,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${y})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(B=>{let K=D(typeof B.source=="string"?B.source:B.source.id),te=D(typeof B.target=="string"?B.target:B.target.id),ie=rm(B.type),de=c===B.id,be=B.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-edge",de&&"hovered",be&&"critical"),onMouseEnter:()=>b(B.id),onMouseLeave:()=>b(null),onClick:$=>M(B,$),children:[jsxRuntime.jsx("line",{x1:K.x,y1:K.y,x2:te.x,y2:te.y,stroke:Gi(B.type),strokeWidth:be?a.edgeWidth*2:a.edgeWidth,strokeOpacity:de?1:.6,markerEnd:ie?"url(#arrowhead)":void 0}),a.showEdgeLabels&&de&&jsxRuntime.jsx("text",{x:(K.x+te.x)/2,y:(K.y+te.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:_i(B.type)})]},B.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(B=>{let K=C===B.id,te=B.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-node",K&&"hovered",te&&"critical"),transform:`translate(${B.x}, ${B.y})`,onMouseDown:ie=>S(B.id,ie),onMouseEnter:()=>T(B.id),onMouseLeave:()=>T(null),onClick:ie=>R(B,ie),children:[jsxRuntime.jsx("circle",{r:te?a.nodeSize*1.2:a.nodeSize,fill:I(B),stroke:te?"#fbbf24":"#ffffff",strokeWidth:te?3:2,opacity:K?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:B.card.title.length>20?B.card.title.substring(0,20)+"...":B.card.title})]},B.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 im({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[p,m]=react.useState(false),[i,u]=react.useState(null),[d,g]=react.useState(null),h=react.useRef(null),C=p||o;react.useEffect(()=>{e&&h.current&&h.current.focus();},[e]),react.useEffect(()=>{let y=l=>{l.key==="Escape"&&!C&&T();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,C]);let T=()=>{C||(n(""),u(null),g(null),t());},c=async()=>{if(!(!s.trim()||C)){m(true),u(null),g(null);try{let y=await r(s.trim());g(y);}catch(y){u(y instanceof Error?y.message:"Failed to generate plan");}finally{m(false);}}},b=()=>{d&&(a(d),T());};return e?jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:T}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-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:y=>y.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:T,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((y,l)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:y.title},l))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((y,l)=>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:y.title}),y.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="URGENT"?"bg-red-500/20 text-red-400":y.priority==="HIGH"?"bg-orange-500/20 text-orange-400":y.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:y.priority})]})},l)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:h,value:s,onChange:y=>n(y.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:C}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,l)=>jsxRuntime.jsx("button",{onClick:()=>n(y),disabled:C,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:y},l))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:C&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:T,disabled:C,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick: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:c,disabled:!s.trim()||C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:C?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Vi={"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 Th={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Nh={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 Dh(e,t,a){let r=Vi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Ko(e){return `$${e.toFixed(4)}`}var ji=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Dh(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,g)=>d+g.cost,0),s=a.reduce((d,g)=>d+g.inputTokens,0),n=a.reduce((d,g)=>d+g.outputTokens,0),p=a.filter(d=>d.success),m=a.reduce((d,g)=>d+g.duration,0),i={},u={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?m/r:0,successRate:r>0?p.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let p=this.operations.filter(u=>u.timestamp>=n).length,m=Math.max(0,o-p),i=p/o*100;return {used:p,limit:o,remaining:m,percentUsed:i,isExceeded:p>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Qr=new ji;function cm({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Qr.getStats()),[s,n]=react.useState(Qr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(Qr.getStats()),n(Qr.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let p=Qr.getRecentOperations(5);return jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:m=>m.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ko(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([m,i])=>{let u=r.costsByFeature[m]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:m.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ko(u)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),p.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:p.map(m=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ko(m.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function um({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,p]=react.useState(""),[m,i]=react.useState(""),[u,d]=react.useState(""),[g,h]=react.useState(false),[C,T]=react.useState(null),[c,b]=react.useState(null),[y,l]=react.useState(null),x=react.useRef(null),v=g||o;react.useEffect(()=>{e&&x.current&&x.current.focus();},[e]),react.useEffect(()=>{let M=D=>{D.key==="Escape"&&!v&&S();};if(e)return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,v]);let S=()=>{v||(p(""),i(""),d(""),T(null),b(null),l(null),t());},k=async()=>{if(!(!n.trim()||v)){h(true),T(null),b(null),l(null);try{let M=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:u||void 0});b(M.tasks.tasks),l({from_cache:M.from_cache,tokens_used:M.tokens_used,mock_mode:M.mock_mode,similarity:M.similarity,tokens_saved:M.tokens_saved});}catch(M){T(M instanceof Error?M.message:"Failed to generate tasks");}finally{h(false);}}},w=()=>{c&&(a(c),S());};if(!e)return null;let R=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:S}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:M=>M.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:S,disabled:v,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:c?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[y?.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"}),y?.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 (",R,"% 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:[y?.tokens_used||0," tokens"]}),y?.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:[y.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:[c.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:c.map((M,D)=>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:["#",D+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:M.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),M.start," \u2192 ",M.end]}),jsxRuntime.jsxs("span",{children:[M.duration," days"]}),M.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",M.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${M.priority==="high"?"bg-red-500/20 text-red-400":M.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:M.priority})]})},M.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:x,value:n,onChange:M=>p(M.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:v}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:M=>i(M.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:v})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:M=>d(M.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:v})]})]}),C&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:C}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((M,D)=>jsxRuntime.jsx("button",{onClick:()=>p(M),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:M},D))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:v&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:S,disabled:v,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),c?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:k,disabled:!n.trim()||v,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:v?"Generating...":"Generate Tasks"})]})]})]})})]})}function Yn({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(c=>{t&&an(()=>Promise.resolve(t(c)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,l)=>{console.warn(`Retry attempt ${y} after ${l}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=react.useCallback(async(c,b,y)=>{r(l=>{let x=l.cards.find(M=>M.id===c);if(!x)return l;let v=x.columnId,S={...x,columnId:b,position:y},k=l.cards.map(M=>M.id===c?S:M),w=l.columns.map(M=>{if(M.id===v)return {...M,cardIds:M.cardIds.filter(D=>D!==c)};if(M.id===b){let D=k.filter(I=>I.columnId===b).sort((I,B)=>I.position-B.position);return {...M,cardIds:D.map(I=>I.id)}}return M}),R={...l,cards:k,columns:w};return o(R),R});},[o]),n=react.useCallback(async(c,b)=>{r(y=>{let l=y.cards.map(v=>v.id===c?{...v,...b}:v),x={...y,cards:l};return o(x),x});},[o]),p=react.useCallback(async c=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let l={...c,id:b},x=y.columns.map(S=>S.id===c.columnId?{...S,cardIds:[...S.cardIds,b]}:S),v={...y,cards:[...y.cards,l],columns:x};return o(v),v});},[o]),m=react.useCallback(async c=>{r(b=>{let y=b.cards.find(S=>S.id===c);if(!y)return b;let l=b.cards.filter(S=>S.id!==c),x=b.columns.map(S=>S.id===y.columnId?{...S,cardIds:S.cardIds.filter(k=>k!==c)}:S),v={...b,cards:l,columns:x};return o(v),v});},[o]),i=react.useCallback(async c=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let l={...c,id:b,cardIds:[]},x={...y,columns:[...y.columns,l]};return o(x),x});},[o]),u=react.useCallback(async(c,b)=>{r(y=>{let l=y.columns.map(v=>v.id===c?{...v,...b}:v),x={...y,columns:l};return o(x),x});},[o]),d=react.useCallback(async c=>{r(b=>{let y=b.cards.filter(v=>v.columnId!==c),l=b.columns.filter(v=>v.id!==c),x={...b,cards:y,columns:l};return o(x),x});},[o]),g=react.useCallback(c=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return p(c),b},[p]),h=react.useCallback(c=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(c),b},[i]),C=react.useCallback(()=>{r(c=>{let b={...c,cards:[],columns:[]};return o(b),b});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:p,onCardDelete:m,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:d},setBoard:r,helpers:{addCard:g,addColumn:h,deleteCard:m,deleteColumn:d,clearBoard:C}}}function fm({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Yn({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(m,i,u={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(d=>d.columnId===m).length,...u});},addColumn:(m,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:m,position:i??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var Yo={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},bm={by:"none",order:"asc"};function ym({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Yo,...e}),[s,n]=react.useState({...bm,...t}),p=react.useCallback(T=>{o(c=>({...c,...T}));},[]),m=react.useCallback(T=>{n(c=>({...c,...T}));},[]),i=react.useCallback(()=>{o(Yo),n(bm);},[]),u=react.useCallback(()=>{a&&o({...Yo,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Yo,dateFilter:"overdue"});},[]),g=react.useCallback(()=>{o({...Yo,priorities:["HIGH","URGENT"]});},[]),h=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),C=react.useCallback(T=>{let c=[...T];if(r.search){let b=r.search.toLowerCase();c=c.filter(y=>y.title.toLowerCase().includes(b)||y.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,y=b.getFullYear(),l=String(b.getMonth()+1).padStart(2,"0"),x=String(b.getDate()).padStart(2,"0"),v=`${y}-${l}-${x}`;c=c.filter(S=>{if(!S.endDate&&!S.dueDate)return false;let k=S.endDate||S.dueDate;if(!k)return false;let w;if(typeof k=="string")w=k.split("T")[0]||k;else {let R=k.getUTCFullYear(),M=String(k.getUTCMonth()+1).padStart(2,"0"),D=String(k.getUTCDate()).padStart(2,"0");w=`${R}-${M}-${D}`;}switch(r.dateFilter){case "overdue":return w<v;case "today":return w===v;case "this-week":let R=new Date(v+"T00:00:00"),M=new Date(w+"T00:00:00"),D=new Date(R);return D.setDate(D.getDate()+7),M>=R&&M<=D;case "custom":if(r.dateRange){let I=typeof k=="string"?new Date(k):k;return I>=r.dateRange.start&&I<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(c=c.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(c=c.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(l=>r.assignees.includes(l)))),r.labels.length>0&&(c=c.filter(b=>b.labels&&b.labels.some(y=>r.labels.includes(y)))),r.columns.length>0&&(c=c.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&c.sort((b,y)=>{let l=0;switch(s.by){case "created":let x=b.createdAt?new Date(b.createdAt).getTime():0,v=y.createdAt?new Date(y.createdAt).getTime():0;l=x-v;break;case "priority":let S={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},k=S[b.priority||"LOW"],w=S[y.priority||"LOW"];l=k-w;break;case "dueDate":let R=b.endDate||b.dueDate,M=y.endDate||y.dueDate;if(!R)return 1;if(!M)return -1;let D=typeof R=="string"?new Date(R).getTime():R.getTime(),I=typeof M=="string"?new Date(M).getTime():M.getTime();l=D-I;break;case "title":l=b.title.localeCompare(y.title);break;case "estimate":let B=b.estimatedTime||0,K=y.estimatedTime||0;l=B-K;break;default:l=0;}return s.order==="asc"?l:-l}),c},[r,s]);return {filters:r,sort:s,setFilters:p,setSort:m,resetFilters:i,filterMyTasks:u,filterOverdue:d,filterHighPriority:g,applyFilters:C,hasActiveFilters:h}}var xm,km;if(typeof window<"u")try{let e=Zo("ai");xm=e.generateObject,km=e.generateText;}catch{}function wm(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(xm&&km&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(g){let h=g instanceof Error?g:new Error("Failed to generate plan");throw o(h),h}finally{a(false);}},[s]),p=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(g){let h=g instanceof Error?g:new Error("Failed to suggest assignee");throw o(h),h}finally{a(false);}},[s]),m=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(g){let h=g instanceof Error?g:new Error("Failed to predict risks");throw o(h),h}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(g){let h=g instanceof Error?g:new Error("Failed to generate subtasks");throw o(h),h}finally{a(false);}},[s]),u=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(g){let h=g instanceof Error?g:new Error("Failed to estimate effort");throw o(h),h}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:p,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function Yi(){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 Cm(e){let{cards:t}=e,[a,r]=Yi(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,g)=>{if(!g){r({selectedCardIds:[d],lastSelectedCardId:d});return}let h=g.ctrlKey||g.metaKey,C=g.shiftKey;if(h)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(T=>T!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(C&&a.lastSelectedCardId){let T=t.find(b=>b.id===d),c=t.find(b=>b.id===a.lastSelectedCardId);if(T&&c&&T.columnId===c.columnId){let b=t.filter(w=>w.columnId===T.columnId).sort((w,R)=>w.position-R.position),y=b.findIndex(w=>w.id===a.lastSelectedCardId),l=b.findIndex(w=>w.id===d),[x,v]=y<l?[y,l]:[l,y],S=b.slice(x,v+1).map(w=>w.id),k=Array.from(new Set([...a.selectedCardIds,...S]));r({selectedCardIds:k,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(g=>g!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),p=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),u=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:p,selectAll:m,toggleCard:i,getSelectedCards:u}}var Tm={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Nm(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Tm,...a}),[a]),[s,n]=react.useState([]),p=react.useCallback((T,c,b,y,l)=>{if(c.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:T,cardIds:c,columnId:b,strategy:y,color:l,isExpanded:true,position:s.filter(v=>v.columnId===b).length,createdAt:new Date};n(v=>[...v,x]);},[o.minCardsPerStack,s]),m=react.useCallback(T=>{n(c=>c.filter(b=>b.id!==T));},[]),i=react.useCallback(T=>{n(c=>c.map(b=>b.id===T?{...b,isExpanded:!b.isExpanded}:b));},[]),u=react.useCallback((T,c)=>{n(b=>b.map(y=>y.id===T&&!y.cardIds.includes(c)?{...y,cardIds:[...y.cardIds,c]}:y));},[]),d=react.useCallback((T,c)=>{n(b=>b.map(y=>{if(y.id===T){let l=y.cardIds.filter(x=>x!==c);return l.length<o.minCardsPerStack?null:{...y,cardIds:l}}return y}).filter(y=>y!==null));},[o.minCardsPerStack]),g=react.useCallback(T=>s.filter(c=>c.columnId===T).sort((c,b)=>c.position-b.position),[s]),h=react.useCallback(async T=>{let c=t.filter(v=>v.columnId===T);if(c.length<o.minCardsPerStack*2)return [];let b=[],y=new Map;c.forEach(v=>{v.labels&&v.labels.length>0&&v.labels.forEach(S=>{y.has(S)||y.set(S,[]),y.get(S).push(v);});}),y.forEach((v,S)=>{v.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${S}`,cardIds:v.map(k=>k.id),columnId:T,strategy:"labels",color:"#3b82f6"},reason:`${v.length} cards with label "${S}"`,confidence:.85});});let l=new Map;c.forEach(v=>{v.assignedUserIds&&v.assignedUserIds.length>0&&v.assignedUserIds.forEach(S=>{l.has(S)||l.set(S,[]),l.get(S).push(v);});}),l.forEach((v,S)=>{v.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${S.slice(-4)}`,cardIds:v.map(k=>k.id),columnId:T,strategy:"assignee",color:"#8b5cf6"},reason:`${v.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(c.forEach(v=>{v.priority&&(x.has(v.priority)||x.set(v.priority,[]),x.get(v.priority).push(v));}),x.forEach((v,S)=>{if(v.length>=o.minCardsPerStack){let k={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[S.toLowerCase()]||"\u26AA";b.push({stack:{title:`${k} ${S} Priority`,cardIds:v.map(w=>w.id),columnId:T,strategy:"priority",color:S==="high"||S==="urgent"?"#ef4444":"#10b981"},reason:`${v.length} cards with ${S} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let v of c){let k=(await r.findSimilar(v,c)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(k.length>=o.minCardsPerStack-1){let w=[v.id,...k.map(M=>M.card.id)],R=k.reduce((M,D)=>M+D.similarity,0)/k.length;b.push({stack:{title:`\u2728 Similar to "${v.title.substring(0,30)}${v.title.length>30?"...":""}"`,cardIds:w,columnId:T,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${k.length+1} similar tasks`,confidence:R});}}return b.filter(v=>v.confidence>=o.autoStackConfidenceThreshold).sort((v,S)=>S.confidence-v.confidence).slice(0,5)},[t,o,r]),C=react.useCallback(T=>{p(T.stack.title,T.stack.cardIds,T.stack.columnId,T.stack.strategy,T.stack.color);},[p]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(c=>c.columnId)).forEach(async c=>{let b=await h(c),y=b[0];b.length>0&&y&&y.confidence>=.9&&C(y);});},[]),{stacks:s,createStack:p,deleteStack:m,toggleStack:i,addToStack:u,removeFromStack:d,getStacksForColumn:g,getSuggestions:h,applySuggestion:C,config:o}}var Dm=react.createContext(null);function Sm({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(m=>{let{Column:i}=Zo("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=Zo("@libxai/core");n.set(m.id,new i(m));});let p=null;if(t?.board){let{Board:m}=Zo("@libxai/core");p=new m(t.board);}r.current=new core.BoardStore({board:p,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Dm.Provider,{value:{store:o},children:e})}function qn(){let e=react.useContext(Dm);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Xo(){let e=qn(),[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 p=react.useCallback(y=>{e.updateBoard(y);},[e]),m=react.useCallback(y=>{e.addColumn(y);},[e]),i=react.useCallback((y,l)=>{e.updateColumn(y,l);},[e]),u=react.useCallback(y=>{e.deleteColumn(y);},[e]),d=react.useCallback(y=>e.getColumn(y),[e]),g=react.useCallback(y=>{e.addCard(y);},[e]),h=react.useCallback((y,l)=>{e.updateCard(y,l);},[e]),C=react.useCallback(y=>{e.deleteCard(y);},[e]),T=react.useCallback((y,l,x)=>{e.moveCard(y,l,x);},[e]),c=react.useCallback(y=>e.getCard(y),[e]),b=react.useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:r,cards:s,updateBoard:p,addColumn:m,updateColumn:i,deleteColumn:u,getColumn:d,addCard:g,updateCard:h,deleteCard:C,moveCard:T,getCard:c,getCardsByColumn:b}}function Pm(e){let{cards:t}=Xo();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 Mm(e="position",t="asc"){let{cards:a}=Xo();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let p={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?p[o.priority]:0,i=s.priority?p[s.priority]:0;n=m-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 Xn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Nl.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 p=await Promise.resolve(n.apply(s,a));p!==void 0&&(o=p,a[0]=p);}catch(p){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,p,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Gh=new Xn;function Fm({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:p=0,getItemKey:m}){let i=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:p}),d=u.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},h=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:g,className:o,children:jsxRuntime.jsx("div",{style:h,children:d.map(C=>{let T=e[C.index];if(!T)return null;let c=m?m(T,C.index):C.index,b={position:"absolute",top:n?0:C.start,left:n?C.start:0,width:n?C.size:"100%",height:n?"100%":C.size};return jsxRuntime.jsx("div",{style:b,"data-index":C.index,children:r(T,C.index)},c)})})})}function Lm(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 Bm({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:p=16,getItemKey:m,horizontal:i=true}){let u=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:p}),g=d.getVirtualItems(),h={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},C={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:h,className:s,children:jsxRuntime.jsx("div",{style:C,children:g.map(T=>{let c=e[T.index];if(!c)return null;let b=m?m(c,T.index):T.index,y={position:"absolute",top:0,left:T.start,width:T.size,height:"100%"};return jsxRuntime.jsx("div",{style:y,"data-index":T.index,children:o(c,T.index)},b)})})})}function Rm(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 $m(e,t=10){return e>t}var Qi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Zi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},el={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},tl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},al={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},rl={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},ol={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},nl={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)"},sl={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)"},il={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},ll={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}},dl={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}},Jn={spacing:Qi,borderRadius:Zi,fontSize:el,fontWeight:tl,lineHeight:al,zIndex:rl,duration:ol,easing:nl,shadows:sl,opacity:il,kanban:ll,gantt:dl};function Om(e,t,a){return e[t]??a}function cl(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)?cl(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function jh(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function ml(e="asakaa"){let t=cl(Jn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=jh(o);a.push(` ${s}: ${n};`);}return `:root {
390
390
  ${a.join(`
391
391
  `)}
392
392
  }`}function Jo(e,t="asakaa"){let a=[],r=cl(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
@@ -416,5 +416,5 @@ ${Jo(ul,"asakaa").split(`
416
416
  `)}
417
417
  }
418
418
  `}var Kh=({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 Um({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=go();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,p])=>{let m=n,i=m===r;return jsxRuntime.jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${p.displayName} theme`,"aria-pressed":i,title:p.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Kh,{theme:m})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:p.displayName})]},m)})})}
419
- Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=cm;exports.AI_FEATURES=Nh;exports.AI_MODELS=Vi;exports.AddCardButton=Ds;exports.AddColumnButton=Ns;exports.AttachmentUploader=dr;exports.BoardProvider=Sm;exports.BulkOperationsToolbar=hn;exports.BurnDownChart=Os;exports.CalendarBoard=Yc;exports.Card=ur;exports.CardDetailModal=Fs;exports.CardDetailModalV2=Bs;exports.CardHistoryReplay=tm;exports.CardHistoryTimeline=Zc;exports.CardRelationshipsGraph=om;exports.CardStack=hh;exports.CardTemplateSelector=Vs;exports.CircuitBreaker=ss;exports.Column=io;exports.ColumnManager=Cn;exports.CommandPalette=Ps;exports.ConfigMenu=qs;exports.ContextMenu=yo;exports.DEFAULT_SHORTCUTS=Lo;exports.DEFAULT_TEMPLATES=_s;exports.DateRangePicker=To;exports.DependenciesSelector=Do;exports.DependencyLine=Mn;exports.DistributionCharts=zs;exports.EditableColumnTitle=gs;exports.ErrorBoundary=co;exports.ExportImportModal=Ks;exports.FilterBar=Ys;exports.GANTT_AI_SYSTEM_PROMPT=Dc;exports.GanttAIAssistant=Bn;exports.GanttBoard=wc;exports.GanttI18nContext=ho;exports.GanttMilestone=Fn;exports.GanttToolbar=wn;exports.GenerateGanttTasksDialog=um;exports.GeneratePlanModal=im;exports.GroupBySelector=Ws;exports.KanbanBoard=Er;exports.KanbanToolbar=Cs;exports.KanbanViewAdapter=Mo;exports.KeyboardShortcutsHelp=Gs;exports.ListView=Oc;exports.MenuIcons=$t;exports.PluginManager=Xn;exports.PrioritySelector=zr;exports.RATE_LIMITS=Th;exports.SwimlaneBoardView=Us;exports.TagBadge=hs;exports.TagList=td;exports.TagPicker=nr;exports.TaskBar=Sn;exports.TaskDetailModal=_r;exports.TaskFormModal=Nc;exports.TaskGrid=Dn;exports.ThemeModal=Zs;exports.ThemeProvider=zd;exports.ThemeSwitcher=Um;exports.Timeline=In;exports.UserAssignmentSelector=Hr;exports.VelocityChart=$s;exports.VirtualGrid=Bm;exports.VirtualList=Fm;exports.aiUsageTracker=Qr;exports.borderRadius=Zi;exports.calculatePosition=tn;exports.calendarDarkTheme=Ui;exports.calendarEnTranslations=Fi;exports.calendarEsTranslations=Li;exports.calendarLightTheme=Hi;exports.calendarNeutralTheme=Wi;exports.calendarThemes=Vn;exports.calendarTranslations=Wn;exports.cardToGanttTask=$n;exports.cardsToGanttTasks=Lc;exports.cn=f;exports.createKanbanView=yd;exports.createRetryWrapper=lp;exports.darkTheme=Xs;exports.darkTokenTheme=Qn;exports.defaultTheme=yn;exports.designTokens=Jn;exports.duration=ol;exports.easing=nl;exports.exportTokensToCSS=zm;exports.findTaskByName=yr;exports.fontSize=el;exports.fontWeight=tl;exports.formatCost=Ko;exports.ganttEnTranslations=xn;exports.ganttEsTranslations=Hd;exports.ganttTaskToCardUpdate=Fc;exports.ganttThemes=qe;exports.ganttTokens=dl;exports.ganttTranslations=ei;exports.ganttUtils=fe;exports.generateCSSVariables=ml;exports.generateCompleteCSS=gl;exports.generateInitialPositions=op;exports.generateTasksContext=Sc;exports.generateThemeVariables=Jo;exports.getCalendarTheme=qc;exports.getCalendarTranslations=Wo;exports.getListViewTheme=zc;exports.getListViewTranslations=Ei;exports.getMonthNames=Uc;exports.getToken=Om;exports.getTranslations=Wd;exports.getWeekdayNames=Hc;exports.kanbanTokens=ll;exports.lightTheme=Js;exports.lightTokenTheme=pl;exports.lineHeight=al;exports.listViewDarkTheme=Pi;exports.listViewEnTranslations=Di;exports.listViewEsTranslations=Si;exports.listViewLightTheme=Mi;exports.listViewNeutralTheme=Ai;exports.listViewThemes=Hn;exports.listViewTranslations=On;exports.mergeCalendarTranslations=Gn;exports.mergeListViewTranslations=zn;exports.mergeTranslations=ti;exports.neutralTheme=Qs;exports.neutralTokenTheme=ul;exports.opacity=il;exports.parseLocalCommand=Mc;exports.parseNaturalDate=Ci;exports.parseNaturalDuration=Ti;exports.parseProgress=Ni;exports.parseStatus=Pc;exports.pluginManager=Gh;exports.retrySyncOperation=ip;exports.retryWithBackoff=an;exports.shadows=sl;exports.shouldVirtualizeGrid=$m;exports.spacing=Qi;exports.themes=Kr;exports.useAI=wm;exports.useBoard=fm;exports.useBoardCore=Xo;exports.useBoardStore=qn;exports.useCardStacking=Nm;exports.useDragState=ks;exports.useFilteredCards=Pm;exports.useFilters=ym;exports.useGanttI18n=bo;exports.useKanbanState=Yn;exports.useKeyboardShortcuts=Rd;exports.useMultiSelect=Cm;exports.useSelectionState=Yi;exports.useSortedCards=Mm;exports.useTheme=go;exports.useVirtualGrid=Rm;exports.useVirtualList=Lm;exports.validateAIResponse=Ac;exports.withErrorBoundary=Ss;exports.wouldCreateCircularDependency=on;exports.zIndex=rl;//# sourceMappingURL=index.cjs.map
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=cm;exports.AI_FEATURES=Nh;exports.AI_MODELS=Vi;exports.AddCardButton=Ds;exports.AddColumnButton=Ns;exports.AttachmentUploader=dr;exports.BoardProvider=Sm;exports.BulkOperationsToolbar=hn;exports.BurnDownChart=Os;exports.CalendarBoard=Yc;exports.Card=ur;exports.CardDetailModal=Fs;exports.CardDetailModalV2=Bs;exports.CardHistoryReplay=tm;exports.CardHistoryTimeline=Zc;exports.CardRelationshipsGraph=om;exports.CardStack=hh;exports.CardTemplateSelector=Vs;exports.CircuitBreaker=ss;exports.Column=io;exports.ColumnManager=Cn;exports.CommandPalette=Ps;exports.ConfigMenu=qs;exports.ContextMenu=yo;exports.DEFAULT_SHORTCUTS=Lo;exports.DEFAULT_TEMPLATES=_s;exports.DateRangePicker=To;exports.DependenciesSelector=Do;exports.DependencyLine=Mn;exports.DistributionCharts=zs;exports.EditableColumnTitle=gs;exports.ErrorBoundary=co;exports.ExportImportModal=Ks;exports.FilterBar=Ys;exports.GANTT_AI_SYSTEM_PROMPT=Dc;exports.GanttAIAssistant=Bn;exports.GanttBoard=wc;exports.GanttI18nContext=ho;exports.GanttMilestone=Fn;exports.GanttToolbar=wn;exports.GenerateGanttTasksDialog=um;exports.GeneratePlanModal=im;exports.GroupBySelector=Ws;exports.KanbanBoard=Er;exports.KanbanToolbar=Cs;exports.KanbanViewAdapter=Mo;exports.KeyboardShortcutsHelp=Gs;exports.ListView=Oc;exports.MenuIcons=Rt;exports.PluginManager=Xn;exports.PrioritySelector=zr;exports.RATE_LIMITS=Th;exports.SwimlaneBoardView=Us;exports.TagBadge=hs;exports.TagList=td;exports.TagPicker=nr;exports.TaskBar=Sn;exports.TaskDetailModal=_r;exports.TaskFormModal=Nc;exports.TaskGrid=Dn;exports.ThemeModal=Zs;exports.ThemeProvider=zd;exports.ThemeSwitcher=Um;exports.Timeline=In;exports.UserAssignmentSelector=Hr;exports.VelocityChart=$s;exports.VirtualGrid=Bm;exports.VirtualList=Fm;exports.aiUsageTracker=Qr;exports.borderRadius=Zi;exports.calculatePosition=tn;exports.calendarDarkTheme=Ui;exports.calendarEnTranslations=Fi;exports.calendarEsTranslations=Li;exports.calendarLightTheme=Hi;exports.calendarNeutralTheme=Wi;exports.calendarThemes=Vn;exports.calendarTranslations=Wn;exports.cardToGanttTask=$n;exports.cardsToGanttTasks=Lc;exports.cn=f;exports.createKanbanView=yd;exports.createRetryWrapper=lp;exports.darkTheme=Xs;exports.darkTokenTheme=Qn;exports.defaultTheme=yn;exports.designTokens=Jn;exports.duration=ol;exports.easing=nl;exports.exportTokensToCSS=zm;exports.findTaskByName=yr;exports.fontSize=el;exports.fontWeight=tl;exports.formatCost=Ko;exports.ganttEnTranslations=xn;exports.ganttEsTranslations=Hd;exports.ganttTaskToCardUpdate=Fc;exports.ganttThemes=qe;exports.ganttTokens=dl;exports.ganttTranslations=ei;exports.ganttUtils=fe;exports.generateCSSVariables=ml;exports.generateCompleteCSS=gl;exports.generateInitialPositions=op;exports.generateTasksContext=Sc;exports.generateThemeVariables=Jo;exports.getCalendarTheme=qc;exports.getCalendarTranslations=Wo;exports.getListViewTheme=zc;exports.getListViewTranslations=Ei;exports.getMonthNames=Uc;exports.getToken=Om;exports.getTranslations=Wd;exports.getWeekdayNames=Hc;exports.kanbanTokens=ll;exports.lightTheme=Js;exports.lightTokenTheme=pl;exports.lineHeight=al;exports.listViewDarkTheme=Pi;exports.listViewEnTranslations=Di;exports.listViewEsTranslations=Si;exports.listViewLightTheme=Mi;exports.listViewNeutralTheme=Ai;exports.listViewThemes=Hn;exports.listViewTranslations=On;exports.mergeCalendarTranslations=Gn;exports.mergeListViewTranslations=zn;exports.mergeTranslations=ti;exports.neutralTheme=Qs;exports.neutralTokenTheme=ul;exports.opacity=il;exports.parseLocalCommand=Mc;exports.parseNaturalDate=Ci;exports.parseNaturalDuration=Ti;exports.parseProgress=Ni;exports.parseStatus=Pc;exports.pluginManager=Gh;exports.retrySyncOperation=ip;exports.retryWithBackoff=an;exports.shadows=sl;exports.shouldVirtualizeGrid=$m;exports.spacing=Qi;exports.themes=Kr;exports.useAI=wm;exports.useBoard=fm;exports.useBoardCore=Xo;exports.useBoardStore=qn;exports.useCardStacking=Nm;exports.useDragState=ks;exports.useFilteredCards=Pm;exports.useFilters=ym;exports.useGanttI18n=bo;exports.useKanbanState=Yn;exports.useKeyboardShortcuts=Rd;exports.useMultiSelect=Cm;exports.useSelectionState=Yi;exports.useSortedCards=Mm;exports.useTheme=go;exports.useVirtualGrid=Rm;exports.useVirtualList=Lm;exports.validateAIResponse=Ac;exports.withErrorBoundary=Ss;exports.wouldCreateCircularDependency=on;exports.zIndex=rl;//# sourceMappingURL=index.cjs.map
420
420
  //# sourceMappingURL=index.cjs.map