@libxai/board 0.17.438 → 0.17.439

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'),rm=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),Ff=require('react-markdown'),Af=require('remark-gfm'),If=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var rm__default=/*#__PURE__*/_interopDefault(rm);var Ff__default=/*#__PURE__*/_interopDefault(Ff);var Af__default=/*#__PURE__*/_interopDefault(Af);var If__default=/*#__PURE__*/_interopDefault(If);var un=(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 gn=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 [gn.Translate.toString(e),gn.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 fn(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 Lu(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Ms(e,t){return e.length===0?1e3:t===0?fn(null,e[0].position):t>=e.length?fn(e[e.length-1].position,null):fn(e[t-1].position,e[t].position)}function Ql(e,t=100){return e>t}var Bu=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 Ru(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 bn(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Bu,onRetry:d}=t,m,i=0;for(let c=1;c<=a;c++){i=c;try{return {data:await e(),attempts:i,success:!0}}catch(l){if(m=l,c===a||!n(m,c))return {error:m,attempts:i,success:false};let b=Ru(c,r,o,s);if(d)try{d(m,c,b);}catch(y){console.error("Error in retry callback:",y);}await new Promise(y=>setTimeout(y,b));}}return {error:m||new Error("Unknown error"),attempts:i,success:false}}function Ou(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 zu(e,t={}){return async(...a)=>bn(()=>e(...a),t)}var Fs=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 ed=(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))(ed||{}),Vr=class Vr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,d=`[${a}] [${r}] [${s}]`,m=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(d,o,m?n:"");break;case "INFO":console.info(d,o,m?n:"");break;case "WARN":console.warn(d,o,m?n:"");break;case "ERROR":console.error(d,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",...Vr.globalOptions};}static configure(t){Vr.globalOptions={...Vr.globalOptions,...t};}child(t){return new Vr({...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 hn((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new hn(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:ed[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Vr.globalOptions={};var As=Vr,hn=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}},td=new As;function $u(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 Hu(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(d=>d.id===s.columnId);return [s.id,Is(s.title),Is(s.description||""),Is(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
2
- `)}async function Wu(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 rm__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),d=n.toDataURL("image/png"),m=297,i=210,c=n.width/n.height,l=m-20,u=l/c;u>i-20&&(u=i-20,l=u*c);let b=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});b.setFontSize(16),b.setTextColor(255,255,255),b.setFillColor(10,10,10),b.rect(0,0,m,15,"F"),b.text(e.title||"Kanban Board",10,10);let y=(m-l)/2;return b.addImage(d,"PNG",y,20,l,u),b}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 d=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,d.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):d.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 c=o.splitTextToSize(m.description,160);o.text(c,25,s),s+=c.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 c=[];m.startDate&&c.push(`Start: ${m.startDate}`),m.endDate&&c.push(`End: ${m.endDate}`),i.push(c.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 Is(e){return e.includes(",")||e.includes('"')||e.includes(`
2
+ `)}async function Wu(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 rm__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),d=n.toDataURL("image/png"),m=297,i=210,c=n.width/n.height,l=m-20,p=l/c;p>i-20&&(p=i-20,l=p*c);let b=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});b.setFontSize(16),b.setTextColor(255,255,255),b.setFillColor(10,10,10),b.rect(0,0,m,15,"F"),b.text(e.title||"Kanban Board",10,10);let y=(m-l)/2;return b.addImage(d,"PNG",y,20,l,p),b}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 d=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,d.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):d.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 c=o.splitTextToSize(m.description,160);o.text(c,25,s),s+=c.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 c=[];m.startDate&&c.push(`Start: ${m.startDate}`),m.endDate&&c.push(`End: ${m.endDate}`),i.push(c.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 Is(e){return e.includes(",")||e.includes('"')||e.includes(`
3
3
  `)?`"${e.replace(/"/g,'""')}"`:e}async function rd(e,t,a,r){switch(t){case "json":return $u(e,r);case "csv":return Hu(e);case "pdf":return await Wu(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function od(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let c=`${r}.pdf`;e.save(c);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"},d=new Blob([e],{type:n[t]}),m=URL.createObjectURL(d),i=document.createElement("a");i.href=m,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(m);}function Gu(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 _u(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=nd(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let d=nd(t[n]||"");if(d.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-d.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${d.length})`);continue}for(;d.length<a.length;)d.push("");let i={};a.forEach((b,y)=>{i[b]=d[y]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let l=o.get(c),u={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(u),l.cardIds.push(u.id);}catch(d){s.push(`Line ${n+1}: ${d instanceof Error?d.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 nd(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 sd(e,t){switch(t){case "json":return Gu(e);case "csv":return _u(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function id(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 Ls=react.createContext(null);function ld(){return react.useContext(Ls)}var dd=react.createContext(null);function cd({children:e,themeName:t}){return jsxRuntime.jsx(dd.Provider,{value:{themeName:t},children:e})}function uo(){return react.useContext(dd)}function it({children:e,container:t}){let[a,r]=react.useState(false),o=ld(),s=uo();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:d,themeName:m}=o,i={"--asakaa-color-background-primary":d.bgPrimary,"--asakaa-color-background-secondary":d.bgSecondary,"--asakaa-color-background-card":d.bgGrid,"--asakaa-color-background-hover":d.hoverBg,"--asakaa-color-text-primary":d.textPrimary,"--asakaa-color-text-secondary":d.textSecondary,"--asakaa-color-text-tertiary":d.textTertiary,"--asakaa-color-text-inverse":d.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":d.border,"--asakaa-color-border-hover":d.borderLight,"--asakaa-color-border-subtle":d.borderLight,"--asakaa-color-interactive-primary":d.accent,"--asakaa-color-interactive-primaryHover":d.accentHover,"--asakaa-color-interactive-primaryBorder":`${d.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${d.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${d.accent}33`,"--asakaa-color-status-success":d.statusCompleted,"--asakaa-color-status-warning":d.milestone,"--asakaa-color-status-error":d.criticalPath,"--asakaa-color-danger":d.criticalPath,"--asakaa-color-danger-border":`${d.criticalPath}4D`,"--asakaa-color-danger-background":`${d.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${d.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 fd={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},Zu="#BDC3C7",Qu=({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 jr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),d=react.useRef(null),m=react.useRef(null),i=()=>{if(!m.current)return;let b=m.current.getBoundingClientRect(),y=window.innerHeight,C=window.innerWidth,g=160,v=220,h=4,p=b.right-g;p<10&&(p=b.left),p+g>C-10&&(p=C-g-10);let k=y-b.bottom,x=b.top,D;k>=v+h?D=b.bottom+h:x>=v+h?D=b.top-v-h:D=k>=x?b.bottom+h:Math.max(10,b.top-v-h),n({top:D,left:p}),o(true);};react.useEffect(()=>{let b=y=>{d.current&&!d.current.contains(y.target)&&!m.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[r]),react.useEffect(()=>{let b=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[r]);let c=b=>{t(b),o(false);},l=e?fd[e]:null,u=l?.color||Zu;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?`${u}10`:"transparent",boxShadow:e?`0 0 0 2px ${u}30 inset`:"none"},title:l?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:u,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:u,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(it,{children:jsxRuntime.jsxs("div",{ref:d,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(fd).map(([b,y])=>jsxRuntime.jsxs("button",{onClick:()=>c(b),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:y.color,background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:C=>{C.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Qu,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.label}),e===b&&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"})})]},b)),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:()=>c(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: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("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 eg=[{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 Ro({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,d]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),u=(uo()?.themeName||"dark")==="dark",b=()=>{if(!i.current)return;let p=i.current.getBoundingClientRect(),k=window.innerHeight,x=window.innerWidth,D=320,T=380,w=4,A=p.left;A+D>x-10&&(A=x-D-10),A<10&&(A=10);let L=k-p.bottom,N=p.top,H;L>=T+w?H=p.bottom+w:N>=T+w?H=p.top-T-w:H=L>=N?p.bottom+w:Math.max(10,p.top-T-w),d({top:H,left:A}),s(true);};react.useEffect(()=>{let p=k=>{m.current&&!m.current.contains(k.target)&&!i.current?.contains(k.target)&&s(false);};if(o)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]),react.useEffect(()=>{let p=k=>{k.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[o]);let y=p=>{let k=new Date,x=A=>{let L=A.getFullYear(),N=String(A.getMonth()+1).padStart(2,"0"),H=String(A.getDate()).padStart(2,"0");return `${L}-${N}-${H}`},D=x(k),T=new Date(k);T.setDate(T.getDate()+p);let w=x(T);a(D,w),s(false);},C=()=>{if(!e||!t)return "Set date";let p=T=>{if(T instanceof Date)return T;if(typeof T!="string"||!T.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=T.split("-").map(Number);if(w.length!==3||w.some(H=>isNaN(H)))return null;let A=w[0],L=w[1],N=w[2];return A===void 0||L===void 0||N===void 0?null:new Date(A,L-1,N)},k=p(e),x=p(t);if(!k||!x||isNaN(k.getTime())||isNaN(x.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[k.getMonth()]} ${k.getDate()} \u2013 ${D[x.getMonth()]} ${x.getDate()}`},g=e&&t,h=(()=>{if(!t)return false;let p=typeof t=="string"?new Date(t):t,k=new Date;return k.setHours(0,0,0,0),p<k})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):b(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:g?`${C()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:C()})]}),o&&jsxRuntime.jsx(it,{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:u?"#1A1D25":"#FFFFFF",border:`1px solid ${u?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:u?"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:u?"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:u?"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:eg.map(p=>jsxRuntime.jsx("button",{onClick:()=>y(p.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",k.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:k=>{k.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",k.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:p.label},p.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:u?"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:p=>a(p.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:p=>a(e,p.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"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:p=>{p.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:p=>{p.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Yr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[d,m]=react.useState(""),[i,c]=react.useState({top:0,left:0}),l=react.useRef(null),u=react.useRef(null),b=()=>{if(!u.current)return;let h=u.current.getBoundingClientRect(),p=window.innerHeight,k=window.innerWidth,x=300,D=380,T=4,w=h.right-x;w<10&&(w=h.left),w+x>k-10&&(w=k-x-10);let A=p-h.bottom,L=h.top,N;A>=D+T?N=h.bottom+T:L>=D+T?N=h.top-D-T:N=A>=L?h.bottom+T:Math.max(10,h.top-D-T),c({top:N,left:w}),n(true);};react.useEffect(()=>{let h=p=>{l.current&&!l.current.contains(p.target)&&!u.current?.contains(p.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=p=>{p.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let y=h=>{let p=e.some(k=>k.id===h.id);a(p?e.filter(k=>k.id!==h.id):[...e,h]);},C=t.filter(h=>h.name.toLowerCase().includes(d.toLowerCase())),g=e.slice(0,o),v=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:u,onClick:()=>s?n(false):b(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[g.map(h=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),v>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",v]})]}):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(it,{children:jsxRuntime.jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:d,onChange:h=>m(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:C.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):C.map(h=>{let p=e.some(k=>k.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>y(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:k=>{k.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:h.color,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.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:h.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:p?"#3b82f6":"transparent"},children:p?"\u2713":""})]},h.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 yn(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let i=m.dependencies.map(c=>{if(typeof c=="string")return c;let l=c;return l.taskId||l.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,d=m=>{if(!s.has(m)){s.add(m),n.add(m);let i=r.get(m)||[];for(let c of i){if(!s.has(c)&&d(c))return true;if(n.has(c))return true}}return n.delete(m),false};return d(a)}function zo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[d,m]=react.useState(false),[i,c]=react.useState(""),[l,u]=react.useState(t.length>0),[b,y]=react.useState({top:0,left:0}),[C,g]=react.useState(null),v=react.useRef(null),h=react.useRef(null),p=()=>{if(!h.current)return;let w=h.current.getBoundingClientRect(),A=window.innerHeight,L=window.innerWidth,N=300,H=l?380:120,$=4,j=w.right-N;j<10&&(j=w.left),j+N>L-10&&(j=L-N-10);let ce=A-w.bottom,J=w.top,re;ce>=H+$?re=w.bottom+$:J>=H+$?re=w.top-H-$:re=ce>=J?w.bottom+$:Math.max(10,w.top-H-$),y({top:re,left:j}),m(true);};react.useEffect(()=>{if(!d||!h.current)return;let w=h.current.getBoundingClientRect(),A=window.innerHeight,L=window.innerWidth,N=300,H=l?380:120,$=4,j=w.right-N;j<10&&(j=w.left),j+N>L-10&&(j=L-N-10);let ce=A-w.bottom,J=w.top,re;ce>=H+$?re=w.bottom+$:J>=H+$?re=w.top-H-$:re=ce>=J?w.bottom+$:Math.max(10,w.top-H-$),y({top:re,left:j});},[l,d]),react.useEffect(()=>{let w=A=>{v.current&&!v.current.contains(A.target)&&!h.current?.contains(A.target)&&(m(false),c(""));};if(d)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[d]),react.useEffect(()=>{let w=A=>{A.key==="Escape"&&(m(false),c(""));};if(d)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[d]);let k=w=>{let A=t.includes(w),L=a.find(N=>N.id===w);if(g(null),A){let N=t.filter(H=>H!==w);r(N),N.length===0&&u(false);}else {if(s&&yn(a,w,e)){let H=`Cannot add "${L?.title||w}" as dependency - would create circular reference`;g(H),n?.(w,L?.title||w),setTimeout(()=>g(null),3e3);return}r([...t,w]),u(true);}},x=()=>{let w=!l;u(w),w||r([]);},D=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),T=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:h,onClick:()=>d?m(false):p(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:T,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:T},children:t.length})]}),d&&jsxRuntime.jsx(it,{children:jsxRuntime.jsxs("div",{ref:v,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${b.top}px`,left:`${b.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[C&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:C})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:x,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:w=>c(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 A=t.includes(w.id);return jsxRuntime.jsxs("button",{onClick:()=>k(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:L=>{L.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:L=>{L.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:A?"#3b82f6":"transparent",borderColor:A?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:A&&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([]),u(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 cr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:d=[],allCards:m=[]})=>{let{attributes:i,listeners:c,setNodeRef:l,transform:u,transition:b,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),C={transform:gn.Transform.toString(u),transition:b};if(t)return jsxRuntime.jsx("div",{ref:l,style:C,...i,...c,onClick:()=>a?.(e),children:t(e)});let g=d.filter(k=>e.assignedUserIds?.includes(k.id)),v=e.progress===100,h=(e.attachments||[]).filter(k=>k.type.startsWith("image/")),p={...C,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:l,style:p,className:f("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,onClick:k=>{k.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:k=>{k.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsxRuntime.jsx("img",{src:h[0].url,alt:h[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:k=>{k.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((k,x)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:k.url,alt:k.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";}}),x===3&&h.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:["+",h.length-4]})})]},k.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:v?"line-through":"none",opacity:v?.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:k=>k.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(jr,{priority:e.priority,onChange:k=>n?.(e.id,{priority:k})})}),jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Ro,{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:(k,x)=>n?.(e.id,{startDate:k,endDate:x})})}),d.length>0&&jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Yr,{assignedUsers:g,availableUsers:d,onChange:k=>n?.(e.id,{assignedUserIds:k.map(x=>x.id)})})}),jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(zo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(k=>typeof k=="string"?k:k.taskId):[],availableTasks:m,onChange:k=>n?.(e.id,{dependencies:k})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(k=>jsxRuntime.jsx("span",{className:"asakaa-label",children:k},k))}),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)));cr.displayName="Card";var vn={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Nd=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Dd({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,d]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),c=[...Object.entries(vn).map(([g,v])=>({id:g,label:v.label,color:v.color,icon:v.icon})),...r.filter(g=>!Object.keys(vn).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let g=vn[e];if(g)return {...g,id:e};let v=r.find(h=>h.id===e);return v?{id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}:{...vn.todo,id:"todo"}},u=()=>{if(!i.current)return;let g=i.current.getBoundingClientRect(),v=window.innerHeight,h=window.innerWidth,p=180,k=280,x=4,D=g.right-p;D<10&&(D=g.left),D+p>h-10&&(D=h-p-10);let T=v-g.bottom,w=g.top,A;T>=k+x?A=g.bottom+x:w>=k+x?A=g.top-k-x:A=T>=w?g.bottom+x:Math.max(10,g.top-k-x),d({top:A,left:D}),s(true);};react.useEffect(()=>{let g=v=>{m.current&&!m.current.contains(v.target)&&!i.current?.contains(v.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=v=>{v.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let b=g=>{t(g),s(false);},y=l(),C=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):u(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${C}10`,boxShadow:`0 0 0 2px ${C}30 inset`},title:y.label,children:jsxRuntime.jsx(Nd,{icon:y.icon,color:C})}),o&&jsxRuntime.jsx(it,{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:c.map(g=>jsxRuntime.jsxs("button",{onClick:()=>b(g.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:g.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Nd,{icon:g.icon,color:g.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:g.label}),e===g.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g.id))})]})})]})}function Sd({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[d,m]=react.useState(false),[i,c]=react.useState(e),[l,u]=react.useState({top:0,left:0}),b=react.useRef(null),y=react.useRef(null),C=react.useRef(null);react.useEffect(()=>{if(s&&y.current){let p=y.current.getBoundingClientRect();u({top:p.bottom+window.scrollY+8,left:p.left+window.scrollX});}},[s]),react.useEffect(()=>{let p=k=>{b.current&&!b.current.contains(k.target)&&!y.current?.contains(k.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),react.useEffect(()=>{let p=k=>{k.key==="Escape"&&(n(false),m(false),c(e));};if(s)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[s,e]),react.useEffect(()=>{d&&C.current&&(C.current.focus(),C.current.select());},[d]);let g=()=>{m(true),c(e);},v=()=>{let p=i.trim();p&&p!==e&&t(p),m(false),n(false),c(e);},h=p=>{p.key==="Enter"?v():p.key==="Escape"&&(m(false),c(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:y,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(it,{children:jsxRuntime.jsx("div",{ref:b,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${l.top}px`,left:`${l.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:d?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:C,type:"text",value:i,onChange:p=>c(p.target.value),onKeyDown:h,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:g,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),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 bo=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:d,availableUsers:m,allCards:i,enableVirtualization:c,cardHeight:l=120,isCollapsed:u,onToggleCollapse:b,onColumnRename:y,onColumnDelete:C,isDeletable:g=false,className:v})=>{let{setNodeRef:h,isOver:p}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),k=react.useRef(null),x=c??Ql(t.length),D=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>l,enabled:x});if(a)return jsxRuntime.jsx("div",{ref:h,className:v,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}})(),A=w.state==="exceeded",L=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:f("asakaa-column",p&&"ring-2 ring-asakaa-accent-blue",A&&"ring-2 ring-asakaa-accent-red",v),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(L()),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"})]})]}),(y||C)&&jsxRuntime.jsx(Sd,{columnTitle:e.title,onRename:N=>y?.(e.id,N),onDelete:C?()=>C(e.id):void 0,isDeletable:g}),b&&jsxRuntime.jsx("button",{onClick:b,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":u?"Expand column":"Collapse column",children:u?"\u25B6":"\u25BC"})]})]}),!u&&jsxRuntime.jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:x?"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"})}):x?jsxRuntime.jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(N=>{let H=t[N.index];return H?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${N.start}px)`},children:jsxRuntime.jsx(cr,{card:H,render:r,onClick:n,onUpdate:d,availableUsers:m,allCards:i})},H.id):null})}):t.map(N=>jsxRuntime.jsx(cr,{card:N,render:r,onClick:n,onUpdate:d,availableUsers:m,allCards:i},N.id))})})]})});bo.displayName="Column";function Us({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),d=react.useRef(null);react.useEffect(()=>{r&&d.current&&(d.current.focus(),d.current.select());},[r]);let m=()=>{let c=s.trim();c&&c!==e?t(c):n(e),o(false);},i=c=>{c.key==="Enter"?m():c.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:d,type:"text",value:s,onChange:c=>n(c.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})}function xg(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Id(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(d=>{let m=d.name.toLowerCase(),i=m.replace(/\s+/g,""),c=m.split(/\s+/);return !!(i===s||m===s||c.some(l=>l===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function kg(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function wg(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Cg=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function Ld({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:d="dark",locale:m="es",currentUser:i,enableEmoji:c=true,enableAttachments:l=true,pendingFiles:u=[],onFilesSelect:b,onRemoveFile:y,maxFileSizeMB:C=10}){let g=d==="dark",[v,h]=react.useState(false),[p,k]=react.useState([]),[x,D]=react.useState(0),[T,w]=react.useState(null),[A,L]=react.useState(false),N=react.useRef(null),H=react.useRef(null),$=react.useRef(null),j=react.useRef(null),ce=react.useCallback((S,B)=>{let _=xg(S,B);if(w(_),_){let te=r.filter(ne=>ne.name.toLowerCase().includes(_.query)||ne.email&&ne.email.toLowerCase().includes(_.query)).slice(0,5);k(te),h(te.length>0),D(0);}else h(false),k([]);},[r]),J=S=>{let B=S.target.value;t(B),ce(B,S.target.selectionStart||0);},re=()=>{N.current&&ce(e,N.current.selectionStart||0);},ue=react.useCallback(S=>{if(!T||!N.current)return;let B=e.slice(0,T.start),_=e.slice(T.end),te=`@${S.name.replace(/\s+/g,"")} `,ne=B+te+_;t(ne),h(false),w(null),setTimeout(()=>{if(N.current){let de=T.start+te.length;N.current.selectionStart=de,N.current.selectionEnd=de,N.current.focus();}},0);},[T,e,t]),Ce=S=>{if(v&&p.length>0)switch(S.key){case "ArrowDown":S.preventDefault(),D(B=>B<p.length-1?B+1:0);break;case "ArrowUp":S.preventDefault(),D(B=>B>0?B-1:p.length-1);break;case "Enter":{S.preventDefault();let B=p[x];B&&ue(B);break}case "Tab":{S.preventDefault();let B=p[x];B&&ue(B);break}case "Escape":S.preventDefault(),h(false);break}else S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),a());};react.useEffect(()=>{let S=B=>{H.current&&!H.current.contains(B.target)&&N.current&&!N.current.contains(B.target)&&h(false),j.current&&!j.current.contains(B.target)&&L(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let Se=react.useCallback(S=>{if(!N.current)return;let B=N.current.selectionStart||e.length,_=e.slice(0,B)+S+e.slice(B);t(_),L(false),setTimeout(()=>{if(N.current){let te=B+S.length;N.current.selectionStart=te,N.current.selectionEnd=te,N.current.focus();}},0);},[e,t]),F=react.useCallback(S=>{if(!b||!S.target.files)return;let B=Array.from(S.target.files),_=C*1024*1024,te=B.filter(ne=>ne.size>_?(console.warn(`File ${ne.name} exceeds max size of ${C}MB`),false):true);te.length>0&&b(te),S.target.value="";},[b,C]),R=react.useCallback(S=>S.type.startsWith("image/")?lucideReact.Image:S.type.includes("pdf")||S.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(v&&H.current){let S=H.current.children[x];S&&S.scrollIntoView({block:"nearest"});}},[x,v]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[u.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(S=>{let B=R(S.file),_=S.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:f("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",g?"bg-white/10":"bg-gray-100"),children:[_&&S.preview?jsxRuntime.jsx("img",{src:S.preview,alt:S.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(B,{className:f("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:f("text-xs truncate",g?"text-white":"text-gray-900"),children:S.file.name}),jsxRuntime.jsx("p",{className:f("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:wg(S.file.size)})]}),y&&jsxRuntime.jsx("button",{onClick:()=>y(S.id),className:f("p-0.5 rounded-full transition-colors",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:f("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:f("flex items-center gap-1 px-2 py-2 rounded-lg",g?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>L(!A),disabled:s||n,className:f("p-1 rounded transition-colors flex-shrink-0",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:A&&jsxRuntime.jsx(framerMotion.motion.div,{ref:j,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:f("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:Cg.map(S=>jsxRuntime.jsx("button",{type:"button",onClick:()=>Se(S),className:f("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",g?"hover:bg-white/10":"hover:bg-gray-100"),children:S},S))})})})]}),l&&b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>$.current?.click(),disabled:s||n,className:f("p-1.5 rounded transition-colors",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:m==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:$,type:"file",multiple:true,onChange:F,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("input",{ref:N,type:"text",value:e,onChange:J,onSelect:re,onKeyDown:Ce,placeholder:o||(m==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,className:f("flex-1 bg-transparent text-sm outline-none min-w-[100px]",g?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(s||n)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()&&u.length===0||s,className:f("p-1.5 rounded transition-colors",(e.trim()||u.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":g?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&p.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:H,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:f("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:p.map((S,B)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>ue(S),className:f("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",B===x?g?"bg-white/10":"bg-gray-100":g?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:S.color||"#8B5CF6"},children:kg(S.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:f("text-sm font-medium truncate",g?"text-white":"text-gray-900"),children:S.name}),S.email&&jsxRuntime.jsx("p",{className:f("text-xs truncate",g?"text-[#6B7280]":"text-gray-500"),children:S.email})]})]},S.id))})})]})]})]})}function Bd({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((d,m)=>d.type==="mention"?jsxRuntime.jsx("span",{className:f("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:d.value},m):jsxRuntime.jsx("span",{children:d.value},m))})}var Tn=["#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[d,m]=react.useState(false),[i,c]=react.useState(""),[l,u]=react.useState(false),[b,y]=react.useState(Tn[10]||"#3B82F6"),[C,g]=react.useState({top:0,left:0}),v=react.useRef(null),h=react.useRef(null),p=react.useRef(null),k=react.useRef(null),x=t.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),D=t.some(N=>N.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(d&&h.current){let N=h.current.getBoundingClientRect();g({top:N.bottom+6,left:N.left});}},[d]),react.useEffect(()=>{let N=H=>{let $=H.target,j=v.current?.contains($),ce=p.current?.contains($);!j&&!ce&&(m(false),c(""),u(false));};if(d)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[d]),react.useEffect(()=>{d&&k.current&&k.current.focus();},[d]);let T=N=>{let H=e.some($=>$.id===N.id);a(H?e.filter($=>$.id!==N.id):[...e,N]);},w=async()=>{if(!(!r||!i.trim())){u(true);try{let N=await r(i.trim(),b);N&&(a([...e,N]),c(""),y(Tn[Math.floor(Math.random()*Tn.length)]||"#3B82F6"));}finally{u(false);}}},A=(N,H)=>{H.stopPropagation(),a(e.filter($=>$.id!==N));},L={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:v,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&m(!d),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:L,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:d&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:p,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:C.top,left:C.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:k,type:"text",value:i,onChange:N=>c(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:H=>A(N.id,H),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:x.length>0?x.map(N=>{let H=e.some($=>$.id===N.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>T(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:H?`${N.color}15`:"transparent",color:o.textPrimary},onMouseEnter:$=>{H||($.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:$=>{H||($.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:N.name}),H&&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:Tn.map(N=>jsxRuntime.jsx("button",{type:"button",onClick:()=>y(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:b===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxRuntime.jsxs("button",{type:"button",onClick:w,disabled:l,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:b,color:"#FFFFFF",opacity:l?.7:1},children:[l?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function 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 Od({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 Xr=[{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 _d(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 qg(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 mr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:d=[],availableTags:m=[],onCreateTag:i,attachments:c=[],onUploadAttachments:l,onDeleteAttachment:u,availableTasks:b=[],comments:y=[],onAddComment:C,currentUser:g,mentionableUsers:v=[],onUploadCommentAttachments:h}){let p=s==="dark",k={textTertiary:p?"#6B7280":"#9CA3AF",textSecondary:p?"#9CA3AF":"#6B7280",textPrimary:p?"#FFFFFF":"#111827",borderLight:p?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:p?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:p?"#1A1D25":"#FFFFFF",bgSecondary:p?"#0F1117":"#F9FAFB",hoverBg:p?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},x=e&&"title"in e&&!("name"in e),D=e,[T,w]=react.useState(e?_d(e,d):null),[A,L]=react.useState(false),[N,H]=react.useState(false),[$,j]=react.useState(false),[ce,J]=react.useState(null),[re,ue]=react.useState(new Date),[Ce,Se]=react.useState(false),[F,R]=react.useState(false),[S,B]=react.useState(""),[_,te]=react.useState(false),[ne,de]=react.useState(false),[Fe,Q]=react.useState(false),[Ye,Te]=react.useState(""),Ke=react.useRef(null),[Tt,Et]=react.useState(""),Ze=react.useRef(null),[vt,bt]=react.useState(""),[Gt,me]=react.useState(false),[I,se]=react.useState([]);react.useEffect(()=>{if(e){let P=_d(e,d);w(P),Te(P.description||""),Et(P.name||"");}},[e?.id,d]),react.useEffect(()=>()=>{Ke.current&&clearTimeout(Ke.current),Ze.current&&clearTimeout(Ze.current);},[]);let pe=react.useCallback(P=>{w(P),x&&o&&D?o(qg(P,D)):r&&r(P);},[x,D,o,r]),ze=react.useCallback(()=>{L(false),H(false),j(false),J(null),R(false),B(""),te(false);},[]),X=react.useCallback((P,Z)=>{if(!T)return;let ye={...T,[P]:Z};pe(ye);},[T,pe]),Be=react.useCallback(P=>{Te(P),Ke.current&&clearTimeout(Ke.current),Ke.current=setTimeout(()=>{if(T){let Z={...T,description:P};pe(Z);}},800);},[T,pe]),G=react.useCallback(P=>{Et(P),Ze.current&&clearTimeout(Ze.current),Ze.current=setTimeout(()=>{if(T&&P.trim()){let Z={...T,name:P.trim()};pe(Z);}},800);},[T,pe]),Y=react.useCallback(P=>{let Z=P.map(ye=>{let O={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:ye};return ye.type.startsWith("image/")&&(O.preview=URL.createObjectURL(ye)),O});se(ye=>[...ye,...Z]);},[]),He=react.useCallback(P=>{se(Z=>{let ye=Z.find(O=>O.id===P);return ye?.preview&&URL.revokeObjectURL(ye.preview),Z.filter(O=>O.id!==P)});},[]),Re=react.useCallback(async()=>{if(!(!T||!vt.trim()&&I.length===0||!C)){me(true);try{let P=Id(vt,v),Z=[];if(I.length>0&&h){let ye=I.map(O=>O.file);Z=await h(ye);}await C(T.id,vt.trim(),P.length>0?P:void 0,Z.length>0?Z:void 0),bt(""),I.forEach(ye=>{ye.preview&&URL.revokeObjectURL(ye.preview);}),se([]);}finally{me(false);}}},[T,vt,I,C,v,h]),je=react.useCallback(P=>{let Z=typeof P=="string"?new Date(P):P,O=new Date().getTime()-Z.getTime(),V=Math.floor(O/6e4),ve=Math.floor(O/36e5),Le=Math.floor(O/864e5);return V<1?n==="es"?"Ahora":"Just now":V<60?n==="es"?`Hace ${V} min`:`${V}m ago`:ve<24?n==="es"?`Hace ${ve}h`:`${ve}h ago`:Le<7?n==="es"?`Hace ${Le}d`:`${Le}d ago`:Z.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),We=react.useCallback(P=>{if(!T)return;let Z=T.progress||0;P==="completed"?Z=100:P==="in-progress"&&Z===0?Z=10:P==="todo"&&(Z=0);let ye={...T,status:P,progress:Z};pe(ye),L(false);},[T,pe]),le=react.useCallback((P,Z)=>{if(!T)return;let ye={...T,startDate:P,endDate:Z};pe(ye);},[T,pe]),Ie=react.useCallback(()=>{let P=re.getFullYear(),Z=re.getMonth(),ye=new Date(P,Z,1),V=new Date(P,Z+1,0).getDate(),ve=ye.getDay(),Le=[],Ae=new Date(P,Z,0).getDate();for(let ae=ve-1;ae>=0;ae--)Le.push({date:new Date(P,Z-1,Ae-ae),isCurrentMonth:false});for(let ae=1;ae<=V;ae++)Le.push({date:new Date(P,Z,ae),isCurrentMonth:true});let z=42-Le.length;for(let ae=1;ae<=z;ae++)Le.push({date:new Date(P,Z+1,ae),isCurrentMonth:false});return Le},[re]),ee=react.useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),de(false),!T||!l)return;let Z=Array.from(P.dataTransfer.files);if(Z.length!==0){Q(true);try{await l(T.id,Z);}finally{Q(false);}}},[T,l]),_e=react.useCallback(async P=>{if(!T||!l||!P.target.files)return;let Z=Array.from(P.target.files);if(Z.length!==0){Q(true);try{await l(T.id,Z);}finally{Q(false);}P.target.value="";}},[T,l]),Na=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),de(true);},[]),ge=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),de(false);},[]),Ve=react.useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),Oe=react.useCallback(P=>P.startsWith("image/")?lucideReact.Image:P.includes("pdf")||P.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!T?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",p?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:f("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",p?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:f("text-xs font-mono",p?"text-[#6B7280]":"text-gray-400"),children:T.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",p?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:a,className:f("p-1.5 rounded transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let P=T.progress===100?0:100,ye={...T,progress:P,status:P===100?"completed":"todo"};pe(ye);},className:f("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",T.progress===100?"bg-green-500 border-green-500":p?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:T.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Tt,onChange:P=>G(P.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",T.progress===100?"line-through text-[#6B7280]":p?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:f("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{ze(),L(!A);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",T.progress===100||T.status==="completed"?"bg-green-500/20 text-green-400":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/20 text-blue-400":p?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:T.progress===100||T.status==="completed"?n==="es"?"COMPLETADO":"DONE":T.progress&&T.progress>0||T.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:A&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>L(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(P=>jsxRuntime.jsxs("button",{onClick:()=>We(P.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",T.status===P.id&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:p?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:f("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{ze(),j(!$);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[T.assignees&&T.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[T.assignees.slice(0,3).map((P,Z)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:P.color||"#8B5CF6"},title:P.name,children:P.initials||P.name.slice(0,2).toUpperCase()},Z)),T.assignees.length>3&&jsxRuntime.jsxs("span",{className:f("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:["+",T.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:f("text-sm",p?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",p?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>j(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className: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",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:d.length>0?d.map(P=>{let Z=T.assignees?.some(ye=>ye.name===P.name);return jsxRuntime.jsxs("button",{onClick:()=>{let ye=T.assignees||[],O;Z?O=ye.filter(V=>V.name!==P.name):O=[...ye,P],X("assignees",O);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",Z&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:P.color||"#8B5CF6"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:f("flex-1",p?"text-white":"text-gray-900"),children:P.name}),Z&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",p?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:f("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{J(ce?null:"start"),ue(T.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[T.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:f("mx-1",p?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),T.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>J(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",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:f("w-44 py-2 border-r",p?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,Z=new Date(P);Z.setDate(P.getDate()+1);let ye=new Date(P);ye.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let O=new Date(P);O.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let V=new Date(P);V.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let ve=new Date(P);ve.setDate(P.getDate()+14);let Le=new Date(P);return Le.setDate(P.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:P,display:P.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Z,display:Z.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:ye,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:O,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:V,display:V.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:ve,display:ve.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Le,display:Le.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((z,ae)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",p?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(ce==="start"){let Ue=T.endDate&&z.date>T.endDate?z.date:T.endDate;le(z.date,Ue),J("end");}else {let Ue=T.startDate&&z.date<T.startDate?z.date:T.startDate;le(Ue,z.date),J(null);}},children:[jsxRuntime.jsx("span",{children:z.label}),jsxRuntime.jsx("span",{className:f("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:z.display})]},ae))})(),jsxRuntime.jsx("div",{className:f("border-t mt-2 pt-2",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{le(void 0,void 0),J(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",p?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:f("text-xs mb-3 px-2 py-1 rounded",p?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:ce==="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",p?"text-white":"text-gray-900"),children:re.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>ue(new Date),className:f("p-1 rounded text-sm transition-colors",p?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>ue(new Date(re.getFullYear(),re.getMonth()-1)),className:f("p-1 rounded",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>ue(new Date(re.getFullYear(),re.getMonth()+1)),className:f("p-1 rounded",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(P=>jsxRuntime.jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",p?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:Ie().map((P,Z)=>{let ye=P.date.toDateString()===new Date().toDateString(),O=T.startDate?.toDateString()===P.date.toDateString(),V=T.endDate?.toDateString()===P.date.toDateString(),ve=O||V,Le=T.startDate&&T.endDate&&P.date>=T.startDate&&P.date<=T.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Ae=new Date(P.date);if(ce==="start"){let z=T.endDate&&Ae>T.endDate?Ae:T.endDate;le(Ae,z),J("end");}else {let z=T.startDate&&Ae<T.startDate?Ae:T.startDate;le(z,Ae),J(null);}},className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(p?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(p?"text-white":"text-gray-900"),ye&&"ring-2 ring-[#3B82F6]",O&&"bg-[#3B82F6] text-white",V&&!O&&"bg-[#7C3AED] text-white",Le&&!ve&&(p?"bg-[#7C3AED]/20":"bg-purple-100"),!ve&&(p?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},Z)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{ze(),H(!N);},className:f("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",T.priority==="high"||T.priority==="urgent"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":T.priority==="low"?"bg-green-500/20 text-green-400":p?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:T.priority?T.priority==="high"||T.priority==="urgent"?n==="es"?"Alta":"High":T.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>H(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]",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(P=>jsxRuntime.jsxs("button",{onClick:()=>{X("priority",P.id),H(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",T.priority===P.id&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:p?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:f("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:f("text-sm",p?"text-white":"text-gray-900"),children:T.startDate&&T.endDate?`${Math.ceil((T.endDate.getTime()-T.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full border-2",p?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Ce?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:T.progress||0,onChange:P=>{let Z=parseInt(P.target.value),ye=T.status;Z===100?ye="completed":Z>0?ye="in-progress":ye="todo";let O={...T,progress:Z,status:ye};pe(O);},onBlur:()=>Se(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",p?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>Se(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",p?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium min-w-[40px]",p?"text-white":"text-gray-900"),children:[T.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:f("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Nr,{selectedTags:T.tags||[],availableTags:m,onChange:P=>{X("tags",P);},onCreateTag:i,theme:k})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:f("w-4 h-4 mt-1.5",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24 mt-1",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[T.dependencies&&T.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:T.dependencies.map(P=>{let Z=b.find(ye=>ye.id===P);return jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",p?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[Z?.name||P.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let ye=(T.dependencies||[]).filter(O=>O!==P);X("dependencies",ye);},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"})})]},P)})}),jsxRuntime.jsxs("button",{onClick:()=>{ze(),R(!F);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:f("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{R(false),B("");}}),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]",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("p-2 border-b",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:S,onChange:P=>B(P.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",p?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:b.length>0?b.filter(P=>P.id!==T.id).filter(P=>S===""||P.name.toLowerCase().includes(S.toLowerCase())).map(P=>{let Z=T.dependencies?.includes(P.id);return jsxRuntime.jsxs("button",{onClick:()=>{let ye=T.dependencies||[],O;Z?O=ye.filter(V=>V!==P.id):O=[...ye,P.id],X("dependencies",O);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",Z&&(p?"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",Z?"bg-blue-500 border-blue-500":p?"border-white/30":"border-gray-300"),children:Z&&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",p?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("span",{className:f("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",p?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:f("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{ze(),te(!_);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:T.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:f("text-sm",p?"text-white":"text-gray-900"),children:Xr.find(P=>P.value===T.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",p?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>te(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",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Xr.map(P=>{let Z=T.color===P.value;return jsxRuntime.jsx("button",{onClick:()=>{X("color",P.value),te(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",Z&&"ring-2 ring-offset-2",p?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:Z?P.value:void 0},title:P.name,children:Z&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:f("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:T.isMilestone||false,onChange:P=>X("isMilestone",P.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",T.isMilestone?"bg-purple-500 border-purple-500":p?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:f("text-sm",p?"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",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:f("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",p?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:Ye,onChange:P=>Be(P.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",p?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-2 text-sm mt-2 transition-colors",p?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",p?"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",p?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",p?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),T.subtasks&&T.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:T.subtasks.map(P=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",P.progress===100?"bg-green-500 border-green-500":p?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:P.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:f("text-sm",P.progress===100?"line-through text-[#6B7280]":p?"text-white":"text-gray-900"),children:P.name})]},P.id))}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",p?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:f("p-1 rounded transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold mb-3",p?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",p?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:c.map(P=>{let Z=Oe(P.type),ye=P.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[ye&&P.thumbnailUrl?jsxRuntime.jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",p?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(Z,{className:f("w-5 h-5",p?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:f("text-sm font-medium truncate block hover:underline",p?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("p",{className:f("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:Ve(P.size)})]}),u&&jsxRuntime.jsx("button",{onClick:()=>u(P.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",p?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},P.id)})}),jsxRuntime.jsxs("div",{onDragOver:Na,onDragLeave:ge,onDrop:ee,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",ne?p?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":p?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",Fe&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:_e,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!l||Fe}),Fe?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",p?"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",ne?"text-blue-500":p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:ne?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!l&&jsxRuntime.jsx("p",{className:f("text-xs mt-1",p?"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",p?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold",p?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",p?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:y.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:y.map(P=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:P.user?.color||"#8B5CF6"},children:P.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:f("text-sm font-medium",p?"text-white":"text-gray-900"),children:P.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:f("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:je(P.createdAt)})]}),jsxRuntime.jsx("div",{className:f("text-sm",p?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Bd,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(Z=>{let ye=Z.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:Z.url,target:"_blank",rel:"noopener noreferrer",className:f("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[ye?jsxRuntime.jsx(lucideReact.Image,{className:f("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:f("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:f("text-xs truncate max-w-[100px]",p?"text-white":"text-gray-900"),children:Z.name})]},Z.id)})})]})]},P.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",p?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:f("text-sm",p?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:f("p-4 border-t",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Ld,{value:vt,onChange:bt,onSubmit:Re,users:v,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!C,isSubmitting:Gt,theme:s,locale:n,currentUser:g,enableEmoji:true,enableAttachments:!!h,pendingFiles:I,onFilesSelect:Y,onRemoveFile:He})})]})]})]})})}function js(){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:d,isLoading:m,error:i,children:c,availableTags:l=[],onCreateTag:u,attachmentsByCard:b,onUploadAttachments:y,onDeleteAttachment:C,comments:g,onAddComment:v,currentUser:h,mentionableUsers:p,onTaskOpen:k}){let[x,D]=js(),[T,w]=react.useState(null),A=o?.theme||"dark",L=A==="dark"||A==="neutral",N=L?"dark":"",H=react.useCallback((B,_)=>{t.onCardUpdate?.(B,_);},[t]),$=react.useCallback((B,_)=>{t.onColumnUpdate?.(B,{title:_});},[t]),j=react.useCallback(B=>{t.onColumnDelete?.(B);},[t]),ce=["todo","in-progress","completed"],J=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),re=react.useMemo(()=>{let B=new Map;return e.columns.forEach(_=>{let te=_.cardIds.map(ne=>e.cards.find(de=>de.id===ne)).filter(ne=>ne!==void 0).sort((ne,de)=>ne.position-de.position);B.set(_.id,te);}),B},[e.cards,e.columns]),ue=react.useMemo(()=>e.cards.map(B=>({id:B.id,name:B.title,startDate:B.startDate?new Date(B.startDate):void 0,endDate:B.endDate?new Date(B.endDate):void 0,progress:B.progress||0,status:B.columnId,priority:B.priority?.toLowerCase(),dependencies:Array.isArray(B.dependencies)?B.dependencies.map(_=>typeof _=="string"?_:_.taskId):[]})),[e.cards]),Ce=react.useCallback(B=>{let{active:_}=B,te=e.cards.find(ne=>ne.id===_.id);te&&D({isDragging:true,draggedCardId:te.id,sourceColumnId:te.columnId,targetColumnId:te.columnId});},[e.cards,D]),Se=react.useCallback(B=>{let{active:_,over:te}=B;if(!te||!e.cards.find(Fe=>Fe.id===_.id))return;let de=null;te.data.current?.type==="column"?de=te.id:te.data.current?.type==="card"&&(de=e.cards.find(Q=>Q.id===te.id)?.columnId||null),de&&de!==x.targetColumnId&&D({...x,targetColumnId:de});},[e.cards,x,D]),F=react.useCallback(async B=>{let{active:_,over:te}=B;if(D({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!te)return;let ne=e.cards.find(Ye=>Ye.id===_.id);if(!ne)return;let de,Fe;if(te.data.current?.type==="column"){de=te.id;let Ye=re.get(de)||[];Fe=Ms(Ye,0);}else {let Ye=e.cards.find(Tt=>Tt.id===te.id);if(!Ye)return;de=Ye.columnId;let Te=re.get(de)||[],Ke=Te.findIndex(Tt=>Tt.id===te.id);Fe=Ms(Te,Ke);}let Q=e.columns.find(Ye=>Ye.id===de);if(Q&&Q.wipLimit&&Q.wipLimitType==="hard"){let Ye=re.get(de)||[];if(ne.columnId!==de&&Ye.length>=Q.wipLimit){t.onWipLimitExceeded?.(Q,ne);return}}(ne.columnId!==de||ne.position!==Fe)&&await t.onCardMove?.(ne.id,de,Fe);},[e.cards,e.columns,re,t,D]),R=react.useCallback(B=>{w(B),a?.(B),k?.(B.id);},[a,k]),S=react.useCallback(B=>{t.onCardUpdate?.(B.id,B),w(B);},[t]);return m?jsxRuntime.jsx("div",{className:f("asakaa-board",N,n),style:d,children:jsxRuntime.jsx(lf,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:f("asakaa-board",N,n),style:d,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(cd,{themeName:A,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:J,collisionDetection:core$1.closestCorners,onDragStart:Ce,onDragOver:Se,onDragEnd:F,children:[jsxRuntime.jsxs("div",{className:f("asakaa-board",N,n),style:d,"data-theme":A,children:[e.columns.sort((B,_)=>B.position-_.position).map(B=>{let _=re.get(B.id)||[],te=!ce.includes(B.id);return jsxRuntime.jsx(bo,{column:B,cards:_,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:R,onCardUpdate:H,onColumnRename:$,onColumnDelete:j,isDeletable:te,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},B.id)}),c]}),jsxRuntime.jsx(core$1.DragOverlay,{children:x.draggedCardId?jsxRuntime.jsx(cr,{card:e.cards.find(B=>B.id===x.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(mr,{task:T,isOpen:!!T,onClose:()=>w(null),onCardUpdate:S,theme:L?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:l,onCreateTag:u,attachments:T?b?.get(T.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:C,availableTasks:ue,comments:g,onAddComment:v,currentUser:h,mentionableUsers:p})]})}function lf({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 uf={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)"},gf={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)"},ff={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},bf={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function hf({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let i=c=>{d.current&&!d.current.contains(c.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:d,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,c)=>i.position-c.position).map((i,c)=>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:c<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.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 yf({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[d,m]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let b=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),!(a||r||o))return null;let l=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(b=>b.handler),u=async(b,y)=>{if(y){m(b);try{await y();}catch(C){console.error(`Export ${b} failed:`,C);}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:l.map((b,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(b.id,b.handler),disabled:d!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:d===b.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"})}):b.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:b.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})})]})}function vf({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 Ys({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:d,onExportExcel:m,translations:i}){let c=r==="dark"?uf:gf,l={...o==="es"?ff:bf,...i},u=n||d||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:c.bgGrid,borderColor:c.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(yf,{theme:c,t:l,onExportCSV:n,onExportJSON:d,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:c.borderLight}})]}),t&&(s?jsxRuntime.jsx(hf,{columns:e,onSelect:t,theme:c,t:l,createTaskLabel:a}):jsxRuntime.jsx(vf,{onClick:()=>t(),label:a||l.newTask}))]})})}function Xs({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[d,m]=react.useState(""),i=react.useCallback(()=>{let u=d.trim();u&&(e(u),m(""),n(false));},[d,e]),c=react.useCallback(u=>{u.key==="Enter"?(u.preventDefault(),i()):u.key==="Escape"&&(m(""),n(false));},[i]),l=react.useCallback(()=>{setTimeout(()=>{d.trim()||n(false);},150);},[d]);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:d,onChange:u=>m(u.target.value),onKeyDown:c,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!d.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 Js({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:d="dark",locale:m="es"}){let[i,c]=react.useState(false),[l,u]=react.useState(false),[b,y]=react.useState(""),[C,g]=react.useState([]),[v,h]=react.useState(""),[p,k]=react.useState(""),[x,D]=react.useState(""),[T,w]=react.useState(false),[A,L]=react.useState(false),[N,H]=react.useState(false),$=react.useRef(null),j=react.useRef(null),ce={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"},J=react.useCallback(()=>{y(""),g([]),h(""),k(""),D(""),w(false),L(false),H(false),c(false);},[]);react.useEffect(()=>{i&&$.current&&$.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let F=R=>{j.current&&!j.current.contains(R.target)&&(b.trim()||J());};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[i,b,J]);let re=react.useCallback(async()=>{let F=b.trim();if(!(!F||l)){u(true);try{await t({name:F,columnId:e,assigneeIds:C.length>0?C:void 0,startDate:v?new Date(v):void 0,endDate:p?new Date(p):void 0,priority:x||void 0}),y(""),g([]),h(""),k(""),D(""),w(!1),L(!1),H(!1),$.current?.focus();}catch(R){console.error("Error creating card:",R);}finally{u(false);}}},[b,e,C,v,p,x,t,l]),ue=react.useCallback(F=>{F.key==="Enter"&&!F.shiftKey?(F.preventDefault(),re()):F.key==="Escape"&&J();},[re,J]),Ce=react.useCallback(F=>{g(R=>R.includes(F)?R.filter(S=>S!==F):[...R,F]);},[]),Se=d==="dark";return i?jsxRuntime.jsxs("div",{ref:j,className:f("rounded-lg overflow-hidden shadow-lg",Se?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:$,type:"text",value:b,onChange:F=>y(F.target.value),onKeyDown:ue,placeholder:ce.placeholder,disabled:l,className:f("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Se?"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(!T),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||C.length>0?"bg-emerald-500/20 text-emerald-400":Se?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ce.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),C.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:C.length})]}),jsxRuntime.jsx("button",{onClick:()=>L(!A),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",A||v||p?"bg-blue-500/20 text-blue-400":Se?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ce.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>H(!N),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",N||x?x==="urgent"?"bg-red-500/20 text-red-400":x==="high"?"bg-orange-500/20 text-orange-400":x==="medium"?"bg-yellow-500/20 text-yellow-400":x==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Se?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ce.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:re,disabled:!b.trim()||l,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:l?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):ce.save})]})]}),T&&a.length>0&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",Se?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(F=>jsxRuntime.jsxs("button",{onClick:()=>Ce(F.id),className:f("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",C.includes(F.id)?"bg-emerald-500 text-white":Se?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[F.avatar?jsxRuntime.jsx("img",{src:F.avatar,alt:F.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",C.includes(F.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:F.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:F.name.split(" ")[0]})]},F.id))})}),A&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",Se?"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",Se?"text-gray-500":"text-gray-400"),children:ce.startDate}),jsxRuntime.jsx("input",{type:"date",value:v,onChange:F=>h(F.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",Se?"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",Se?"text-gray-500":"text-gray-400"),children:ce.endDate}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:F=>k(F.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",Se?"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",Se?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(F=>jsxRuntime.jsx("button",{onClick:()=>D(x===F?"":F),className:f("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",x===F?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[F]} text-white`:Se?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:ce[F]},F))})})]}):jsxRuntime.jsxs("button",{onClick:()=>c(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",Se?"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:ce.buttonLabel})]})}var _o=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 ac(e={}){return new _o(e)}var yo=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 Zs(e,t){let a=r=>jsxRuntime.jsx(yo,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ei({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:d,onOpenAIUsage:m,shortcut:i="k",className:c=""}){let[l,u]=react.useState(false),[b,y]=react.useState(""),[C,g]=react.useState("home"),[v,h]=react.useState(""),[p,k]=react.useState("");react.useEffect(()=>{let w=A=>{(A.metaKey||A.ctrlKey)&&A.key===i&&(A.preventDefault(),u(L=>!L)),A.key==="Escape"&&(u(false),g("home"),y(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),react.useEffect(()=>{l||(g("home"),y(""),h(""),k(""));},[l]);let x=react.useCallback(()=>{u(false);},[]),D=react.useCallback(w=>{let[A,L]=w.split(":");switch(A){case "create-card":g("create-card");break;case "create-card-in":h(L||"");break;case "navigate":L?(a?.(L),x()):g("navigate");break;case "search":r?.(b),x();break;case "priority":g("priority");break;case "set-priority":p&&L&&(o?.(p,L),x());break;case "assign":g("assign");break;case "assign-user":p&&L&&(s?.(p,L),x());break;case "ai":g("ai");break;case "ai-generate-plan":n?.(),x();break;case "ai-predict-risks":d?.(),x();break;case "ai-usage":m?.(),x();break;case "back":g("home");break;}},[b,p,t,a,r,o,s,n,d,m,x]),T=react.useCallback(()=>{v&&b.trim()&&(t?.(v,b.trim()),x());},[v,b,t,x]);return l?jsxRuntime.jsx(it,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:x,children:jsxRuntime.jsx("div",{className:`command-palette ${c}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:b,onValueChange:y,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:C==="create-card"&&v?"Type card title and press Enter...":C==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&C==="create-card"&&v&&T();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),C==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect: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(A=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:A},A))})]},w.id))})]}),C==="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))})]}),C==="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 A=e.columns.find(L=>L.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:A?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(L=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:L},L))})]},w.id)})})]}),C==="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 nc(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=nd(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let d=nd(t[n]||"");if(d.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-d.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${d.length})`);continue}for(;d.length<a.length;)d.push("");let i={};a.forEach((b,y)=>{i[b]=d[y]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let l=o.get(c),p={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(p),l.cardIds.push(p.id);}catch(d){s.push(`Line ${n+1}: ${d instanceof Error?d.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 nd(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 sd(e,t){switch(t){case "json":return Gu(e);case "csv":return _u(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function id(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 Ls=react.createContext(null);function ld(){return react.useContext(Ls)}var dd=react.createContext(null);function cd({children:e,themeName:t}){return jsxRuntime.jsx(dd.Provider,{value:{themeName:t},children:e})}function uo(){return react.useContext(dd)}function it({children:e,container:t}){let[a,r]=react.useState(false),o=ld(),s=uo();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:d,themeName:m}=o,i={"--asakaa-color-background-primary":d.bgPrimary,"--asakaa-color-background-secondary":d.bgSecondary,"--asakaa-color-background-card":d.bgGrid,"--asakaa-color-background-hover":d.hoverBg,"--asakaa-color-text-primary":d.textPrimary,"--asakaa-color-text-secondary":d.textSecondary,"--asakaa-color-text-tertiary":d.textTertiary,"--asakaa-color-text-inverse":d.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":d.border,"--asakaa-color-border-hover":d.borderLight,"--asakaa-color-border-subtle":d.borderLight,"--asakaa-color-interactive-primary":d.accent,"--asakaa-color-interactive-primaryHover":d.accentHover,"--asakaa-color-interactive-primaryBorder":`${d.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${d.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${d.accent}33`,"--asakaa-color-status-success":d.statusCompleted,"--asakaa-color-status-warning":d.milestone,"--asakaa-color-status-error":d.criticalPath,"--asakaa-color-danger":d.criticalPath,"--asakaa-color-danger-border":`${d.criticalPath}4D`,"--asakaa-color-danger-background":`${d.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${d.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 fd={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},Zu="#BDC3C7",Qu=({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 jr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),d=react.useRef(null),m=react.useRef(null),i=()=>{if(!m.current)return;let b=m.current.getBoundingClientRect(),y=window.innerHeight,w=window.innerWidth,g=160,v=220,h=4,u=b.right-g;u<10&&(u=b.left),u+g>w-10&&(u=w-g-10);let k=y-b.bottom,x=b.top,D;k>=v+h?D=b.bottom+h:x>=v+h?D=b.top-v-h:D=k>=x?b.bottom+h:Math.max(10,b.top-v-h),n({top:D,left:u}),o(true);};react.useEffect(()=>{let b=y=>{d.current&&!d.current.contains(y.target)&&!m.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[r]),react.useEffect(()=>{let b=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[r]);let c=b=>{t(b),o(false);},l=e?fd[e]:null,p=l?.color||Zu;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?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}30 inset`:"none"},title:l?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:p,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(it,{children:jsxRuntime.jsxs("div",{ref:d,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(fd).map(([b,y])=>jsxRuntime.jsxs("button",{onClick:()=>c(b),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:y.color,background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Qu,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.label}),e===b&&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"})})]},b)),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:()=>c(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: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("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 eg=[{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 Ro({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,d]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),p=(uo()?.themeName||"dark")==="dark",b=()=>{if(!i.current)return;let u=i.current.getBoundingClientRect(),k=window.innerHeight,x=window.innerWidth,D=320,T=380,C=4,I=u.left;I+D>x-10&&(I=x-D-10),I<10&&(I=10);let L=k-u.bottom,N=u.top,_;L>=T+C?_=u.bottom+C:N>=T+C?_=u.top-T-C:_=L>=N?u.bottom+C:Math.max(10,u.top-T-C),d({top:_,left:I}),s(true);};react.useEffect(()=>{let u=k=>{m.current&&!m.current.contains(k.target)&&!i.current?.contains(k.target)&&s(false);};if(o)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[o]),react.useEffect(()=>{let u=k=>{k.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[o]);let y=u=>{let k=new Date,x=I=>{let L=I.getFullYear(),N=String(I.getMonth()+1).padStart(2,"0"),_=String(I.getDate()).padStart(2,"0");return `${L}-${N}-${_}`},D=x(k),T=new Date(k);T.setDate(T.getDate()+u);let C=x(T);a(D,C),s(false);},w=()=>{if(!e||!t)return "Set date";let u=T=>{if(T instanceof Date)return T;if(typeof T!="string"||!T.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=T.split("-").map(Number);if(C.length!==3||C.some(_=>isNaN(_)))return null;let I=C[0],L=C[1],N=C[2];return I===void 0||L===void 0||N===void 0?null:new Date(I,L-1,N)},k=u(e),x=u(t);if(!k||!x||isNaN(k.getTime())||isNaN(x.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[k.getMonth()]} ${k.getDate()} \u2013 ${D[x.getMonth()]} ${x.getDate()}`},g=e&&t,h=(()=>{if(!t)return false;let u=typeof t=="string"?new Date(t):t,k=new Date;return k.setHours(0,0,0,0),u<k})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):b(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:g?`${w()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:w()})]}),o&&jsxRuntime.jsx(it,{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:p?"#1A1D25":"#FFFFFF",border:`1px solid ${p?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:p?"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:p?"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:p?"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:eg.map(u=>jsxRuntime.jsx("button",{onClick:()=>y(u.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",k.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:k=>{k.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",k.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:u.label},u.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"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:u=>a(u.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:u=>a(e,u.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"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:u=>{u.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:u=>{u.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Yr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[d,m]=react.useState(""),[i,c]=react.useState({top:0,left:0}),l=react.useRef(null),p=react.useRef(null),b=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),u=window.innerHeight,k=window.innerWidth,x=300,D=380,T=4,C=h.right-x;C<10&&(C=h.left),C+x>k-10&&(C=k-x-10);let I=u-h.bottom,L=h.top,N;I>=D+T?N=h.bottom+T:L>=D+T?N=h.top-D-T:N=I>=L?h.bottom+T:Math.max(10,h.top-D-T),c({top:N,left:C}),n(true);};react.useEffect(()=>{let h=u=>{l.current&&!l.current.contains(u.target)&&!p.current?.contains(u.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=u=>{u.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let y=h=>{let u=e.some(k=>k.id===h.id);a(u?e.filter(k=>k.id!==h.id):[...e,h]);},w=t.filter(h=>h.name.toLowerCase().includes(d.toLowerCase())),g=e.slice(0,o),v=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>s?n(false):b(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[g.map(h=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),v>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",v]})]}):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(it,{children:jsxRuntime.jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:d,onChange:h=>m(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:w.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):w.map(h=>{let u=e.some(k=>k.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>y(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:k=>{k.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:h.color,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.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:h.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:u?"#3b82f6":"transparent"},children:u?"\u2713":""})]},h.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 yn(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let i=m.dependencies.map(c=>{if(typeof c=="string")return c;let l=c;return l.taskId||l.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,d=m=>{if(!s.has(m)){s.add(m),n.add(m);let i=r.get(m)||[];for(let c of i){if(!s.has(c)&&d(c))return true;if(n.has(c))return true}}return n.delete(m),false};return d(a)}function zo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[d,m]=react.useState(false),[i,c]=react.useState(""),[l,p]=react.useState(t.length>0),[b,y]=react.useState({top:0,left:0}),[w,g]=react.useState(null),v=react.useRef(null),h=react.useRef(null),u=()=>{if(!h.current)return;let C=h.current.getBoundingClientRect(),I=window.innerHeight,L=window.innerWidth,N=300,_=l?380:120,O=4,W=C.right-N;W<10&&(W=C.left),W+N>L-10&&(W=L-N-10);let le=I-C.bottom,de=C.top,pe;le>=_+O?pe=C.bottom+O:de>=_+O?pe=C.top-_-O:pe=le>=de?C.bottom+O:Math.max(10,C.top-_-O),y({top:pe,left:W}),m(true);};react.useEffect(()=>{if(!d||!h.current)return;let C=h.current.getBoundingClientRect(),I=window.innerHeight,L=window.innerWidth,N=300,_=l?380:120,O=4,W=C.right-N;W<10&&(W=C.left),W+N>L-10&&(W=L-N-10);let le=I-C.bottom,de=C.top,pe;le>=_+O?pe=C.bottom+O:de>=_+O?pe=C.top-_-O:pe=le>=de?C.bottom+O:Math.max(10,C.top-_-O),y({top:pe,left:W});},[l,d]),react.useEffect(()=>{let C=I=>{v.current&&!v.current.contains(I.target)&&!h.current?.contains(I.target)&&(m(false),c(""));};if(d)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[d]),react.useEffect(()=>{let C=I=>{I.key==="Escape"&&(m(false),c(""));};if(d)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[d]);let k=C=>{let I=t.includes(C),L=a.find(N=>N.id===C);if(g(null),I){let N=t.filter(_=>_!==C);r(N),N.length===0&&p(false);}else {if(s&&yn(a,C,e)){let _=`Cannot add "${L?.title||C}" as dependency - would create circular reference`;g(_),n?.(C,L?.title||C),setTimeout(()=>g(null),3e3);return}r([...t,C]),p(true);}},x=()=>{let C=!l;p(C),C||r([]);},D=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(i.toLowerCase())||C.id.toLowerCase().includes(i.toLowerCase())),T=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:h,onClick:()=>d?m(false):u(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:T,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:T},children:t.length})]}),d&&jsxRuntime.jsx(it,{children:jsxRuntime.jsxs("div",{ref:v,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${b.top}px`,left:`${b.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[w&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:w})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:x,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:C=>c(C.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(C=>{let I=t.includes(C.id);return jsxRuntime.jsxs("button",{onClick:()=>k(C.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:L=>{L.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:L=>{L.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:I?"#3b82f6":"transparent",borderColor:I?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:I&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:C.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:C.id})]})]},C.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),p(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 cr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:d=[],allCards:m=[]})=>{let{attributes:i,listeners:c,setNodeRef:l,transform:p,transition:b,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),w={transform:gn.Transform.toString(p),transition:b};if(t)return jsxRuntime.jsx("div",{ref:l,style:w,...i,...c,onClick:()=>a?.(e),children:t(e)});let g=d.filter(k=>e.assignedUserIds?.includes(k.id)),v=e.progress===100,h=(e.attachments||[]).filter(k=>k.type.startsWith("image/")),u={...w,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:l,style:u,className:f("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,onClick:k=>{k.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:k=>{k.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsxRuntime.jsx("img",{src:h[0].url,alt:h[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:k=>{k.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((k,x)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:k.url,alt:k.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";}}),x===3&&h.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:["+",h.length-4]})})]},k.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:v?"line-through":"none",opacity:v?.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:k=>k.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(jr,{priority:e.priority,onChange:k=>n?.(e.id,{priority:k})})}),jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Ro,{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:(k,x)=>n?.(e.id,{startDate:k,endDate:x})})}),d.length>0&&jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Yr,{assignedUsers:g,availableUsers:d,onChange:k=>n?.(e.id,{assignedUserIds:k.map(x=>x.id)})})}),jsxRuntime.jsx("div",{onClick:k=>k.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(zo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(k=>typeof k=="string"?k:k.taskId):[],availableTasks:m,onChange:k=>n?.(e.id,{dependencies:k})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(k=>jsxRuntime.jsx("span",{className:"asakaa-label",children:k},k))}),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)));cr.displayName="Card";var vn={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Nd=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Dd({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,d]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),c=[...Object.entries(vn).map(([g,v])=>({id:g,label:v.label,color:v.color,icon:v.icon})),...r.filter(g=>!Object.keys(vn).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let g=vn[e];if(g)return {...g,id:e};let v=r.find(h=>h.id===e);return v?{id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}:{...vn.todo,id:"todo"}},p=()=>{if(!i.current)return;let g=i.current.getBoundingClientRect(),v=window.innerHeight,h=window.innerWidth,u=180,k=280,x=4,D=g.right-u;D<10&&(D=g.left),D+u>h-10&&(D=h-u-10);let T=v-g.bottom,C=g.top,I;T>=k+x?I=g.bottom+x:C>=k+x?I=g.top-k-x:I=T>=C?g.bottom+x:Math.max(10,g.top-k-x),d({top:I,left:D}),s(true);};react.useEffect(()=>{let g=v=>{m.current&&!m.current.contains(v.target)&&!i.current?.contains(v.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=v=>{v.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let b=g=>{t(g),s(false);},y=l(),w=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):p(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${w}10`,boxShadow:`0 0 0 2px ${w}30 inset`},title:y.label,children:jsxRuntime.jsx(Nd,{icon:y.icon,color:w})}),o&&jsxRuntime.jsx(it,{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:c.map(g=>jsxRuntime.jsxs("button",{onClick:()=>b(g.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:g.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Nd,{icon:g.icon,color:g.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:g.label}),e===g.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g.id))})]})})]})}function Sd({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[d,m]=react.useState(false),[i,c]=react.useState(e),[l,p]=react.useState({top:0,left:0}),b=react.useRef(null),y=react.useRef(null),w=react.useRef(null);react.useEffect(()=>{if(s&&y.current){let u=y.current.getBoundingClientRect();p({top:u.bottom+window.scrollY+8,left:u.left+window.scrollX});}},[s]),react.useEffect(()=>{let u=k=>{b.current&&!b.current.contains(k.target)&&!y.current?.contains(k.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),react.useEffect(()=>{let u=k=>{k.key==="Escape"&&(n(false),m(false),c(e));};if(s)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[s,e]),react.useEffect(()=>{d&&w.current&&(w.current.focus(),w.current.select());},[d]);let g=()=>{m(true),c(e);},v=()=>{let u=i.trim();u&&u!==e&&t(u),m(false),n(false),c(e);},h=u=>{u.key==="Enter"?v():u.key==="Escape"&&(m(false),c(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:y,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(it,{children:jsxRuntime.jsx("div",{ref:b,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${l.top}px`,left:`${l.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:d?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:w,type:"text",value:i,onChange:u=>c(u.target.value),onKeyDown:h,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:g,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),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 bo=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:d,availableUsers:m,allCards:i,enableVirtualization:c,cardHeight:l=120,isCollapsed:p,onToggleCollapse:b,onColumnRename:y,onColumnDelete:w,isDeletable:g=false,className:v})=>{let{setNodeRef:h,isOver:u}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),k=react.useRef(null),x=c??Ql(t.length),D=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>l,enabled:x});if(a)return jsxRuntime.jsx("div",{ref:h,className:v,children:a(e,t)});let C=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let N=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:N}:N>=80?{state:"warning",percentage:N}:N>=60?{state:"approaching",percentage:N}:{state:"ok",percentage:N}})(),I=C.state==="exceeded",L=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:f("asakaa-column",u&&"ring-2 ring-asakaa-accent-blue",I&&"ring-2 ring-asakaa-accent-red",v),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(L()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&C.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${C.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[C.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"})]}),C.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"})]}),C.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"})}),C.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"})]})]}),(y||w)&&jsxRuntime.jsx(Sd,{columnTitle:e.title,onRename:N=>y?.(e.id,N),onDelete:w?()=>w(e.id):void 0,isDeletable:g}),b&&jsxRuntime.jsx("button",{onClick:b,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),!p&&jsxRuntime.jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:x?"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"})}):x?jsxRuntime.jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(N=>{let _=t[N.index];return _?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${N.start}px)`},children:jsxRuntime.jsx(cr,{card:_,render:r,onClick:n,onUpdate:d,availableUsers:m,allCards:i})},_.id):null})}):t.map(N=>jsxRuntime.jsx(cr,{card:N,render:r,onClick:n,onUpdate:d,availableUsers:m,allCards:i},N.id))})})]})});bo.displayName="Column";function Us({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),d=react.useRef(null);react.useEffect(()=>{r&&d.current&&(d.current.focus(),d.current.select());},[r]);let m=()=>{let c=s.trim();c&&c!==e?t(c):n(e),o(false);},i=c=>{c.key==="Enter"?m():c.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:d,type:"text",value:s,onChange:c=>n(c.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})}function xg(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Id(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(d=>{let m=d.name.toLowerCase(),i=m.replace(/\s+/g,""),c=m.split(/\s+/);return !!(i===s||m===s||c.some(l=>l===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function kg(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function wg(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Cg=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function Ld({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:d="dark",locale:m="es",currentUser:i,enableEmoji:c=true,enableAttachments:l=true,pendingFiles:p=[],onFilesSelect:b,onRemoveFile:y,maxFileSizeMB:w=10}){let g=d==="dark",[v,h]=react.useState(false),[u,k]=react.useState([]),[x,D]=react.useState(0),[T,C]=react.useState(null),[I,L]=react.useState(false),N=react.useRef(null),_=react.useRef(null),O=react.useRef(null),W=react.useRef(null),le=react.useCallback((S,B)=>{let G=xg(S,B);if(C(G),G){let Z=r.filter(ae=>ae.name.toLowerCase().includes(G.query)||ae.email&&ae.email.toLowerCase().includes(G.query)).slice(0,5);k(Z),h(Z.length>0),D(0);}else h(false),k([]);},[r]),de=S=>{let B=S.target.value;t(B),le(B,S.target.selectionStart||0);},pe=()=>{N.current&&le(e,N.current.selectionStart||0);},ke=react.useCallback(S=>{if(!T||!N.current)return;let B=e.slice(0,T.start),G=e.slice(T.end),Z=`@${S.name.replace(/\s+/g,"")} `,ae=B+Z+G;t(ae),h(false),C(null),setTimeout(()=>{if(N.current){let ie=T.start+Z.length;N.current.selectionStart=ie,N.current.selectionEnd=ie,N.current.focus();}},0);},[T,e,t]),Te=S=>{if(v&&u.length>0)switch(S.key){case "ArrowDown":S.preventDefault(),D(B=>B<u.length-1?B+1:0);break;case "ArrowUp":S.preventDefault(),D(B=>B>0?B-1:u.length-1);break;case "Enter":{S.preventDefault();let B=u[x];B&&ke(B);break}case "Tab":{S.preventDefault();let B=u[x];B&&ke(B);break}case "Escape":S.preventDefault(),h(false);break}else S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),a());};react.useEffect(()=>{let S=B=>{_.current&&!_.current.contains(B.target)&&N.current&&!N.current.contains(B.target)&&h(false),W.current&&!W.current.contains(B.target)&&L(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let xe=react.useCallback(S=>{if(!N.current)return;let B=N.current.selectionStart||e.length,G=e.slice(0,B)+S+e.slice(B);t(G),L(false),setTimeout(()=>{if(N.current){let Z=B+S.length;N.current.selectionStart=Z,N.current.selectionEnd=Z,N.current.focus();}},0);},[e,t]),F=react.useCallback(S=>{if(!b||!S.target.files)return;let B=Array.from(S.target.files),G=w*1024*1024,Z=B.filter(ae=>ae.size>G?(console.warn(`File ${ae.name} exceeds max size of ${w}MB`),false):true);Z.length>0&&b(Z),S.target.value="";},[b,w]),R=react.useCallback(S=>S.type.startsWith("image/")?lucideReact.Image:S.type.includes("pdf")||S.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(v&&_.current){let S=_.current.children[x];S&&S.scrollIntoView({block:"nearest"});}},[x,v]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(S=>{let B=R(S.file),G=S.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:f("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",g?"bg-white/10":"bg-gray-100"),children:[G&&S.preview?jsxRuntime.jsx("img",{src:S.preview,alt:S.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(B,{className:f("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:f("text-xs truncate",g?"text-white":"text-gray-900"),children:S.file.name}),jsxRuntime.jsx("p",{className:f("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:wg(S.file.size)})]}),y&&jsxRuntime.jsx("button",{onClick:()=>y(S.id),className:f("p-0.5 rounded-full transition-colors",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:f("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:f("flex items-center gap-1 px-2 py-2 rounded-lg",g?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>L(!I),disabled:s||n,className:f("p-1 rounded transition-colors flex-shrink-0",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&jsxRuntime.jsx(framerMotion.motion.div,{ref:W,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:f("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:Cg.map(S=>jsxRuntime.jsx("button",{type:"button",onClick:()=>xe(S),className:f("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",g?"hover:bg-white/10":"hover:bg-gray-100"),children:S},S))})})})]}),l&&b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>O.current?.click(),disabled:s||n,className:f("p-1.5 rounded transition-colors",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:m==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:O,type:"file",multiple:true,onChange:F,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("input",{ref:N,type:"text",value:e,onChange:de,onSelect:pe,onKeyDown:Te,placeholder:o||(m==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,className:f("flex-1 bg-transparent text-sm outline-none min-w-[100px]",g?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(s||n)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()&&p.length===0||s,className:f("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":g?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&u.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:_,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:f("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:u.map((S,B)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>ke(S),className:f("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",B===x?g?"bg-white/10":"bg-gray-100":g?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:S.color||"#8B5CF6"},children:kg(S.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:f("text-sm font-medium truncate",g?"text-white":"text-gray-900"),children:S.name}),S.email&&jsxRuntime.jsx("p",{className:f("text-xs truncate",g?"text-[#6B7280]":"text-gray-500"),children:S.email})]})]},S.id))})})]})]})]})}function Bd({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((d,m)=>d.type==="mention"?jsxRuntime.jsx("span",{className:f("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:d.value},m):jsxRuntime.jsx("span",{children:d.value},m))})}var Tn=["#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[d,m]=react.useState(false),[i,c]=react.useState(""),[l,p]=react.useState(false),[b,y]=react.useState(Tn[10]||"#3B82F6"),[w,g]=react.useState({top:0,left:0}),v=react.useRef(null),h=react.useRef(null),u=react.useRef(null),k=react.useRef(null),x=t.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),D=t.some(N=>N.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(d&&h.current){let N=h.current.getBoundingClientRect();g({top:N.bottom+6,left:N.left});}},[d]),react.useEffect(()=>{let N=_=>{let O=_.target,W=v.current?.contains(O),le=u.current?.contains(O);!W&&!le&&(m(false),c(""),p(false));};if(d)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[d]),react.useEffect(()=>{d&&k.current&&k.current.focus();},[d]);let T=N=>{let _=e.some(O=>O.id===N.id);a(_?e.filter(O=>O.id!==N.id):[...e,N]);},C=async()=>{if(!(!r||!i.trim())){p(true);try{let N=await r(i.trim(),b);N&&(a([...e,N]),c(""),y(Tn[Math.floor(Math.random()*Tn.length)]||"#3B82F6"));}finally{p(false);}}},I=(N,_)=>{_.stopPropagation(),a(e.filter(O=>O.id!==N));},L={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:v,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&m(!d),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:L,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:d&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:u,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:w.top,left:w.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:k,type:"text",value:i,onChange:N=>c(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&&C();}})}),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(N.id,_),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:x.length>0?x.map(N=>{let _=e.some(O=>O.id===N.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>T(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:_?`${N.color}15`:"transparent",color:o.textPrimary},onMouseEnter:O=>{_||(O.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:O=>{_||(O.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}),_&&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:Tn.map(N=>jsxRuntime.jsx("button",{type:"button",onClick:()=>y(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:b===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxRuntime.jsxs("button",{type:"button",onClick:C,disabled:l,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:b,color:"#FFFFFF",opacity:l?.7:1},children:[l?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function 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 Od({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 Xr=[{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 _d(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 qg(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 mr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:d=[],availableTags:m=[],onCreateTag:i,attachments:c=[],onUploadAttachments:l,onDeleteAttachment:p,availableTasks:b=[],comments:y=[],onAddComment:w,currentUser:g,mentionableUsers:v=[],onUploadCommentAttachments:h}){let u=s==="dark",k={textTertiary:u?"#6B7280":"#9CA3AF",textSecondary:u?"#9CA3AF":"#6B7280",textPrimary:u?"#FFFFFF":"#111827",borderLight:u?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:u?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:u?"#1A1D25":"#FFFFFF",bgSecondary:u?"#0F1117":"#F9FAFB",hoverBg:u?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},x=e&&"title"in e&&!("name"in e),D=e,[T,C]=react.useState(e?_d(e,d):null),[I,L]=react.useState(false),[N,_]=react.useState(false),[O,W]=react.useState(false),[le,de]=react.useState(null),[pe,ke]=react.useState(new Date),[Te,xe]=react.useState(false),[F,R]=react.useState(false),[S,B]=react.useState(""),[G,Z]=react.useState(false),[ae,ie]=react.useState(false),[Fe,Q]=react.useState(false),[Ye,Ne]=react.useState(""),Ke=react.useRef(null),[Tt,Et]=react.useState(""),Ze=react.useRef(null),[vt,bt]=react.useState(""),[Gt,ce]=react.useState(false),[A,oe]=react.useState([]);react.useEffect(()=>{if(e){let P=_d(e,d);C(P),Ne(P.description||""),Et(P.name||"");}},[e?.id,d]),react.useEffect(()=>()=>{Ke.current&&clearTimeout(Ke.current),Ze.current&&clearTimeout(Ze.current);},[]);let me=react.useCallback(P=>{C(P),x&&o&&D?o(qg(P,D)):r&&r(P);},[x,D,o,r]),ze=react.useCallback(()=>{L(false),_(false),W(false),de(null),R(false),B(""),Z(false);},[]),X=react.useCallback((P,J)=>{if(!T)return;let he={...T,[P]:J};me(he);},[T,me]),Be=react.useCallback(P=>{Ne(P),Ke.current&&clearTimeout(Ke.current),Ke.current=setTimeout(()=>{if(T){let J={...T,description:P};me(J);}},800);},[T,me]),V=react.useCallback(P=>{Et(P),Ze.current&&clearTimeout(Ze.current),Ze.current=setTimeout(()=>{if(T&&P.trim()){let J={...T,name:P.trim()};me(J);}},800);},[T,me]),Y=react.useCallback(P=>{let J=P.map(he=>{let z={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:he};return he.type.startsWith("image/")&&(z.preview=URL.createObjectURL(he)),z});oe(he=>[...he,...J]);},[]),He=react.useCallback(P=>{oe(J=>{let he=J.find(z=>z.id===P);return he?.preview&&URL.revokeObjectURL(he.preview),J.filter(z=>z.id!==P)});},[]),Re=react.useCallback(async()=>{if(!(!T||!vt.trim()&&A.length===0||!w)){ce(true);try{let P=Id(vt,v),J=[];if(A.length>0&&h){let he=A.map(z=>z.file);J=await h(he);}await w(T.id,vt.trim(),P.length>0?P:void 0,J.length>0?J:void 0),bt(""),A.forEach(he=>{he.preview&&URL.revokeObjectURL(he.preview);}),oe([]);}finally{ce(false);}}},[T,vt,A,w,v,h]),je=react.useCallback(P=>{let J=typeof P=="string"?new Date(P):P,z=new Date().getTime()-J.getTime(),j=Math.floor(z/6e4),ye=Math.floor(z/36e5),Le=Math.floor(z/864e5);return j<1?n==="es"?"Ahora":"Just now":j<60?n==="es"?`Hace ${j} min`:`${j}m ago`:ye<24?n==="es"?`Hace ${ye}h`:`${ye}h ago`:Le<7?n==="es"?`Hace ${Le}d`:`${Le}d ago`:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),We=react.useCallback(P=>{if(!T)return;let J=T.progress||0;P==="completed"?J=100:P==="in-progress"&&J===0?J=10:P==="todo"&&(J=0);let he={...T,status:P,progress:J};me(he),L(false);},[T,me]),se=react.useCallback((P,J)=>{if(!T)return;let he={...T,startDate:P,endDate:J};me(he);},[T,me]),Ie=react.useCallback(()=>{let P=pe.getFullYear(),J=pe.getMonth(),he=new Date(P,J,1),j=new Date(P,J+1,0).getDate(),ye=he.getDay(),Le=[],Ae=new Date(P,J,0).getDate();for(let te=ye-1;te>=0;te--)Le.push({date:new Date(P,J-1,Ae-te),isCurrentMonth:false});for(let te=1;te<=j;te++)Le.push({date:new Date(P,J,te),isCurrentMonth:true});let U=42-Le.length;for(let te=1;te<=U;te++)Le.push({date:new Date(P,J+1,te),isCurrentMonth:false});return Le},[pe]),ee=react.useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),ie(false),!T||!l)return;let J=Array.from(P.dataTransfer.files);if(J.length!==0){Q(true);try{await l(T.id,J);}finally{Q(false);}}},[T,l]),_e=react.useCallback(async P=>{if(!T||!l||!P.target.files)return;let J=Array.from(P.target.files);if(J.length!==0){Q(true);try{await l(T.id,J);}finally{Q(false);}P.target.value="";}},[T,l]),Na=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),ie(true);},[]),ue=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),ie(false);},[]),Ve=react.useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),Oe=react.useCallback(P=>P.startsWith("image/")?lucideReact.Image:P.includes("pdf")||P.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!T?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",u?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:f("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:f("text-xs font-mono",u?"text-[#6B7280]":"text-gray-400"),children:T.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",u?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",u?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",u?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:a,className:f("p-1.5 rounded transition-colors",u?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let P=T.progress===100?0:100,he={...T,progress:P,status:P===100?"completed":"todo"};me(he);},className:f("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",T.progress===100?"bg-green-500 border-green-500":u?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:T.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Tt,onChange:P=>V(P.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",T.progress===100?"line-through text-[#6B7280]":u?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{ze(),L(!I);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",T.progress===100||T.status==="completed"?"bg-green-500/20 text-green-400":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/20 text-blue-400":u?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:T.progress===100||T.status==="completed"?n==="es"?"COMPLETADO":"DONE":T.progress&&T.progress>0||T.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>L(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(P=>jsxRuntime.jsxs("button",{onClick:()=>We(P.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",T.status===P.id&&(u?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:u?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{ze(),W(!O);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[T.assignees&&T.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[T.assignees.slice(0,3).map((P,J)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:P.color||"#8B5CF6"},title:P.name,children:P.initials||P.name.slice(0,2).toUpperCase()},J)),T.assignees.length>3&&jsxRuntime.jsxs("span",{className:f("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:["+",T.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:f("text-sm",u?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",u?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:O&&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-[200px] max-h-[280px] overflow-y-auto",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:d.length>0?d.map(P=>{let J=T.assignees?.some(he=>he.name===P.name);return jsxRuntime.jsxs("button",{onClick:()=>{let he=T.assignees||[],z;J?z=he.filter(j=>j.name!==P.name):z=[...he,P],X("assignees",z);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",J&&(u?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:P.color||"#8B5CF6"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:f("flex-1",u?"text-white":"text-gray-900"),children:P.name}),J&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",u?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{de(le?null:"start"),ke(T.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[T.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:f("mx-1",u?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),T.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>de(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",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:f("w-44 py-2 border-r",u?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,J=new Date(P);J.setDate(P.getDate()+1);let he=new Date(P);he.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let z=new Date(P);z.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let j=new Date(P);j.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let ye=new Date(P);ye.setDate(P.getDate()+14);let Le=new Date(P);return Le.setDate(P.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:P,display:P.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:he,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:z,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:j,display:j.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:ye,display:ye.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Le,display:Le.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((U,te)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",u?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(le==="start"){let Ue=T.endDate&&U.date>T.endDate?U.date:T.endDate;se(U.date,Ue),de("end");}else {let Ue=T.startDate&&U.date<T.startDate?U.date:T.startDate;se(Ue,U.date),de(null);}},children:[jsxRuntime.jsx("span",{children:U.label}),jsxRuntime.jsx("span",{className:f("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:U.display})]},te))})(),jsxRuntime.jsx("div",{className:f("border-t mt-2 pt-2",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{se(void 0,void 0),de(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",u?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:f("text-xs mb-3 px-2 py-1 rounded",u?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:le==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:f("font-medium",u?"text-white":"text-gray-900"),children:pe.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:()=>ke(new Date),className:f("p-1 rounded text-sm transition-colors",u?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>ke(new Date(pe.getFullYear(),pe.getMonth()-1)),className:f("p-1 rounded",u?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>ke(new Date(pe.getFullYear(),pe.getMonth()+1)),className:f("p-1 rounded",u?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(P=>jsxRuntime.jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",u?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:Ie().map((P,J)=>{let he=P.date.toDateString()===new Date().toDateString(),z=T.startDate?.toDateString()===P.date.toDateString(),j=T.endDate?.toDateString()===P.date.toDateString(),ye=z||j,Le=T.startDate&&T.endDate&&P.date>=T.startDate&&P.date<=T.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Ae=new Date(P.date);if(le==="start"){let U=T.endDate&&Ae>T.endDate?Ae:T.endDate;se(Ae,U),de("end");}else {let U=T.startDate&&Ae<T.startDate?Ae:T.startDate;se(U,Ae),de(null);}},className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(u?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(u?"text-white":"text-gray-900"),he&&"ring-2 ring-[#3B82F6]",z&&"bg-[#3B82F6] text-white",j&&!z&&"bg-[#7C3AED] text-white",Le&&!ye&&(u?"bg-[#7C3AED]/20":"bg-purple-100"),!ye&&(u?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},J)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{ze(),_(!N);},className:f("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",T.priority==="high"||T.priority==="urgent"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":T.priority==="low"?"bg-green-500/20 text-green-400":u?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:T.priority?T.priority==="high"||T.priority==="urgent"?n==="es"?"Alta":"High":T.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>_(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]",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(P=>jsxRuntime.jsxs("button",{onClick:()=>{X("priority",P.id),_(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",T.priority===P.id&&(u?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:u?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:f("text-sm",u?"text-white":"text-gray-900"),children:T.startDate&&T.endDate?`${Math.ceil((T.endDate.getTime()-T.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full border-2",u?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Te?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:T.progress||0,onChange:P=>{let J=parseInt(P.target.value),he=T.status;J===100?he="completed":J>0?he="in-progress":he="todo";let z={...T,progress:J,status:he};me(z);},onBlur:()=>xe(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",u?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>xe(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",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium min-w-[40px]",u?"text-white":"text-gray-900"),children:[T.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Nr,{selectedTags:T.tags||[],availableTags:m,onChange:P=>{X("tags",P);},onCreateTag:i,theme:k})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:f("w-4 h-4 mt-1.5",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24 mt-1",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[T.dependencies&&T.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:T.dependencies.map(P=>{let J=b.find(he=>he.id===P);return jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",u?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[J?.name||P.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let he=(T.dependencies||[]).filter(z=>z!==P);X("dependencies",he);},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"})})]},P)})}),jsxRuntime.jsxs("button",{onClick:()=>{ze(),R(!F);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:f("text-sm",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{R(false),B("");}}),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]",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("p-2 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:S,onChange:P=>B(P.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",u?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:b.length>0?b.filter(P=>P.id!==T.id).filter(P=>S===""||P.name.toLowerCase().includes(S.toLowerCase())).map(P=>{let J=T.dependencies?.includes(P.id);return jsxRuntime.jsxs("button",{onClick:()=>{let he=T.dependencies||[],z;J?z=he.filter(j=>j!==P.id):z=[...he,P.id],X("dependencies",z);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",u?"hover:bg-white/5":"hover:bg-gray-50",J&&(u?"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",J?"bg-blue-500 border-blue-500":u?"border-white/30":"border-gray-300"),children:J&&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",u?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("span",{className:f("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",u?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{ze(),Z(!G);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:T.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:f("text-sm",u?"text-white":"text-gray-900"),children:Xr.find(P=>P.value===T.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",u?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:G&&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",u?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Xr.map(P=>{let J=T.color===P.value;return jsxRuntime.jsx("button",{onClick:()=>{X("color",P.value),Z(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",J&&"ring-2 ring-offset-2",u?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:J?P.value:void 0},title:P.name,children:J&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",u?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:T.isMilestone||false,onChange:P=>X("isMilestone",P.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",T.isMilestone?"bg-purple-500 border-purple-500":u?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:f("text-sm",u?"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",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:f("w-4 h-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",u?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:Ye,onChange:P=>Be(P.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",u?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-2 text-sm mt-2 transition-colors",u?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",u?"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",u?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",u?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),T.subtasks&&T.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:T.subtasks.map(P=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",P.progress===100?"bg-green-500 border-green-500":u?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:P.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:f("text-sm",P.progress===100?"line-through text-[#6B7280]":u?"text-white":"text-gray-900"),children:P.name})]},P.id))}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",u?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:f("p-1 rounded transition-colors",u?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",u?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",u?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold mb-3",u?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",u?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:c.map(P=>{let J=Oe(P.type),he=P.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[he&&P.thumbnailUrl?jsxRuntime.jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(J,{className:f("w-5 h-5",u?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:f("text-sm font-medium truncate block hover:underline",u?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("p",{className:f("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:Ve(P.size)})]}),p&&jsxRuntime.jsx("button",{onClick:()=>p(P.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",u?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},P.id)})}),jsxRuntime.jsxs("div",{onDragOver:Na,onDragLeave:ue,onDrop:ee,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",ae?u?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":u?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",Fe&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:_e,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!l||Fe}),Fe?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",u?"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",ae?"text-blue-500":u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f("text-sm",u?"text-[#9CA3AF]":"text-gray-500"),children:ae?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!l&&jsxRuntime.jsx("p",{className:f("text-xs mt-1",u?"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",u?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold",u?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",u?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:y.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:y.map(P=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:P.user?.color||"#8B5CF6"},children:P.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:f("text-sm font-medium",u?"text-white":"text-gray-900"),children:P.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:f("text-xs",u?"text-[#6B7280]":"text-gray-400"),children:je(P.createdAt)})]}),jsxRuntime.jsx("div",{className:f("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Bd,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(J=>{let he=J.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:J.url,target:"_blank",rel:"noopener noreferrer",className:f("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",u?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[he?jsxRuntime.jsx(lucideReact.Image,{className:f("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:f("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:f("text-xs truncate max-w-[100px]",u?"text-white":"text-gray-900"),children:J.name})]},J.id)})})]})]},P.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",u?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:f("text-sm",u?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:f("p-4 border-t",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Ld,{value:vt,onChange:bt,onSubmit:Re,users:v,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!w,isSubmitting:Gt,theme:s,locale:n,currentUser:g,enableEmoji:true,enableAttachments:!!h,pendingFiles:A,onFilesSelect:Y,onRemoveFile:He})})]})]})]})})}function js(){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:d,isLoading:m,error:i,children:c,availableTags:l=[],onCreateTag:p,attachmentsByCard:b,onUploadAttachments:y,onDeleteAttachment:w,comments:g,onAddComment:v,currentUser:h,mentionableUsers:u,onTaskOpen:k}){let[x,D]=js(),[T,C]=react.useState(null),I=o?.theme||"dark",L=I==="dark"||I==="neutral",N=L?"dark":"",_=react.useCallback((B,G)=>{t.onCardUpdate?.(B,G);},[t]),O=react.useCallback((B,G)=>{t.onColumnUpdate?.(B,{title:G});},[t]),W=react.useCallback(B=>{t.onColumnDelete?.(B);},[t]),le=["todo","in-progress","completed"],de=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),pe=react.useMemo(()=>{let B=new Map;return e.columns.forEach(G=>{let Z=G.cardIds.map(ae=>e.cards.find(ie=>ie.id===ae)).filter(ae=>ae!==void 0).sort((ae,ie)=>ae.position-ie.position);B.set(G.id,Z);}),B},[e.cards,e.columns]),ke=react.useMemo(()=>e.cards.map(B=>({id:B.id,name:B.title,startDate:B.startDate?new Date(B.startDate):void 0,endDate:B.endDate?new Date(B.endDate):void 0,progress:B.progress||0,status:B.columnId,priority:B.priority?.toLowerCase(),dependencies:Array.isArray(B.dependencies)?B.dependencies.map(G=>typeof G=="string"?G:G.taskId):[]})),[e.cards]),Te=react.useCallback(B=>{let{active:G}=B,Z=e.cards.find(ae=>ae.id===G.id);Z&&D({isDragging:true,draggedCardId:Z.id,sourceColumnId:Z.columnId,targetColumnId:Z.columnId});},[e.cards,D]),xe=react.useCallback(B=>{let{active:G,over:Z}=B;if(!Z||!e.cards.find(Fe=>Fe.id===G.id))return;let ie=null;Z.data.current?.type==="column"?ie=Z.id:Z.data.current?.type==="card"&&(ie=e.cards.find(Q=>Q.id===Z.id)?.columnId||null),ie&&ie!==x.targetColumnId&&D({...x,targetColumnId:ie});},[e.cards,x,D]),F=react.useCallback(async B=>{let{active:G,over:Z}=B;if(D({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!Z)return;let ae=e.cards.find(Ye=>Ye.id===G.id);if(!ae)return;let ie,Fe;if(Z.data.current?.type==="column"){ie=Z.id;let Ye=pe.get(ie)||[];Fe=Ms(Ye,0);}else {let Ye=e.cards.find(Tt=>Tt.id===Z.id);if(!Ye)return;ie=Ye.columnId;let Ne=pe.get(ie)||[],Ke=Ne.findIndex(Tt=>Tt.id===Z.id);Fe=Ms(Ne,Ke);}let Q=e.columns.find(Ye=>Ye.id===ie);if(Q&&Q.wipLimit&&Q.wipLimitType==="hard"){let Ye=pe.get(ie)||[];if(ae.columnId!==ie&&Ye.length>=Q.wipLimit){t.onWipLimitExceeded?.(Q,ae);return}}(ae.columnId!==ie||ae.position!==Fe)&&await t.onCardMove?.(ae.id,ie,Fe);},[e.cards,e.columns,pe,t,D]),R=react.useCallback(B=>{C(B),a?.(B),k?.(B.id);},[a,k]),S=react.useCallback(B=>{t.onCardUpdate?.(B.id,B),C(B);},[t]);return m?jsxRuntime.jsx("div",{className:f("asakaa-board",N,n),style:d,children:jsxRuntime.jsx(lf,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:f("asakaa-board",N,n),style:d,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(cd,{themeName:I,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:de,collisionDetection:core$1.closestCorners,onDragStart:Te,onDragOver:xe,onDragEnd:F,children:[jsxRuntime.jsxs("div",{className:f("asakaa-board",N,n),style:d,"data-theme":I,children:[e.columns.sort((B,G)=>B.position-G.position).map(B=>{let G=pe.get(B.id)||[],Z=!le.includes(B.id);return jsxRuntime.jsx(bo,{column:B,cards:G,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:R,onCardUpdate:_,onColumnRename:O,onColumnDelete:W,isDeletable:Z,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},B.id)}),c]}),jsxRuntime.jsx(core$1.DragOverlay,{children:x.draggedCardId?jsxRuntime.jsx(cr,{card:e.cards.find(B=>B.id===x.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(mr,{task:T,isOpen:!!T,onClose:()=>C(null),onCardUpdate:S,theme:L?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:l,onCreateTag:p,attachments:T?b?.get(T.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:w,availableTasks:ke,comments:g,onAddComment:v,currentUser:h,mentionableUsers:u})]})}function lf({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 uf={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)"},gf={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)"},ff={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},bf={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function hf({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let i=c=>{d.current&&!d.current.contains(c.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:d,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,c)=>i.position-c.position).map((i,c)=>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:c<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.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 yf({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[d,m]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let b=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),!(a||r||o))return null;let l=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(b=>b.handler),p=async(b,y)=>{if(y){m(b);try{await y();}catch(w){console.error(`Export ${b} failed:`,w);}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:l.map((b,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(b.id,b.handler),disabled:d!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:d===b.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"})}):b.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:b.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})})]})}function vf({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 Ys({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:d,onExportExcel:m,translations:i}){let c=r==="dark"?uf:gf,l={...o==="es"?ff:bf,...i},p=n||d||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:c.bgGrid,borderColor:c.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(yf,{theme:c,t:l,onExportCSV:n,onExportJSON:d,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:c.borderLight}})]}),t&&(s?jsxRuntime.jsx(hf,{columns:e,onSelect:t,theme:c,t:l,createTaskLabel:a}):jsxRuntime.jsx(vf,{onClick:()=>t(),label:a||l.newTask}))]})})}function Xs({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[d,m]=react.useState(""),i=react.useCallback(()=>{let p=d.trim();p&&(e(p),m(""),n(false));},[d,e]),c=react.useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(m(""),n(false));},[i]),l=react.useCallback(()=>{setTimeout(()=>{d.trim()||n(false);},150);},[d]);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:d,onChange:p=>m(p.target.value),onKeyDown:c,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!d.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 Js({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:d="dark",locale:m="es"}){let[i,c]=react.useState(false),[l,p]=react.useState(false),[b,y]=react.useState(""),[w,g]=react.useState([]),[v,h]=react.useState(""),[u,k]=react.useState(""),[x,D]=react.useState(""),[T,C]=react.useState(false),[I,L]=react.useState(false),[N,_]=react.useState(false),O=react.useRef(null),W=react.useRef(null),le={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"},de=react.useCallback(()=>{y(""),g([]),h(""),k(""),D(""),C(false),L(false),_(false),c(false);},[]);react.useEffect(()=>{i&&O.current&&O.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let F=R=>{W.current&&!W.current.contains(R.target)&&(b.trim()||de());};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[i,b,de]);let pe=react.useCallback(async()=>{let F=b.trim();if(!(!F||l)){p(true);try{await t({name:F,columnId:e,assigneeIds:w.length>0?w:void 0,startDate:v?new Date(v):void 0,endDate:u?new Date(u):void 0,priority:x||void 0}),y(""),g([]),h(""),k(""),D(""),C(!1),L(!1),_(!1),O.current?.focus();}catch(R){console.error("Error creating card:",R);}finally{p(false);}}},[b,e,w,v,u,x,t,l]),ke=react.useCallback(F=>{F.key==="Enter"&&!F.shiftKey?(F.preventDefault(),pe()):F.key==="Escape"&&de();},[pe,de]),Te=react.useCallback(F=>{g(R=>R.includes(F)?R.filter(S=>S!==F):[...R,F]);},[]),xe=d==="dark";return i?jsxRuntime.jsxs("div",{ref:W,className:f("rounded-lg overflow-hidden shadow-lg",xe?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:O,type:"text",value:b,onChange:F=>y(F.target.value),onKeyDown:ke,placeholder:le.placeholder,disabled:l,className:f("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",xe?"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:()=>C(!T),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||w.length>0?"bg-emerald-500/20 text-emerald-400":xe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:le.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),w.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:w.length})]}),jsxRuntime.jsx("button",{onClick:()=>L(!I),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",I||v||u?"bg-blue-500/20 text-blue-400":xe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:le.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>_(!N),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",N||x?x==="urgent"?"bg-red-500/20 text-red-400":x==="high"?"bg-orange-500/20 text-orange-400":x==="medium"?"bg-yellow-500/20 text-yellow-400":x==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":xe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:le.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:pe,disabled:!b.trim()||l,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:l?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):le.save})]})]}),T&&a.length>0&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",xe?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(F=>jsxRuntime.jsxs("button",{onClick:()=>Te(F.id),className:f("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",w.includes(F.id)?"bg-emerald-500 text-white":xe?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[F.avatar?jsxRuntime.jsx("img",{src:F.avatar,alt:F.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",w.includes(F.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:F.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:F.name.split(" ")[0]})]},F.id))})}),I&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",xe?"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",xe?"text-gray-500":"text-gray-400"),children:le.startDate}),jsxRuntime.jsx("input",{type:"date",value:v,onChange:F=>h(F.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",xe?"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",xe?"text-gray-500":"text-gray-400"),children:le.endDate}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:F=>k(F.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",xe?"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",xe?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(F=>jsxRuntime.jsx("button",{onClick:()=>D(x===F?"":F),className:f("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",x===F?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[F]} text-white`:xe?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:le[F]},F))})})]}):jsxRuntime.jsxs("button",{onClick:()=>c(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",xe?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:le.buttonLabel})]})}var _o=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 ac(e={}){return new _o(e)}var yo=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 Zs(e,t){let a=r=>jsxRuntime.jsx(yo,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ei({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:d,onOpenAIUsage:m,shortcut:i="k",className:c=""}){let[l,p]=react.useState(false),[b,y]=react.useState(""),[w,g]=react.useState("home"),[v,h]=react.useState(""),[u,k]=react.useState("");react.useEffect(()=>{let C=I=>{(I.metaKey||I.ctrlKey)&&I.key===i&&(I.preventDefault(),p(L=>!L)),I.key==="Escape"&&(p(false),g("home"),y(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i]),react.useEffect(()=>{l||(g("home"),y(""),h(""),k(""));},[l]);let x=react.useCallback(()=>{p(false);},[]),D=react.useCallback(C=>{let[I,L]=C.split(":");switch(I){case "create-card":g("create-card");break;case "create-card-in":h(L||"");break;case "navigate":L?(a?.(L),x()):g("navigate");break;case "search":r?.(b),x();break;case "priority":g("priority");break;case "set-priority":u&&L&&(o?.(u,L),x());break;case "assign":g("assign");break;case "assign-user":u&&L&&(s?.(u,L),x());break;case "ai":g("ai");break;case "ai-generate-plan":n?.(),x();break;case "ai-predict-risks":d?.(),x();break;case "ai-usage":m?.(),x();break;case "back":g("home");break;}},[b,u,t,a,r,o,s,n,d,m,x]),T=react.useCallback(()=>{v&&b.trim()&&(t?.(v,b.trim()),x());},[v,b,t,x]);return l?jsxRuntime.jsx(it,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:x,children:jsxRuntime.jsx("div",{className:`command-palette ${c}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:b,onValueChange:y,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:w==="create-card"&&v?"Type card title and press Enter...":w==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&w==="create-card"&&v&&T();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),w==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect: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(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(I=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:I},I))})]},C.id))})]}),w==="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(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${C.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:C.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.id))})]}),w==="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(C=>{let I=e.columns.find(L=>L.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:D,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:C.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:I?.title})]}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(L=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:L},L))})]},C.id)})})]}),w==="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 nc(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;
@@ -24,7 +24,7 @@
24
24
  font-size: 12px !important;
25
25
  color: rgba(255, 255, 255, 0.4) !important;
26
26
  pointer-events: none !important;
27
- `;let i=()=>{n.remove(),document.removeEventListener("keydown",c);},c=l=>{if(l.key==="Escape")i();else if(l.key==="ArrowLeft"&&a.length>1){let u=r>0?r-1:a.length-1;i(),o(u);}else if(l.key==="ArrowRight"&&a.length>1){let u=r<a.length-1?r+1:0;i(),o(u);}};if(n.onclick=i,document.addEventListener("keydown",c),a.length>1){let l=document.createElement("div");l.className="attachment-lightbox-dots",l.style.cssText=`
27
+ `;let i=()=>{n.remove(),document.removeEventListener("keydown",c);},c=l=>{if(l.key==="Escape")i();else if(l.key==="ArrowLeft"&&a.length>1){let p=r>0?r-1:a.length-1;i(),o(p);}else if(l.key==="ArrowRight"&&a.length>1){let p=r<a.length-1?r+1:0;i(),o(p);}};if(n.onclick=i,document.addEventListener("keydown",c),a.length>1){let l=document.createElement("div");l.className="attachment-lightbox-dots",l.style.cssText=`
28
28
  position: absolute !important;
29
29
  bottom: 48px !important;
30
30
  left: 50% !important;
@@ -34,15 +34,15 @@
34
34
  padding: 8px 12px !important;
35
35
  background: rgba(0, 0, 0, 0.4) !important;
36
36
  border-radius: 20px !important;
37
- `,l.onclick=y=>y.stopPropagation(),a.forEach((y,C)=>{let g=document.createElement("button");g.className=`attachment-lightbox-dot ${C===r?"active":""}`,g.style.cssText=`
37
+ `,l.onclick=y=>y.stopPropagation(),a.forEach((y,w)=>{let g=document.createElement("button");g.className=`attachment-lightbox-dot ${w===r?"active":""}`,g.style.cssText=`
38
38
  width: 8px !important;
39
39
  height: 8px !important;
40
40
  border-radius: 50% !important;
41
- background: ${C===r?"white":"rgba(255, 255, 255, 0.3)"} !important;
41
+ background: ${w===r?"white":"rgba(255, 255, 255, 0.3)"} !important;
42
42
  border: none !important;
43
43
  padding: 0 !important;
44
44
  cursor: pointer !important;
45
- `,g.onclick=v=>{v.stopPropagation(),i(),o(C);},l.appendChild(g);});let u=document.createElement("button");u.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",u.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',u.style.cssText=`
45
+ `,g.onclick=v=>{v.stopPropagation(),i(),o(w);},l.appendChild(g);});let p=document.createElement("button");p.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",p.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',p.style.cssText=`
46
46
  position: absolute !important;
47
47
  left: 0 !important;
48
48
  top: 0 !important;
@@ -55,7 +55,7 @@
55
55
  border: none !important;
56
56
  cursor: pointer !important;
57
57
  opacity: 0.5 !important;
58
- `,u.onmouseenter=()=>{u.style.opacity="1";},u.onmouseleave=()=>{u.style.opacity="0.5";},u.onclick=y=>{y.stopPropagation();let C=r>0?r-1:a.length-1;i(),o(C);};let b=document.createElement("button");b.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",b.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',b.style.cssText=`
58
+ `,p.onmouseenter=()=>{p.style.opacity="1";},p.onmouseleave=()=>{p.style.opacity="0.5";},p.onclick=y=>{y.stopPropagation();let w=r>0?r-1:a.length-1;i(),o(w);};let b=document.createElement("button");b.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",b.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',b.style.cssText=`
59
59
  position: absolute !important;
60
60
  right: 0 !important;
61
61
  top: 0 !important;
@@ -68,7 +68,7 @@
68
68
  border: none !important;
69
69
  cursor: pointer !important;
70
70
  opacity: 0.5 !important;
71
- `,b.onmouseenter=()=>{b.style.opacity="1";},b.onmouseleave=()=>{b.style.opacity="0.5";},b.onclick=y=>{y.stopPropagation();let C=r<a.length-1?r+1:0;i(),o(C);},n.appendChild(l),n.appendChild(u),n.appendChild(b);}n.appendChild(d),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function Nf(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 Df(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 ai(e){return e.startsWith("image/")}function nr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,d]=react.useState(false),[m,i]=react.useState(false),[c,l]=react.useState(null),u=react.useRef(null),b=react.useRef(e);b.current=e;let y=react.useCallback((w,A)=>{A.preventDefault(),A.stopPropagation();let L=b.current.filter($=>ai($.type)),N=L.findIndex($=>$.id===w.id),H=$=>{let j=b.current.filter(J=>ai(J.type)),ce=j[$];ce&&nc(ce.url,ce.name,j,$,H);};nc(w.url,w.name,L,N,H);},[]),C=react.useCallback(w=>{let A=[],L=[];return e.length+w.length>s?(L.push(`Maximum ${s} files allowed`),{valid:A,errors:L}):(w.forEach(N=>{if(N.size/1048576>r){L.push(`${N.name} is too large (max ${r}MB)`);return}if(o&&!o.some($=>N.type.match($))){L.push(`${N.name} has invalid file type`);return}A.push(N);}),{valid:A,errors:L})},[e.length,s,r,o]),g=react.useCallback(async w=>{let{valid:A,errors:L}=C(w);if(L.length>0){l(L.join(", ")),setTimeout(()=>l(null),5e3);return}if(A.length!==0){i(true),l(null);try{await t?.(A);}catch(N){l(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[C,t]),v=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),d(true);},[]),h=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),d(false);},[]),p=react.useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),k=react.useCallback(w=>{w.preventDefault(),w.stopPropagation(),d(false);let A=Array.from(w.dataTransfer.files);g(A);},[g]),x=react.useCallback(w=>{let A=w.target.files?Array.from(w.target.files):[];g(A),u.current&&(u.current.value="");},[g]),D=react.useCallback(()=>{u.current?.click();},[]),T=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:v,onDragLeave:h,onDragOver:p,onDrop:k,onClick:D,children:[jsxRuntime.jsx("input",{ref:u,type:"file",multiple:true,onChange:x,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"]})]})})]}),c&&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:c})]}),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:ai(w.type)&&w.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:A=>y(w,A),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:Df(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:Nf(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:()=>T(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 ri({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],aiInsights:m=[],attachments:i=[],onAddComment:c,onDeleteComment:l,onUploadAttachments:u,onDeleteAttachment:b,onSuggestAssignee:y,onGenerateSubtasks:C,onEstimateEffort:g,currentUserId:v="user-1"}){let[h,p]=react.useState("details"),[k,x]=react.useState(false),[D,T]=react.useState({}),[w,A]=react.useState(""),[L,N]=react.useState(false),[H,$]=react.useState({});if(!t||!e)return null;let j=react.useCallback(()=>{x(false),T({}),p("details"),A(""),$({}),a();},[a]),ce=react.useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),T({}),x(false));},[e.id,D,r]),J=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),j());},[e.id,o,j]),re=react.useCallback(()=>{c&&w.trim()&&(c(e.id,w.trim()),A(""));},[e.id,w,c]),ue=react.useCallback(async()=>{if(y){N(true);try{let S=await y(e);$(B=>({...B,assignees:S}));}catch(S){console.error("Failed to suggest assignee:",S);}finally{N(false);}}},[e,y]),Ce=react.useCallback(async()=>{if(C){N(true);try{let S=await C(e);$(B=>({...B,subtasks:S}));}catch(S){console.error("Failed to generate subtasks:",S);}finally{N(false);}}},[e,C]),Se=react.useCallback(async()=>{if(g){N(true);try{let S=await g(e);$(B=>({...B,effort:S}));}catch(S){console.error("Failed to estimate effort:",S);}finally{N(false);}}},[e,g]),F={...e,...D},R=s.filter(S=>F.assignedUserIds?.includes(S.id));return jsxRuntime.jsx(it,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:j,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),k?jsxRuntime.jsx("input",{type:"text",value:D.title??F.title,onChange:S=>T({...D,title:S.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:F.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[k?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:ce,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{x(false),T({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>x(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:J,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:j,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>p("details"),className:`card-detail-tab ${h==="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:()=>p("comments"),className:`card-detail-tab ${h==="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:()=>p("activity"),className:`card-detail-tab ${h==="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",d.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxRuntime.jsxs("button",{onClick:()=>p("attachments"),className:`card-detail-tab ${h==="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:()=>p("ai"),className:`card-detail-tab ${h==="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:[h==="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"}),k?jsxRuntime.jsx("textarea",{value:D.description??F.description??"",onChange:S=>T({...D,description:S.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:F.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),k?jsxRuntime.jsx("select",{multiple:true,value:D.assignedUserIds??F.assignedUserIds??[],onChange:S=>{let B=Array.from(S.target.selectedOptions,_=>_.value);T({...D,assignedUserIds:B});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:R.length>0?R.map(S=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:S.color},children:S.initials}),jsxRuntime.jsx("span",{children:S.name})]},S.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),k?jsxRuntime.jsxs("select",{value:D.priority??F.priority??"",onChange:S=>T({...D,priority:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:F.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:F.labels&&F.labels.length>0?F.labels.map(S=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:S},S)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),k?jsxRuntime.jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:F.startDate?new Date(F.startDate).toISOString().split("T")[0]:"",onChange:S=>T({...D,startDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.startDate?new Date(F.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),k?jsxRuntime.jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:F.endDate?new Date(F.endDate).toISOString().split("T")[0]:"",onChange:S=>T({...D,endDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.endDate?new Date(F.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),k?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??F.estimatedTime??"",onChange:S=>T({...D,estimatedTime:S.target.value?parseFloat(S.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:F.dependencies&&F.dependencies.length>0?F.dependencies.map(S=>{let B=typeof S=="string"?S:S.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",B.slice(-4)]},B)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:F.createdAt?new Date(F.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:w,onChange:S=>A(S.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:re,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(S=>{let B=s.find(_=>_.id===S.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[B&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:B.color},children:B.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:B?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(S.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(S.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:S.content})]},S.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),h==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:d.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:d.map(S=>{let B=s.find(_=>_.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[S.type.includes("CREATED")&&"\u2795",S.type.includes("UPDATED")&&"\u270F\uFE0F",S.type.includes("MOVED")&&"\u27A1\uFE0F",S.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",S.type.includes("COMMENT")&&"\u{1F4AC}",S.type.includes("ASSIGNED")&&"\u{1F464}",S.type.includes("PRIORITY")&&"\u{1F3AF}",S.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",S.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:B?.name||"Unknown"})," ",S.type.replace(/_/g," ").toLowerCase(),S.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:S.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(S.timestamp).toLocaleString()})]})]},S.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),h==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(nr,{cardId:e.id,attachments:i,onUpload:u?S=>u(e.id,S):void 0,onDelete:b,currentUserId:v,maxSizeMB:10,maxFiles:20})}),h==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:ue,disabled:L||!y,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:Ce,disabled:L||!C,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:Se,disabled:L||!g,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),H.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),H.assignees.map((S,B)=>{let _=s.find(te=>te.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[_&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:_.color},children:_.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:_?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:S.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(S.confidence*100).toFixed(0),"%"]})]})]},B)})]}),H.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),H.subtasks.map((S,B)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:S.title}),S.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:S.description}),S.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",S.estimatedTime,"h"]})]},B))]}),H.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[H.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(H.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(S=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${S.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:S.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:S.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:S.description}),S.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",S.suggestedAction]})]},S.id))]}),!H.assignees&&!H.subtasks&&!H.effort&&m.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function jo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[d,m]=react.useState({top:0,left:0}),i=react.useRef(null),c=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),u=window.innerHeight,b=window.innerWidth,y=4,C=l.left;C+o>b-10&&(C=b-o-10),C<10&&(C=10);let g=u-l.bottom,v=l.top,h;return g>=s+y?h=l.bottom+y:v>=s+y?h=l.top-s-y:g>=v?h=l.bottom+y:h=Math.max(10,l.top-s-y),{top:h,left:C}},[e,o,s]);return react.useEffect(()=>{t&&m(c());},[t,c]),react.useEffect(()=>{if(!t)return;let l=b=>{let y=b.target;i.current&&!i.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},u=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(u),document.removeEventListener("mousedown",l);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let l=u=>{u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsxRuntime.jsx(it,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${d.top}px`,left:`${d.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 Lf=["LOW","MEDIUM","HIGH","URGENT"],Bf=["todo","in-progress","review","done"];function si({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],onAddComment:m,onDeleteComment:i,currentUser:c,onAIGenerateDescription:l,onAICreateSubtasks:u,onAIFindSimilar:b,availableColumns:y=[],availableLabels:C=[],availableTags:g=[],onCreateTag:v,onUploadCoverImage:h,unsplashAccessKey:p,theme:k,onSubtasksChange:x,attachments:D=[],onUploadAttachments:T,onDeleteAttachment:w}){let A=uo(),L=k||A?.themeName||"dark",[N,H]=react.useState(e),[$,j]=react.useState(false),[ce,J]=react.useState(e?.subtasks||[]),[re,ue]=react.useState(false),[Ce,Se]=react.useState(""),[F,R]=react.useState(""),[S,B]=react.useState("all"),[_,te]=react.useState(false),[ne,de]=react.useState(false),[Fe,Q]=react.useState(false),[Ye,Te]=react.useState(false),[Ke,Tt]=react.useState(false),[Et,Ze]=react.useState(false),vt=react.useRef(null),bt=react.useRef(null),Gt=react.useRef(null),me=react.useRef(null),I=react.useRef(null),se=react.useRef(null),pe=react.useRef(null),ze=react.useRef(null),X=react.useRef(null),Be=react.useRef(null),G=react.useRef(null),Y=react.useRef(null);react.useEffect(()=>{e&&!N?(H({...e}),J(e.subtasks||[])):e&&N&&e.id!==N.id&&(H({...e}),J(e.subtasks||[]));},[e,N]),react.useEffect(()=>{let z=ae=>{let Ue=ae.target;me.current&&!me.current.contains(Ue)&&te(false),I.current&&!I.current.contains(Ue)&&de(false),se.current&&!se.current.contains(Ue)&&Q(false),pe.current&&!pe.current.contains(Ue)&&Te(false);};if(_||ne||Fe||Ye)return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[_,ne,Fe,Ye]),react.useEffect(()=>{if(!t)return;let z=ae=>{let Ue=ae.target,xt=Ue.tagName==="INPUT"||Ue.tagName==="TEXTAREA"||Ue.isContentEditable;if(ae.key==="Escape"){ae.preventDefault(),_||ne||Fe||Ye||Ke||Et?(te(false),de(false),Q(false),Te(false),Tt(false),Ze(false)):xt||a();return}if(xt&&ae.key!=="Escape")return;let st=ae.metaKey||ae.ctrlKey;switch(ae.key.toLowerCase()){case "s":ae.preventDefault(),te(true);break;case "a":ae.preventDefault(),Q(true);break;case "p":ae.preventDefault(),de(true);break;case "l":ae.preventDefault(),Te(true);break;case "d":st||(ae.preventDefault(),Tt(true),setTimeout(()=>ze.current?.focus(),0));break;case "e":st||(ae.preventDefault(),Ze(true));break;case "i":ae.preventDefault(),j(true),setTimeout(()=>bt.current?.focus(),0);break;case "t":ae.preventDefault(),ue(true);break;case "c":ae.preventDefault(),Gt.current?.focus();break}};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[t,a,_,ne,Fe,Ye,Ke,Et]);let He=react.useCallback(z=>{let ae=z.currentTarget.textContent?.trim()||"";if(N&&ae!==N.title){let Ue={...N,title:ae};H(Ue),r?.(N.id,{title:ae});}},[N,r]),Re=react.useCallback(z=>{z.key==="Enter"&&(z.preventDefault(),z.currentTarget.blur()),z.key==="Escape"&&(z.preventDefault(),z.currentTarget.textContent=N?.title||"",z.currentTarget.blur());},[N]),je=react.useCallback(()=>{N&&e&&N.description!==e.description&&r?.(N.id,{description:N.description}),j(false);},[N,e,r]),We=react.useCallback(z=>{if(N){let ae={...N,columnId:z};H(ae),r?.(N.id,{columnId:z}),te(false);}},[N,r]),le=react.useCallback(z=>{if(N){let ae={...N,priority:z};H(ae),r?.(N.id,{priority:z}),de(false);}},[N,r]),Ie=react.useCallback(z=>{if(N){let ae=N.assignedUserIds||[],Ue=ae.includes(z)?ae.filter(st=>st!==z):[...ae,z],xt={...N,assignedUserIds:Ue};H(xt),r?.(N.id,{assignedUserIds:Ue});}},[N,r]),ee=react.useCallback(z=>{if(N){let ae=N.labels||[],Ue=ae.includes(z)?ae.filter(st=>st!==z):[...ae,z],xt={...N,labels:Ue};H(xt),r?.(N.id,{labels:Ue});}},[N,r]),_e=react.useCallback(z=>{if(N){let ae={...N,tags:z};H(ae),r?.(N.id,{tags:z});}},[N,r]),Na=react.useCallback(z=>{if(N){let ae=z.target.value,Ue={...N,endDate:ae};H(Ue),r?.(N.id,{endDate:ae}),Tt(false);}},[N,r]),ge=react.useCallback(z=>{if(N){let ae={...N,estimatedTime:parseFloat(z)||0};H(ae),r?.(N.id,{estimatedTime:parseFloat(z)||0});}},[N,r]),Ve=react.useCallback(()=>{if(Ce.trim()&&N){let z={id:`subtask-${Date.now()}`,title:Ce.trim(),completed:false,createdAt:new Date},ae=[...ce,z];J(ae),Se(""),ue(false),x?.(N.id,ae);}},[Ce,ce,N,x]),Oe=react.useCallback(z=>{let ae=ce.map(Ue=>Ue.id===z?{...Ue,completed:!Ue.completed,updatedAt:new Date}:Ue);J(ae),N&&x?.(N.id,ae);},[ce,N,x]),P=react.useCallback(z=>{let ae=ce.filter(Ue=>Ue.id!==z);J(ae),N&&x?.(N.id,ae);},[ce,N,x]),Z=react.useCallback(()=>{F.trim()&&N&&m&&(m(N.id,F.trim()),R(""));},[F,N,m]),ye=react.useCallback(z=>{(z.metaKey||z.ctrlKey)&&z.key==="Enter"&&(z.preventDefault(),Z());},[Z]),O=z=>jsxRuntime.jsx(Ff__default.default,{remarkPlugins:[Af__default.default],rehypePlugins:[If__default.default],components:{a:({node:ae,...Ue})=>jsxRuntime.jsx("a",{...Ue,target:"_blank",rel:"noopener noreferrer"})},children:z}),V=d.filter(z=>S==="comments"?z.type.includes("COMMENT"):S==="history"?!z.type.includes("COMMENT"):true);if(!t||!e)return null;let ve=N||e,Le=s.filter(z=>ve.assignedUserIds?.includes(z.id)),Ae=ce.filter(z=>z.completed).length;return jsxRuntime.jsx(it,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:z=>z.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":L,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:vt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:He,onKeyDown:Re,children:ve.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:me,children:[jsxRuntime.jsxs("button",{ref:X,className:"modal-v2-field",onClick:()=>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("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:ve.columnId||"No status"})]}),jsxRuntime.jsx(jo,{triggerRef:X,isOpen:_,onClose:()=>te(false),width:250,estimatedHeight:200,children:(y.length>0?y:Bf.map(z=>({id:z,title:z}))).map(z=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${ve.columnId===z.id?"active":""}`,onClick:()=>We(z.id),children:z.title},z.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:se,children:[jsxRuntime.jsxs("button",{ref:Be,className:"modal-v2-field",onClick:()=>Q(!Fe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"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:Le.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Le.map(z=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:z.color},title:z.name,children:z.initials},z.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(jo,{triggerRef:Be,isOpen:Fe,onClose:()=>Q(false),width:280,estimatedHeight:300,children:s.map(z=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ve.assignedUserIds?.includes(z.id)?"active":""}`,onClick:()=>Ie(z.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:z.color},children:z.initials}),z.name,ve.assignedUserIds?.includes(z.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},z.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:I,children:[jsxRuntime.jsxs("button",{ref:G,className:"modal-v2-field",onClick:()=>de(!ne),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:ve.priority||"None"})]}),jsxRuntime.jsxs(jo,{triggerRef:G,isOpen:ne,onClose:()=>de(false),width:180,estimatedHeight:220,children:[Lf.map(z=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${z.toLowerCase()} ${ve.priority===z?"active":""}`,onClick:()=>le(z),children:z},z)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>le(""),children:"None"})]})]}),g.length>0||v?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:ve.tags||[],availableTags:g,onChange:_e,onCreateTag:v,theme:qe[L]||qe.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:pe,children:[jsxRuntime.jsxs("button",{ref:Y,className:"modal-v2-field",onClick:()=>Te(!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:ve.labels&&ve.labels.length>0?jsxRuntime.jsx("span",{children:ve.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(jo,{triggerRef:Y,isOpen:Ye,onClose:()=>Te(false),width:220,estimatedHeight:200,children:(C.length>0?C:["Bug","Feature","Enhancement","Documentation"]).map(z=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ve.labels?.includes(z)?"active":""}`,onClick:()=>ee(z),children:[z,ve.labels?.includes(z)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},z))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{Tt(!Ke),setTimeout(()=>ze.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:ve.endDate?new Date(ve.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:ze,type:"date",value:typeof ve.endDate=="string"?ve.endDate.split("T")[0]:ve.endDate?(()=>{let z=new Date(ve.endDate),ae=z.getUTCFullYear(),Ue=String(z.getUTCMonth()+1).padStart(2,"0"),xt=String(z.getUTCDate()).padStart(2,"0");return `${ae}-${Ue}-${xt}`})():"",onChange:Na,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Ze(!Et),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:ve.estimatedTime?`${ve.estimatedTime}h`:"Not set"})]}),Et&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ve.estimatedTime||"",onChange:z=>ge(z.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ze(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),$?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:ve.description||"",onChange:z=>{if(N){let ae={...N,description:z.target.value};H(ae);}},onBlur:je,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>j(true),children:ve.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:O(ve.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"}),ce.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Ae,"/",ce.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>ue(true),children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[ce.map(z=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${z.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Oe(z.id),children:z.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:z.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>P(z.id),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},z.id)),re&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:Ce,onChange:z=>Se(z.target.value),onKeyDown:z=>{z.key==="Enter"&&Ve(),z.key==="Escape"&&(ue(false),Se(""));},onBlur:Ve,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(T||D.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),D.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:D.length})]}),jsxRuntime.jsx(nr,{cardId:ve.id,attachments:D,onUpload:T?z=>T(ve.id,z):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 ${S==="all"?"active":""}`,onClick:()=>B("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="comments"?"active":""}`,onClick:()=>B("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="history"?"active":""}`,onClick:()=>B("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[c&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:c.color},children:c.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Gt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:F,onChange:z=>R(z.target.value),onKeyDown:ye,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:Z,disabled:!F.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[V.map(z=>{let ae=s.find(xt=>xt.id===z.userId);if(z.type.includes("COMMENT")){let xt=n.find(st=>st.id===z.metadata?.commentId);return xt?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ae&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:ae.color},children:ae.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:ae?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(z.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:xt.content})]})]},z.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[z.type.includes("CREATED")&&"\u2795",z.type.includes("UPDATED")&&"\u270F\uFE0F",z.type.includes("MOVED")&&"\u27A1\uFE0F",z.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",z.type.includes("ASSIGNED")&&"\u{1F464}",z.type.includes("PRIORITY")&&"\u{1F3AF}",z.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:ae?.name||"Unknown"})," ",z.type.replace(/_/g," ").toLowerCase(),z.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:z.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(z.timestamp).toLocaleString()})]})]},z.id)}),V.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 _f({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 li({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((d,m)=>d+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(_f,{})}),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,d)=>n+d.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,d)=>n+d.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,d)=>n+(d.planned||0),0)})]})]})]})}function Qf({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," tasks"]},r))]})}function di({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,d=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,i=n<=d;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Qf,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color: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 lb={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},gc=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function db({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,d=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:d,y:m,fill:"white",textAnchor:d>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function fc({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 ci({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||lb[m.name]||gc[e.indexOf(m)%gc.length]})),d=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?db:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,i)=>jsxRuntime.jsx(recharts.Cell,{fill:d[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(fc,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,i)=>{let c=i.payload,l=s>0?(c.value/s*100).toFixed(0):"0";return `${m} (${c.value} - ${l}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(fc,{})}),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:d[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 Mn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,d]=react.useState(false),[m,i]=react.useState(false),[c,l]=react.useState(false),[u,b]=react.useState(false);if(e.length===0)return null;let y=e.map(k=>k.id),C=k=>{r.onBulkUpdate?.(y,{priority:k}),d(false);},g=k=>{r.onBulkMove?.(y,k),i(false),a();},v=k=>{r.onBulkUpdate?.(y,{assignedUserIds:k}),l(false);},h=k=>{let x=new Set;e.forEach(T=>{T.labels?.forEach(w=>x.add(w));});let D=Array.from(new Set([...x,...k]));r.onBulkUpdate?.(y,{labels:D}),b(false);},p=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),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:()=>d(!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(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>C(k),children:[jsxRuntime.jsx("span",{className:f("asakaa-priority-dot",k==="LOW"&&"bg-asakaa-priority-low",k==="MEDIUM"&&"bg-asakaa-priority-medium",k==="HIGH"&&"bg-asakaa-priority-high",k==="URGENT"&&"bg-asakaa-priority-urgent")}),k]},k))})]}),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(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(k.id),children:k.title},k.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([k.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:k.color},children:k.initials}),k.name]},k.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>b(!u),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([k]),children:k},k))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:p,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"})})]})]})})});Mn.displayName="BulkOperationsToolbar";function gb(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,d,m,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(b=>{let y=a?.find(C=>C.id===b);n=`assignee-${b}`,d=y?.name||`User ${b}`,m=y?.color,i=y?.avatar,r.has(n)||r.set(n,{id:n,title:d,groupValue:b,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",d="Unassigned",m="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:d,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 u={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];d=u.title,m=u.color,r.has(n)||r.set(n,{id:n,title:d,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(b=>{n=`label-${b}`,d=b,m="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:b,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",d="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:d,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 mi({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),d=react.useMemo(()=>gb(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(i=>{n(c=>{let l=new Set(c);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||d.length===0?jsxRuntime.jsx(Er,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:f("asakaa-swimlane-view",o),children:[d.map(i=>{let c=s.has(i.id),l=e.cards.filter(b=>i.cardIds.includes(b.id)),u={...e,cards:l};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&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":c?"Expand lane":"Collapse lane",children:c?"\u25B6":"\u25BC"})]}),!c&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Er,{board:u,callbacks:r,availableUsers:a})})]},i.id)}),d.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 pi=[{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 ui({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),d=pi.find(i=>i.value===e)||pi[0];react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.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:d.icon}),jsxRuntime.jsx("span",{children:d.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:pi.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 Ko=[{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 hb(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,d=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&d&&m}function xc(e={}){let{shortcuts:t=Ko,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];},[]),d=react.useCallback(m=>{o.current=o.current.filter(i=>i.action!==m);},[]);return react.useEffect(()=>{function m(i){if(!s.current)return;let c=i.target;if(!((c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let l of o.current)if(hb(i,l)){r&&i.preventDefault();let u=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(u);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:d,isEnabled:a}}function vb(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function xb(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 kb(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=xb(e),r=t?vb(t):"";return a?`${a} + ${r}`:r}function wb(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 gi({shortcuts:e=Ko,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function d(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),!o||!t)return null;let n=wb(e);return jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([d,m])=>m.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),d]}),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 transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:kb(i)})]},i.action))})]},d))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var fi=[{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
+ `,b.onmouseenter=()=>{b.style.opacity="1";},b.onmouseleave=()=>{b.style.opacity="0.5";},b.onclick=y=>{y.stopPropagation();let w=r<a.length-1?r+1:0;i(),o(w);},n.appendChild(l),n.appendChild(p),n.appendChild(b);}n.appendChild(d),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function Nf(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 Df(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 ai(e){return e.startsWith("image/")}function nr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,d]=react.useState(false),[m,i]=react.useState(false),[c,l]=react.useState(null),p=react.useRef(null),b=react.useRef(e);b.current=e;let y=react.useCallback((C,I)=>{I.preventDefault(),I.stopPropagation();let L=b.current.filter(O=>ai(O.type)),N=L.findIndex(O=>O.id===C.id),_=O=>{let W=b.current.filter(de=>ai(de.type)),le=W[O];le&&nc(le.url,le.name,W,O,_);};nc(C.url,C.name,L,N,_);},[]),w=react.useCallback(C=>{let I=[],L=[];return e.length+C.length>s?(L.push(`Maximum ${s} files allowed`),{valid:I,errors:L}):(C.forEach(N=>{if(N.size/1048576>r){L.push(`${N.name} is too large (max ${r}MB)`);return}if(o&&!o.some(O=>N.type.match(O))){L.push(`${N.name} has invalid file type`);return}I.push(N);}),{valid:I,errors:L})},[e.length,s,r,o]),g=react.useCallback(async C=>{let{valid:I,errors:L}=w(C);if(L.length>0){l(L.join(", ")),setTimeout(()=>l(null),5e3);return}if(I.length!==0){i(true),l(null);try{await t?.(I);}catch(N){l(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[w,t]),v=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),d(true);},[]),h=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),d(false);},[]),u=react.useCallback(C=>{C.preventDefault(),C.stopPropagation();},[]),k=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),d(false);let I=Array.from(C.dataTransfer.files);g(I);},[g]),x=react.useCallback(C=>{let I=C.target.files?Array.from(C.target.files):[];g(I),p.current&&(p.current.value="");},[g]),D=react.useCallback(()=>{p.current?.click();},[]),T=react.useCallback(C=>{confirm("Are you sure you want to delete this attachment?")&&a?.(C);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${m?"uploading":""}`,onDragEnter:v,onDragLeave:h,onDragOver:u,onDrop:k,onClick:D,children:[jsxRuntime.jsx("input",{ref:p,type:"file",multiple:true,onChange:x,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"]})]})})]}),c&&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:c})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(C=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:ai(C.type)&&C.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:I=>y(C,I),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:C.thumbnailUrl||C.url,alt:C.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:Df(C.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:C.name,children:C.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Nf(C.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(C.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>T(C.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"})})})]},C.id))})]})}function ri({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],aiInsights:m=[],attachments:i=[],onAddComment:c,onDeleteComment:l,onUploadAttachments:p,onDeleteAttachment:b,onSuggestAssignee:y,onGenerateSubtasks:w,onEstimateEffort:g,currentUserId:v="user-1"}){let[h,u]=react.useState("details"),[k,x]=react.useState(false),[D,T]=react.useState({}),[C,I]=react.useState(""),[L,N]=react.useState(false),[_,O]=react.useState({});if(!t||!e)return null;let W=react.useCallback(()=>{x(false),T({}),u("details"),I(""),O({}),a();},[a]),le=react.useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),T({}),x(false));},[e.id,D,r]),de=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),W());},[e.id,o,W]),pe=react.useCallback(()=>{c&&C.trim()&&(c(e.id,C.trim()),I(""));},[e.id,C,c]),ke=react.useCallback(async()=>{if(y){N(true);try{let S=await y(e);O(B=>({...B,assignees:S}));}catch(S){console.error("Failed to suggest assignee:",S);}finally{N(false);}}},[e,y]),Te=react.useCallback(async()=>{if(w){N(true);try{let S=await w(e);O(B=>({...B,subtasks:S}));}catch(S){console.error("Failed to generate subtasks:",S);}finally{N(false);}}},[e,w]),xe=react.useCallback(async()=>{if(g){N(true);try{let S=await g(e);O(B=>({...B,effort:S}));}catch(S){console.error("Failed to estimate effort:",S);}finally{N(false);}}},[e,g]),F={...e,...D},R=s.filter(S=>F.assignedUserIds?.includes(S.id));return jsxRuntime.jsx(it,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:W,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),k?jsxRuntime.jsx("input",{type:"text",value:D.title??F.title,onChange:S=>T({...D,title:S.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:F.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[k?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:le,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{x(false),T({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>x(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:de,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:W,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:()=>u("details"),className:`card-detail-tab ${h==="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:()=>u("comments"),className:`card-detail-tab ${h==="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:()=>u("activity"),className:`card-detail-tab ${h==="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",d.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxRuntime.jsxs("button",{onClick:()=>u("attachments"),className:`card-detail-tab ${h==="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:()=>u("ai"),className:`card-detail-tab ${h==="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:[h==="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"}),k?jsxRuntime.jsx("textarea",{value:D.description??F.description??"",onChange:S=>T({...D,description:S.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:F.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),k?jsxRuntime.jsx("select",{multiple:true,value:D.assignedUserIds??F.assignedUserIds??[],onChange:S=>{let B=Array.from(S.target.selectedOptions,G=>G.value);T({...D,assignedUserIds:B});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:R.length>0?R.map(S=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:S.color},children:S.initials}),jsxRuntime.jsx("span",{children:S.name})]},S.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),k?jsxRuntime.jsxs("select",{value:D.priority??F.priority??"",onChange:S=>T({...D,priority:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:F.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:F.labels&&F.labels.length>0?F.labels.map(S=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:S},S)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),k?jsxRuntime.jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:F.startDate?new Date(F.startDate).toISOString().split("T")[0]:"",onChange:S=>T({...D,startDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.startDate?new Date(F.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),k?jsxRuntime.jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:F.endDate?new Date(F.endDate).toISOString().split("T")[0]:"",onChange:S=>T({...D,endDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.endDate?new Date(F.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),k?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??F.estimatedTime??"",onChange:S=>T({...D,estimatedTime:S.target.value?parseFloat(S.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:F.dependencies&&F.dependencies.length>0?F.dependencies.map(S=>{let B=typeof S=="string"?S:S.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",B.slice(-4)]},B)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:F.createdAt?new Date(F.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:C,onChange:S=>I(S.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:pe,disabled:!C.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(S=>{let B=s.find(G=>G.id===S.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[B&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:B.color},children:B.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:B?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(S.createdAt).toLocaleString()})]})]}),l&&jsxRuntime.jsx("button",{onClick:()=>l(S.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:S.content})]},S.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),h==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:d.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:d.map(S=>{let B=s.find(G=>G.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[S.type.includes("CREATED")&&"\u2795",S.type.includes("UPDATED")&&"\u270F\uFE0F",S.type.includes("MOVED")&&"\u27A1\uFE0F",S.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",S.type.includes("COMMENT")&&"\u{1F4AC}",S.type.includes("ASSIGNED")&&"\u{1F464}",S.type.includes("PRIORITY")&&"\u{1F3AF}",S.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",S.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:B?.name||"Unknown"})," ",S.type.replace(/_/g," ").toLowerCase(),S.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:S.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(S.timestamp).toLocaleString()})]})]},S.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),h==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(nr,{cardId:e.id,attachments:i,onUpload:p?S=>p(e.id,S):void 0,onDelete:b,currentUserId:v,maxSizeMB:10,maxFiles:20})}),h==="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:ke,disabled:L||!y,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:Te,disabled:L||!w,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:xe,disabled:L||!g,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),_.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),_.assignees.map((S,B)=>{let G=s.find(Z=>Z.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[G&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:G.color},children:G.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:G?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:S.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(S.confidence*100).toFixed(0),"%"]})]})]},B)})]}),_.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),_.subtasks.map((S,B)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:S.title}),S.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:S.description}),S.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",S.estimatedTime,"h"]})]},B))]}),_.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:[_.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(_.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(S=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${S.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:S.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:S.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:S.description}),S.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",S.suggestedAction]})]},S.id))]}),!_.assignees&&!_.subtasks&&!_.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 jo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[d,m]=react.useState({top:0,left:0}),i=react.useRef(null),c=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),p=window.innerHeight,b=window.innerWidth,y=4,w=l.left;w+o>b-10&&(w=b-o-10),w<10&&(w=10);let g=p-l.bottom,v=l.top,h;return g>=s+y?h=l.bottom+y:v>=s+y?h=l.top-s-y:g>=v?h=l.bottom+y:h=Math.max(10,l.top-s-y),{top:h,left:w}},[e,o,s]);return react.useEffect(()=>{t&&m(c());},[t,c]),react.useEffect(()=>{if(!t)return;let l=b=>{let y=b.target;i.current&&!i.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",l);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let l=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsxRuntime.jsx(it,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${d.top}px`,left:`${d.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 Lf=["LOW","MEDIUM","HIGH","URGENT"],Bf=["todo","in-progress","review","done"];function si({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],onAddComment:m,onDeleteComment:i,currentUser:c,onAIGenerateDescription:l,onAICreateSubtasks:p,onAIFindSimilar:b,availableColumns:y=[],availableLabels:w=[],availableTags:g=[],onCreateTag:v,onUploadCoverImage:h,unsplashAccessKey:u,theme:k,onSubtasksChange:x,attachments:D=[],onUploadAttachments:T,onDeleteAttachment:C}){let I=uo(),L=k||I?.themeName||"dark",[N,_]=react.useState(e),[O,W]=react.useState(false),[le,de]=react.useState(e?.subtasks||[]),[pe,ke]=react.useState(false),[Te,xe]=react.useState(""),[F,R]=react.useState(""),[S,B]=react.useState("all"),[G,Z]=react.useState(false),[ae,ie]=react.useState(false),[Fe,Q]=react.useState(false),[Ye,Ne]=react.useState(false),[Ke,Tt]=react.useState(false),[Et,Ze]=react.useState(false),vt=react.useRef(null),bt=react.useRef(null),Gt=react.useRef(null),ce=react.useRef(null),A=react.useRef(null),oe=react.useRef(null),me=react.useRef(null),ze=react.useRef(null),X=react.useRef(null),Be=react.useRef(null),V=react.useRef(null),Y=react.useRef(null);react.useEffect(()=>{e&&!N?(_({...e}),de(e.subtasks||[])):e&&N&&e.id!==N.id&&(_({...e}),de(e.subtasks||[]));},[e,N]),react.useEffect(()=>{let U=te=>{let Ue=te.target;ce.current&&!ce.current.contains(Ue)&&Z(false),A.current&&!A.current.contains(Ue)&&ie(false),oe.current&&!oe.current.contains(Ue)&&Q(false),me.current&&!me.current.contains(Ue)&&Ne(false);};if(G||ae||Fe||Ye)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[G,ae,Fe,Ye]),react.useEffect(()=>{if(!t)return;let U=te=>{let Ue=te.target,xt=Ue.tagName==="INPUT"||Ue.tagName==="TEXTAREA"||Ue.isContentEditable;if(te.key==="Escape"){te.preventDefault(),G||ae||Fe||Ye||Ke||Et?(Z(false),ie(false),Q(false),Ne(false),Tt(false),Ze(false)):xt||a();return}if(xt&&te.key!=="Escape")return;let st=te.metaKey||te.ctrlKey;switch(te.key.toLowerCase()){case "s":te.preventDefault(),Z(true);break;case "a":te.preventDefault(),Q(true);break;case "p":te.preventDefault(),ie(true);break;case "l":te.preventDefault(),Ne(true);break;case "d":st||(te.preventDefault(),Tt(true),setTimeout(()=>ze.current?.focus(),0));break;case "e":st||(te.preventDefault(),Ze(true));break;case "i":te.preventDefault(),W(true),setTimeout(()=>bt.current?.focus(),0);break;case "t":te.preventDefault(),ke(true);break;case "c":te.preventDefault(),Gt.current?.focus();break}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[t,a,G,ae,Fe,Ye,Ke,Et]);let He=react.useCallback(U=>{let te=U.currentTarget.textContent?.trim()||"";if(N&&te!==N.title){let Ue={...N,title:te};_(Ue),r?.(N.id,{title:te});}},[N,r]),Re=react.useCallback(U=>{U.key==="Enter"&&(U.preventDefault(),U.currentTarget.blur()),U.key==="Escape"&&(U.preventDefault(),U.currentTarget.textContent=N?.title||"",U.currentTarget.blur());},[N]),je=react.useCallback(()=>{N&&e&&N.description!==e.description&&r?.(N.id,{description:N.description}),W(false);},[N,e,r]),We=react.useCallback(U=>{if(N){let te={...N,columnId:U};_(te),r?.(N.id,{columnId:U}),Z(false);}},[N,r]),se=react.useCallback(U=>{if(N){let te={...N,priority:U};_(te),r?.(N.id,{priority:U}),ie(false);}},[N,r]),Ie=react.useCallback(U=>{if(N){let te=N.assignedUserIds||[],Ue=te.includes(U)?te.filter(st=>st!==U):[...te,U],xt={...N,assignedUserIds:Ue};_(xt),r?.(N.id,{assignedUserIds:Ue});}},[N,r]),ee=react.useCallback(U=>{if(N){let te=N.labels||[],Ue=te.includes(U)?te.filter(st=>st!==U):[...te,U],xt={...N,labels:Ue};_(xt),r?.(N.id,{labels:Ue});}},[N,r]),_e=react.useCallback(U=>{if(N){let te={...N,tags:U};_(te),r?.(N.id,{tags:U});}},[N,r]),Na=react.useCallback(U=>{if(N){let te=U.target.value,Ue={...N,endDate:te};_(Ue),r?.(N.id,{endDate:te}),Tt(false);}},[N,r]),ue=react.useCallback(U=>{if(N){let te={...N,estimatedTime:parseFloat(U)||0};_(te),r?.(N.id,{estimatedTime:parseFloat(U)||0});}},[N,r]),Ve=react.useCallback(()=>{if(Te.trim()&&N){let U={id:`subtask-${Date.now()}`,title:Te.trim(),completed:false,createdAt:new Date},te=[...le,U];de(te),xe(""),ke(false),x?.(N.id,te);}},[Te,le,N,x]),Oe=react.useCallback(U=>{let te=le.map(Ue=>Ue.id===U?{...Ue,completed:!Ue.completed,updatedAt:new Date}:Ue);de(te),N&&x?.(N.id,te);},[le,N,x]),P=react.useCallback(U=>{let te=le.filter(Ue=>Ue.id!==U);de(te),N&&x?.(N.id,te);},[le,N,x]),J=react.useCallback(()=>{F.trim()&&N&&m&&(m(N.id,F.trim()),R(""));},[F,N,m]),he=react.useCallback(U=>{(U.metaKey||U.ctrlKey)&&U.key==="Enter"&&(U.preventDefault(),J());},[J]),z=U=>jsxRuntime.jsx(Ff__default.default,{remarkPlugins:[Af__default.default],rehypePlugins:[If__default.default],components:{a:({node:te,...Ue})=>jsxRuntime.jsx("a",{...Ue,target:"_blank",rel:"noopener noreferrer"})},children:U}),j=d.filter(U=>S==="comments"?U.type.includes("COMMENT"):S==="history"?!U.type.includes("COMMENT"):true);if(!t||!e)return null;let ye=N||e,Le=s.filter(U=>ye.assignedUserIds?.includes(U.id)),Ae=le.filter(U=>U.completed).length;return jsxRuntime.jsx(it,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":L,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:vt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:He,onKeyDown:Re,children:ye.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ce,children:[jsxRuntime.jsxs("button",{ref:X,className:"modal-v2-field",onClick:()=>Z(!G),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ye.columnId||"No status"})]}),jsxRuntime.jsx(jo,{triggerRef:X,isOpen:G,onClose:()=>Z(false),width:250,estimatedHeight:200,children:(y.length>0?y:Bf.map(U=>({id:U,title:U}))).map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${ye.columnId===U.id?"active":""}`,onClick:()=>We(U.id),children:U.title},U.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:oe,children:[jsxRuntime.jsxs("button",{ref:Be,className:"modal-v2-field",onClick:()=>Q(!Fe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"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:Le.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Le.map(U=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:U.color},title:U.name,children:U.initials},U.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(jo,{triggerRef:Be,isOpen:Fe,onClose:()=>Q(false),width:280,estimatedHeight:300,children:s.map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ye.assignedUserIds?.includes(U.id)?"active":""}`,onClick:()=>Ie(U.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:U.color},children:U.initials}),U.name,ye.assignedUserIds?.includes(U.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},U.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:A,children:[jsxRuntime.jsxs("button",{ref:V,className:"modal-v2-field",onClick:()=>ie(!ae),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ye.priority||"None"})]}),jsxRuntime.jsxs(jo,{triggerRef:V,isOpen:ae,onClose:()=>ie(false),width:180,estimatedHeight:220,children:[Lf.map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${U.toLowerCase()} ${ye.priority===U?"active":""}`,onClick:()=>se(U),children:U},U)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>se(""),children:"None"})]})]}),g.length>0||v?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:ye.tags||[],availableTags:g,onChange:_e,onCreateTag:v,theme:qe[L]||qe.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:me,children:[jsxRuntime.jsxs("button",{ref:Y,className:"modal-v2-field",onClick:()=>Ne(!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:ye.labels&&ye.labels.length>0?jsxRuntime.jsx("span",{children:ye.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(jo,{triggerRef:Y,isOpen:Ye,onClose:()=>Ne(false),width:220,estimatedHeight:200,children:(w.length>0?w:["Bug","Feature","Enhancement","Documentation"]).map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ye.labels?.includes(U)?"active":""}`,onClick:()=>ee(U),children:[U,ye.labels?.includes(U)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},U))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{Tt(!Ke),setTimeout(()=>ze.current?.showPicker?.(),0);},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsxRuntime.jsx("span",{children:"Due Date"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ye.endDate?new Date(ye.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:ze,type:"date",value:typeof ye.endDate=="string"?ye.endDate.split("T")[0]:ye.endDate?(()=>{let U=new Date(ye.endDate),te=U.getUTCFullYear(),Ue=String(U.getUTCMonth()+1).padStart(2,"0"),xt=String(U.getUTCDate()).padStart(2,"0");return `${te}-${Ue}-${xt}`})():"",onChange:Na,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Ze(!Et),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ye.estimatedTime?`${ye.estimatedTime}h`:"Not set"})]}),Et&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ye.estimatedTime||"",onChange:U=>ue(U.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ze(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),O?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:ye.description||"",onChange:U=>{if(N){let te={...N,description:U.target.value};_(te);}},onBlur:je,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>W(true),children:ye.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:z(ye.description)}):jsxRuntime.jsxs("p",{className:"modal-v2-placeholder",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M9 11l3 3L22 4"}),jsxRuntime.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsxRuntime.jsx("h2",{children:"Subtasks"}),le.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Ae,"/",le.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>ke(true),children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[le.map(U=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${U.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Oe(U.id),children:U.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:U.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>P(U.id),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},U.id)),pe&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:Te,onChange:U=>xe(U.target.value),onKeyDown:U=>{U.key==="Enter"&&Ve(),U.key==="Escape"&&(ke(false),xe(""));},onBlur:Ve,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(T||D.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),D.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:D.length})]}),jsxRuntime.jsx(nr,{cardId:ye.id,attachments:D,onUpload:T?U=>T(ye.id,U):void 0,onDelete:C,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="all"?"active":""}`,onClick:()=>B("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="comments"?"active":""}`,onClick:()=>B("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="history"?"active":""}`,onClick:()=>B("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[c&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:c.color},children:c.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Gt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:F,onChange:U=>R(U.target.value),onKeyDown:he,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:J,disabled:!F.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[j.map(U=>{let te=s.find(xt=>xt.id===U.userId);if(U.type.includes("COMMENT")){let xt=n.find(st=>st.id===U.metadata?.commentId);return xt?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[te&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:te.color},children:te.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:te?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:xt.content})]})]},U.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[U.type.includes("CREATED")&&"\u2795",U.type.includes("UPDATED")&&"\u270F\uFE0F",U.type.includes("MOVED")&&"\u27A1\uFE0F",U.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",U.type.includes("ASSIGNED")&&"\u{1F464}",U.type.includes("PRIORITY")&&"\u{1F3AF}",U.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:te?.name||"Unknown"})," ",U.type.replace(/_/g," ").toLowerCase(),U.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:U.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]})]},U.id)}),j.length===0&&jsxRuntime.jsxs("div",{className:"modal-v2-empty",children:[jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function _f({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 li({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((d,m)=>d+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(_f,{})}),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,d)=>n+d.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,d)=>n+d.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,d)=>n+(d.planned||0),0)})]})]})]})}function Qf({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," tasks"]},r))]})}function di({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,d=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,i=n<=d;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Qf,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color: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 lb={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},gc=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function db({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,d=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:d,y:m,fill:"white",textAnchor:d>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function fc({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 ci({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||lb[m.name]||gc[e.indexOf(m)%gc.length]})),d=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?db:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,i)=>jsxRuntime.jsx(recharts.Cell,{fill:d[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(fc,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,i)=>{let c=i.payload,l=s>0?(c.value/s*100).toFixed(0):"0";return `${m} (${c.value} - ${l}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(fc,{})}),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:d[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 Mn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,d]=react.useState(false),[m,i]=react.useState(false),[c,l]=react.useState(false),[p,b]=react.useState(false);if(e.length===0)return null;let y=e.map(k=>k.id),w=k=>{r.onBulkUpdate?.(y,{priority:k}),d(false);},g=k=>{r.onBulkMove?.(y,k),i(false),a();},v=k=>{r.onBulkUpdate?.(y,{assignedUserIds:k}),l(false);},h=k=>{let x=new Set;e.forEach(T=>{T.labels?.forEach(C=>x.add(C));});let D=Array.from(new Set([...x,...k]));r.onBulkUpdate?.(y,{labels:D}),b(false);},u=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),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:()=>d(!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(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>w(k),children:[jsxRuntime.jsx("span",{className:f("asakaa-priority-dot",k==="LOW"&&"bg-asakaa-priority-low",k==="MEDIUM"&&"bg-asakaa-priority-medium",k==="HIGH"&&"bg-asakaa-priority-high",k==="URGENT"&&"bg-asakaa-priority-urgent")}),k]},k))})]}),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(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(k.id),children:k.title},k.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([k.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:k.color},children:k.initials}),k.name]},k.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>b(!p),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([k]),children:k},k))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:u,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"})})]})]})})});Mn.displayName="BulkOperationsToolbar";function gb(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,d,m,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(b=>{let y=a?.find(w=>w.id===b);n=`assignee-${b}`,d=y?.name||`User ${b}`,m=y?.color,i=y?.avatar,r.has(n)||r.set(n,{id:n,title:d,groupValue:b,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",d="Unassigned",m="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:d,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 p={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];d=p.title,m=p.color,r.has(n)||r.set(n,{id:n,title:d,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(b=>{n=`label-${b}`,d=b,m="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:b,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",d="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:d,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 mi({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),d=react.useMemo(()=>gb(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(i=>{n(c=>{let l=new Set(c);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||d.length===0?jsxRuntime.jsx(Er,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:f("asakaa-swimlane-view",o),children:[d.map(i=>{let c=s.has(i.id),l=e.cards.filter(b=>i.cardIds.includes(b.id)),p={...e,cards:l};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&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":c?"Expand lane":"Collapse lane",children:c?"\u25B6":"\u25BC"})]}),!c&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Er,{board:p,callbacks:r,availableUsers:a})})]},i.id)}),d.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 pi=[{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 ui({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),d=pi.find(i=>i.value===e)||pi[0];react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.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:d.icon}),jsxRuntime.jsx("span",{children:d.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:pi.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 Ko=[{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 hb(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,d=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&d&&m}function xc(e={}){let{shortcuts:t=Ko,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];},[]),d=react.useCallback(m=>{o.current=o.current.filter(i=>i.action!==m);},[]);return react.useEffect(()=>{function m(i){if(!s.current)return;let c=i.target;if(!((c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let l of o.current)if(hb(i,l)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:d,isEnabled:a}}function vb(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function xb(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 kb(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=xb(e),r=t?vb(t):"";return a?`${a} + ${r}`:r}function wb(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 gi({shortcuts:e=Ko,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function d(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),!o||!t)return null;let n=wb(e);return jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([d,m])=>m.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),d]}),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 transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:kb(i)})]},i.action))})]},d))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var fi=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
72
72
  1.
73
73
 
74
74
  **Expected behavior:**
@@ -108,8 +108,8 @@
108
108
  1.
109
109
 
110
110
  **Action items:**
111
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function bi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);},m=e.reduce((i,c)=>{let l=c.category||"Other";return i[l]||(i[l]=[]),i[l].push(c),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,c])=>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:c.map(l=>jsxRuntime.jsxs("button",{onClick:()=>d(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function yi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,d]=react.useState("export"),[m,i]=react.useState("json"),[c,l]=react.useState(null),u=react.useRef(null);if(!t)return null;let b=async()=>{let C=o?.current||void 0,g=await rd(e,m,C);od(g,m);},y=async C=>{let g=C.target.files?.[0];if(g){try{let v=await id(g),h=g.name.endsWith(".json")?"json":"csv",p=sd(v,h);l(p),p.success&&r&&r(p,v);}catch(v){l({success:false,errors:[`Failed to read file: ${v instanceof Error?v.message:"Unknown error"}`]});}u.current&&(u.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:()=>d("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:()=>d("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(C=>jsxRuntime.jsxs("button",{onClick:()=>i(C),className:f("p-4 rounded-lg border-2 transition-all text-center",m===C?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[C==="json"&&"\u{1F4C4}",C==="csv"&&"\u{1F4CA}",C==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:C})]},C))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:b,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:u,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>u.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"})]})]}),c&&jsxRuntime.jsxs("div",{className:f("p-4 rounded-lg",c.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",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:c.errors.map((C,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",C]},g))})]})]})]})]})]})}var Sb=["URGENT","HIGH","MEDIUM","LOW"],Eb=[{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"}],Pb=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function vi({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:d,availableUsers:m=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:l=true,compact:u=false,groupBy:b="none",onGroupByChange:y}){let[C,g]=react.useState(true),v=react.useCallback(D=>{a({search:D.target.value});},[a]),h=react.useCallback(D=>{a({dateFilter:D.target.value});},[a]),p=react.useCallback(D=>{r({by:D.target.value});},[r]),k=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),x=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 ${u?"filter-bar--compact":""} ${C?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!C),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:C?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter: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:C?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),x&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!C&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),d&&jsxRuntime.jsx("button",{onClick:d,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:v,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:D=>{let T=D.target.value;a({priorities:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Sb.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 T=D.target.value;a({assignees:T==="all"?[]:[T]});},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 T=D.target.value;a({labels:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:p,className:"filter-bar__select filter-bar__select--sm",children:Eb.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:k,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:b,onChange:D=>y(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Pb.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))})}),x&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function xi({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:d,onExportGanttCSV:m}){let[i,c]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let b=y=>{l.current&&!l.current.contains(y.target)&&c(false);};return i&&document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b);}},[i]);let u=b=>{b(),c(false);};return jsxRuntime.jsxs("div",{className:f("relative",r),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>c(!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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",b.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",b.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:()=>u(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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(async()=>await d?.()),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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(()=>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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>u(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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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 ki={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"}},wi={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"}},Ci={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"}},eo={dark:ki,light:wi,neutral:Ci},An="dark";var In=react.createContext(void 0),Ub="asakaa-theme";function Cc({children:e,defaultTheme:t=An,storageKey:a=Ub}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let d=localStorage.getItem(a);if(d&&(d==="dark"||d==="light"||d==="neutral"))return d}return t}),s=react.useCallback(d=>{o(d),typeof window<"u"&&localStorage.setItem(a,d);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let d=document.documentElement,m=eo[r];Object.entries(m.colors).forEach(([c,l])=>{l&&d.style.setProperty(`--theme-${$b(c)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([c,l])=>{let u=m.colors[c];u&&d.style.setProperty(l,u);}),d.setAttribute("data-theme",r),d.classList.remove("theme-dark","theme-light","theme-neutral"),d.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:eo};return jsxRuntime.jsx(In.Provider,{value:n,children:e})}function wo(){let e=react.useContext(In);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function $b(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ti({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=wo();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(eo).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 Tc(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 Ln={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Nc={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Ni={en:Ln,es:Nc};function Dc(e){return Ni[e]||Ni.en}function Di(e,t){let a=Dc(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 To=react.createContext(Ln);function Ir(){return react.useContext(To)}function ih({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[d,m]=react.useState(false),[i,c]=react.useState(null),l=react.useRef(null),u=Ir();if(react.useEffect(()=>{let g=v=>{l.current&&!l.current.contains(v.target)&&m(false);};return d&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[d]),!(t||a||r||o||s||n))return null;let y=[{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(g=>g.handler),C=async(g,v)=>{if(v){c(g);try{await v();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!d),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:d?e.accent:e.bgSecondary,border:`1px solid ${d?e.accent:e.borderLight}`,color:d?"#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:u.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:d&&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:y.map((g,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>C(g.id,g.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:v<y.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.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===g.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):g.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function lh({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 dh({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 ch({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Ir();react.useEffect(()=>{let i=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=d.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:d.map((i,c)=>{let l=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:c<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:i.label}),l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function mh({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),d=react.useRef(null),m=Ir();react.useEffect(()=>{if(!s)return;let u=setTimeout(()=>{let b=C=>{d.current&&!d.current.contains(C.target)&&n(false);},y=C=>{C.key==="Escape"&&n(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",y),d._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(u),d._cleanup&&d._cleanup();}},[s]);let i=[{value:"all",label:m.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:m.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:m.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:m.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,l=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u=>{u.stopPropagation(),n(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?l?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?l?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:c?"#3B82F6":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:m.toolbar.filter||"Filters"}),c&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:l?"#0F1117":"#FFFFFF",border:`1px solid ${l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:l?"#6B7280":"#9CA3AF"},children:m.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-2",children:i.map(u=>{let b=t===u.value&&!r,y=()=>u.value==="all"?b?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):u.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(u.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:b?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${b?u.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:u.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]},u.value)})}),jsxRuntime.jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?l?"#3B82F6":"#2563EB":l?"#6B7280":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:m.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]})})]})})]})}function Rn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:d,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:l,onCreateTask:u,taskFilter:b="all",onTaskFilterChange:y,hideCompleted:C=false,onHideCompletedChange:g,onExportPNG:v,onExportPDF:h,onExportExcel:p,onExportCSV:k,onExportJSON:x,onExportMSProject:D}){let T=Ir(),w=v||h||p||k||x||D,A=[{value:"day",label:T.toolbar.day},{value:"week",label:T.toolbar.week},{value:"month",label:T.toolbar.month}],L=[{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(dh,{options:A,value:t,onChange:N=>a(N),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(ch,{theme:e,value:d,onChange:m}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(mh,{theme:e,value:b,onChange:y,hideCompleted:C,onHideCompletedChange:g})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[c&&u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||T.toolbar.createTask})]}),(w||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ih,{theme:e,onExportPNG:v,onExportPDF:h,onExportExcel:p,onExportCSV:k,onExportJSON:x,onExportMSProject:D}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(lh,{options:L,value:s,onChange:N=>n(N),theme:e})]})]})}function On({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),d=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let c=l=>{d.current&&!d.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let c=m.current.getBoundingClientRect();n({x:c.left,y:c.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(it,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:d,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(c=>jsxRuntime.jsxs("button",{onClick:()=>{t(c.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:c.label}),c.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function No({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[d,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let c=200,l=r.length*36+8,u=8,b=window.innerWidth,y=window.innerHeight,C=t,g=a;t+c+u>b&&(C=t-c,C<u&&(C=u)),a+l+u>y&&(g=y-l-u,g<u&&(g=u)),m({x:C,y:g});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let c=u=>{n.current&&!n.current.contains(u.target)&&o();},l=u=>{u.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let i=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c: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:`${d.x}px`,top:`${d.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(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:l=>{c.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var It={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 Bc({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:d,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:l,enableKeyboard:u=true}){let b=react.useRef(false),y=react.useCallback(p=>{b.current=p;},[]),C=react.useCallback(p=>{let k=[],x=D=>{for(let T of D)k.push(T),T.subtasks&&T.subtasks.length>0&&T.isExpanded&&x(T.subtasks);};return x(p),k},[]),g=react.useCallback(()=>{let p=C(e);for(let k of p)if(t.has(k.id))return k;return null},[e,t,C]),v=react.useCallback((p,k)=>{let x=C(e);if(x.length===0)return;let D=g();if(!D){a(x[0].id,false);return}let T=x.findIndex(L=>L.id===D.id);if(T===-1)return;let w=p==="up"?T-1:T+1;if(w<0||w>=x.length)return;let A=x[w];a(A.id,k);},[e,g,C,a]),h=react.useCallback(p=>{if(!u)return;let k=p.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||b.current){p.key==="Escape"&&(k.blur(),b.current=false);return}let T=navigator.platform.toUpperCase().indexOf("MAC")>=0?p.metaKey:p.ctrlKey,w=Array.from(t),A=g();if(p.key==="ArrowUp"){p.preventDefault(),v("up",p.shiftKey);return}if(p.key==="ArrowDown"){p.preventDefault(),v("down",p.shiftKey);return}if(A&&(p.key==="ArrowRight"||p.key==="ArrowLeft")){A.subtasks&&A.subtasks.length>0&&(p.preventDefault(),(p.key==="ArrowRight"&&!A.isExpanded||p.key==="ArrowLeft"&&A.isExpanded)&&c(A.id));return}if(p.altKey&&(p.key==="ArrowUp"||p.key==="ArrowDown")){w.length>0&&(p.preventDefault(),n(w,p.key==="ArrowUp"?"up":"down"));return}if(p.key==="Tab"&&!p.shiftKey){w.length>0&&(p.preventDefault(),d(w));return}if(p.key==="Tab"&&p.shiftKey){w.length>0&&(p.preventDefault(),m(w));return}if(p.key==="Enter"&&!p.shiftKey&&!T){A&&(p.preventDefault(),r(A.id,"below"));return}if(p.key==="Enter"&&p.shiftKey&&!T){A&&(p.preventDefault(),r(A.id,"above"));return}if(p.key==="Enter"&&T){A&&(p.preventDefault(),l(A.id));return}if(p.key==="F2"){A&&(p.preventDefault(),i(A.id));return}if(p.key==="Delete"||p.key==="Backspace"&&T){w.length>0&&(p.preventDefault(),o(w));return}if(p.key==="d"&&T&&!p.shiftKey){w.length>0&&(p.preventDefault(),s(w));return}},[u,t,g,v,r,o,s,n,d,m,i,c,l]);return react.useEffect(()=>{if(u)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[u,h]),{setIsEditing:y}}function Oc(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(l=>{t(new Set([l])),r(l);},[]),s=react.useCallback(l=>{t(u=>{let b=new Set(u);return b.has(l)?b.delete(l):b.add(l),b}),r(l);},[]),n=react.useCallback((l,u)=>{if(!a){o(l);return}let b=u.indexOf(a),y=u.indexOf(l);if(b===-1||y===-1){o(l);return}let C=Math.min(b,y),g=Math.max(b,y),v=u.slice(C,g+1);t(new Set(v)),r(l);},[a,o]),d=react.useCallback((l,u,b,y)=>{y?n(l,u):b?s(l):o(l);},[o,s,n]),m=react.useCallback((l,u)=>{u?t(b=>{let y=new Set(b);return y.add(l),y}):o(l);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),c=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:d,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:c}}function Do(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let d={...r[n],parentId:o,level:s,position:n};t.push(d),d.subtasks&&d.subtasks.length>0&&d.isExpanded&&a(d.subtasks,d.id,s+1);}};return a(e),t}function zc(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=zc(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=Do(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],n=(l,u)=>{let b=[];return {tasks:l.filter(C=>{if(u.has(C.id))return b.push(C),false;if(C.subtasks){let g=n(C.subtasks,u);C.subtasks=g.tasks,b.push(...g.removed);}return true}),removed:b}},d=(l,u,b)=>l.map(y=>y.id===u?{...y,subtasks:[...y.subtasks||[],...b],isExpanded:true}:y.subtasks?{...y,subtasks:d(y.subtasks,u,b)}:y),m=new Set(t),{tasks:i,removed:c}=n(e,m);return d(i,s.id,c)}function Bi(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,c,l)=>{for(let u=0;u<i.length;u++){let b=i[u];if(b.id===c&&b.subtasks){let y=b.subtasks.findIndex(C=>C.id===l);if(y!==-1){let[C]=b.subtasks.splice(y,1);return C}}if(b.subtasks){let y=n(b.subtasks,c,l);if(y)return y}}return null},d=(i,c,l)=>{let u=i.findIndex(b=>b.id===c);if(u!==-1)return i.splice(u+1,0,l),i;for(let b of i)b.subtasks&&d(b.subtasks,c,l);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?d(s.subtasks,o.id,m):d(a,o.id,m));}return a}function Ri(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,d,m)=>{let i=n.findIndex(l=>l.id===d);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,d,m))return true;return false}let c=m==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],true)};return s(r,o,a),r}function Oi(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 zi(e,t){let a=[...e];for(let r of t){let o=n=>{let d=n.findIndex(c=>c.id===r);if(d===-1){for(let c of n)if(c.subtasks&&o(c.subtasks))return true;return false}let m=n[d],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(d+1,0,i),true},s=n=>n.map(d=>({...d,id:`${d.id}-copy-${Date.now()}`,subtasks:d.subtasks?s(d.subtasks):void 0}));o(a);}return a}function Uc(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"},d=m=>{let i=m.findIndex(l=>l.id===t);if(i===-1){for(let l of m)if(l.subtasks&&d(l.subtasks))return true;return false}let c=a==="above"?i:i+1;return m.splice(c,0,n),true};return d(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 $i(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:$i(a.subtasks,t)}:a)}function Hi(e,t){let a=c=>{for(let l of c){if(l.id===t)return l;if(l.subtasks){let u=a(l.subtasks);if(u)return u}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,d=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(d),color:r?.color||"#3B82F6"},i=c=>c.map(l=>{if(l.id===t){let u=l.subtasks||[];return {...l,subtasks:[...u,m],isExpanded:true}}return l.subtasks?{...l,subtasks:i(l.subtasks)}:l});return {tasks:i(e),newTask:m}}function $c(e,t,a,r){if(t===a)return e;let o=zc(e,t);if(!o)return e;if(a){let d=(m,i)=>{if(!m.subtasks)return false;for(let c of m.subtasks)if(c.id===i||d(c,i))return true;return false};if(d(o,a))return e}let s=d=>d.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 d=r!==void 0?r:n.length;n.splice(d,0,{...o,parentId:void 0});}else {let d=m=>m.map(i=>{if(i.id===a){let c=i.subtasks||[],l=r!==void 0?r:c.length,u=[...c];return u.splice(l,0,{...o,parentId:a}),{...i,subtasks:u,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:d(i.subtasks)}:i});n=d(n);}return n}function $n({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:d,onTaskToggle:m,scrollTop:i,columns:c,onToggleColumn:l,onColumnResize:u,onTaskUpdate:b,onTaskIndent:y,onTaskOutdent:C,onTaskMove:g,onMultiTaskDelete:v,onTaskDuplicate:h,onTaskCreate:p,onTaskRename:k,onCreateSubtask:x,onOpenTaskModal:D,onDeleteRequest:T,onTaskReparent:w}){let A=react.useContext(To),[L,N]=react.useState(null),[H,$]=react.useState(null),[j,ce]=react.useState(""),J=react.useRef(null),[re,ue]=react.useState(null),[Ce,Se]=react.useState(0),[F,R]=react.useState(0),[S,B]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[_,te]=react.useState(null),[ne,de]=react.useState(null),[Fe,Q]=react.useState(null),Ye=react.useRef(0),Te=5,Ke=react.useRef(false),[Tt,Et]=react.useState(null),[Ze,vt]=react.useState(false),[bt,Gt]=react.useState(null),[me,I]=react.useState(false),se=react.useRef(null);react.useEffect(()=>{function O(V){se.current&&!se.current.contains(V.target)&&I(false);}if(me)return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[me]),react.useEffect(()=>{H&&J.current&&(J.current.focus(),J.current.select());},[H]),react.useEffect(()=>{if(!re)return;let O=ve=>{let Le=ve.clientX-Ce,Ae=F+Le;u?.(re,Ae);},V=()=>{ue(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",O),document.addEventListener("mouseup",V),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",V),document.body.style.cursor="",document.body.style.userSelect="";}},[re,Ce,F,u]);let{selectedTaskIds:pe,handleTaskClick:ze,isTaskSelected:X}=Oc(),{setIsEditing:Be}=Bc({tasks:e,selectedTaskIds:pe,onTaskSelect:(O,V)=>{let Le=Do(e).map(Ae=>Ae.id);ze(O,Le,V||false,false);},onTaskCreate:p||(()=>{}),onTaskDelete:v||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:C||(()=>{}),onTaskRename:O=>{let V=Do(e).find(ve=>ve.id===O);V&&We(V);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:O=>{let V=Do(e).find(ve=>ve.id===O);V&&D&&D(V);},enableKeyboard:true}),G=(O,V=0)=>{let ve=[];for(let Le of O)ve.push({task:Le,level:V}),Le.subtasks&&Le.subtasks.length>0&&Le.isExpanded&&ve.push(...G(Le.subtasks,V+1));return ve},Y=G(e),He=48,Re=Math.max(Y.length*a,600-He),je=O=>!O.startDate||!O.endDate?"-":`${Math.ceil((O.endDate.getTime()-O.startDate.getTime())/(1e3*60*60*24))}d`,We=O=>{$(O.id),ce(O.name),Be(true);},le=O=>{j.trim()&&j!==e.find(V=>V.id===O)?.name&&k?.(O,j.trim()),$(null),ce(""),Be(false);},Ie=()=>{$(null),ce(""),Be(false);},ee=(O,V)=>{V.stopPropagation(),x?.(O.id);},_e=(O,V)=>{V.preventDefault(),Ye.current=V.clientY,te(O),Ke.current=false,vt(false),Et({x:V.clientX,y:V.clientY});},Na=O=>{if(!_||(Math.abs(O.clientY-Ye.current)>Te&&!Ke.current&&(Ke.current=true,vt(true)),Et({x:O.clientX,y:O.clientY}),!Ke.current))return;let ve=document.querySelectorAll("[data-task-row]"),Le=null,Ae=null;ve.forEach(z=>{let ae=z.getBoundingClientRect(),Ue=z.getAttribute("data-task-row");if(Ue&&Ue!==_&&O.clientY>=ae.top&&O.clientY<=ae.bottom){Le=Ue;let xt=O.clientY-ae.top,st=ae.height;xt<st*.25?Ae="above":xt>st*.75?Ae="below":Ae="child";}}),de(Le),Q(Ae);},ge=()=>{if(Ke.current&&_&&ne&&Fe){if(Fe==="child")w?.(_,ne);else if(Fe==="above"||Fe==="below"){let O=(Le,Ae,z=null)=>{for(let ae of Le){if(ae.id===Ae)return z;if(ae.subtasks){let Ue=O(ae.subtasks,Ae,ae.id);if(Ue!==void 0)return Ue}}},V=O(e,ne,null),ve=(Le,Ae)=>{let z=Le.findIndex(ae=>ae.id===Ae);return Fe==="below"?z+1:z};if(V===null){let Le=ve(e,ne);w?.(_,null,Le);}else {let Le=Y.find(Ae=>Ae.task.id===V)?.task;if(Le?.subtasks){let Ae=ve(Le.subtasks,ne);w?.(_,V,Ae);}}}}te(null),de(null),Q(null),Et(null),Ke.current=false,vt(false);};react.useEffect(()=>{if(_)return document.addEventListener("mousemove",Na),document.addEventListener("mouseup",ge),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Na),document.removeEventListener("mouseup",ge),document.body.style.cursor="",document.body.style.userSelect="";}},[_,ne,Fe]);let Ve=(O,V,ve)=>{switch(O.id){case "name":let Le=H===V.id,Ae=L===V.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ve*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:Ae?1:.3},onMouseDown:he=>_e(V.id,he),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),V.subtasks&&V.subtasks.length>0?jsxRuntime.jsx("button",{onClick:he=>{he.stopPropagation(),m?.(V.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:V.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:V.color||"#3B82F6",opacity:V.parentId?.6:1,borderColor:V.isMilestone?t.accent:"transparent",borderWidth:V.isMilestone?"2px":"0px"},title:V.isMilestone?"Milestone":V.parentId?"Subtask":"Task"})}),Le?jsxRuntime.jsx("input",{ref:J,type:"text",value:j,onChange:he=>ce(he.target.value),onKeyDown:he=>{he.key==="Enter"?le(V.id):he.key==="Escape"&&Ie();},onBlur:()=>le(V.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:he=>he.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:V.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:V.parentId?"13px":"14px",fontWeight:V.isMilestone?600:V.parentId?400:600,letterSpacing:V.parentId?"0":"-0.01em"},title:V.name,children:V.name}),Ae&&!Le&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:he=>he.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:he=>ee(V,he),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:he=>{he.stopPropagation(),We(V);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let ae=O.id==="startDate"?"startDate":"endDate",Ue=V[ae],xt=bt?.taskId===V.id&&bt?.field===ae,st=he=>he?(typeof he=="string"?new Date(he):he).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:he=>he.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:he=>{if(xt)Gt(null);else {let kt=he.currentTarget.getBoundingClientRect();Gt({taskId:V.id,field:ae,month:Ue?typeof Ue=="string"?new Date(Ue):Ue:new Date,position:{top:kt.bottom+4,left:kt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:st(Ue)})]}),xt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Gt(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:bt?.position.top,left:bt?.position.left},onClick:he=>he.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let he=new Date,kt=new Date(he);kt.setDate(he.getDate()+1);let tt=new Date(he);tt.setDate(he.getDate()+7);let co=new Date(he);return co.setDate(he.getDate()+14),[{label:"Hoy",date:he},{label:"Ma\xF1ana",date:kt},{label:"Pr\xF3xima semana",date:tt},{label:"2 semanas",date:co}].map((vr,Qa)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:er=>er.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:er=>er.currentTarget.style.backgroundColor="transparent",onClick:()=>{b?.(V.id,{[ae]:vr.date}),Gt(null);},children:vr.label},Qa))})(),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:he=>he.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:he=>he.currentTarget.style.backgroundColor="transparent",onClick:()=>{b?.(V.id,{[ae]:void 0}),Gt(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:()=>Gt(he=>he?{...he,month:new Date(he.month.getFullYear(),he.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:bt?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Gt(he=>he?{...he,month:new Date(he.month.getFullYear(),he.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((he,kt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:he},kt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let he=bt?.month||new Date,kt=he.getFullYear(),tt=he.getMonth(),co=new Date(kt,tt,1).getDay(),Io=new Date(kt,tt+1,0).getDate(),vr=new Date,Qa=[];for(let _t=co-1;_t>=0;_t--)Qa.push({day:new Date(kt,tt,-_t).getDate(),date:new Date(kt,tt-1,new Date(kt,tt,-_t).getDate()),isCurrentMonth:false});for(let _t=1;_t<=Io;_t++)Qa.push({day:_t,date:new Date(kt,tt,_t),isCurrentMonth:true});let er=42-Qa.length;for(let _t=1;_t<=er;_t++)Qa.push({day:_t,date:new Date(kt,tt+1,_t),isCurrentMonth:false});return Qa.map((_t,xs)=>{let ks=_t.date.toDateString()===vr.toDateString(),Lo=(Ue?typeof Ue=="string"?new Date(Ue):Ue:null)?.toDateString()===_t.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:_t.isCurrentMonth?Lo?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Lo?"#3B82F6":"transparent",boxShadow:ks&&!Lo?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{b?.(V.id,{[ae]:_t.date}),Gt(null);},children:_t.day},xs)})})()})]})]})]}),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:je(V)})});case "assignees":let Hr=r.filter(he=>V.assignees?.some(kt=>kt.name===he.name||kt.initials===he.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:he=>he.stopPropagation(),children:jsxRuntime.jsx(Yr,{assignedUsers:Hr,availableUsers:r,onChange:he=>{let kt=he.map(tt=>({id:tt.id,name:tt.name,initials:tt.initials,color:tt.color}));b?.(V.id,{assignees:kt.length>0?kt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:he=>he.stopPropagation(),children:jsxRuntime.jsx(Dd,{status:V.status||"todo",onChange:he=>{b?.(V.id,{status:he,progress:he==="completed"?100:V.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:`${V.progress}%`,backgroundColor:V.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:[V.progress,"%"]})]});case "priority":let hr={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},yr={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ia=hr[V.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:he=>he.stopPropagation(),children:jsxRuntime.jsx(jr,{priority:Ia,onChange:he=>{he&&b?.(V.id,{priority:yr[he]||"medium"});}})});default:return null}},Oe=O=>[{id:"hide",label:"Hide Column",icon:It.Hide,onClick:()=>l(O),disabled:O==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:It.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:It.SortDesc,onClick:()=>{}}],P=O=>O.subtasks&&O.subtasks.length>0?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:It.Add,onClick:()=>{x?.(O.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:It.Delete,onClick:()=>{T?T(O.id,O.name):v?.([O.id]);}}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:It.Pencil,onClick:()=>{n?.(O);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:It.Add,onClick:()=>{x?.(O.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:A?.contextMenu?.markIncomplete||"Mark Incomplete",icon:It.MarkIncomplete,onClick:()=>{b?.(O.id,{status:"todo",progress:0});},disabled:O.status==="todo"},{id:"setInProgress",label:A?.contextMenu?.setInProgress||"Set In Progress",icon:It.SetInProgress,onClick:()=>{b?.(O.id,{status:"in-progress"});},disabled:O.status==="in-progress"},{id:"markComplete",label:A?.contextMenu?.markComplete||"Mark Complete",icon:It.MarkComplete,onClick:()=>{b?.(O.id,{status:"completed",progress:100});},disabled:O.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:It.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:It.Delete,onClick:()=>{T?T(O.id,O.name):v?.([O.id]);}}],Z=c.filter(O=>O.visible),ye=Z.reduce((O,V)=>O+V.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:ye},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${He}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:Z.map((O,V)=>{let ve=V===Z.length-1,Le=O.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Le?"":"justify-center"}`,style:{width:`${O.width}px`,minWidth:`${O.minWidth??(Le?200:60)}px`,maxWidth:`${O.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ve?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Ae=>{Ae.preventDefault(),B({isOpen:true,x:Ae.clientX,y:Ae.clientY,type:"header",columnId:O.id});},onMouseEnter:Ae=>{Ae.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Ae=>{Ae.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:O.label,children:O.label}),O.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:re===O.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Ae=>{Ae.preventDefault(),Ae.stopPropagation(),ue(O.id),Se(Ae.clientX),R(O.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"}})})]},O.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(On,{columns:c,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>I(!me),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"})}),me&&jsxRuntime.jsxs("div",{ref:se,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:O=>O.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:()=>I(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Re},children:Y.map(({task:O,level:V},ve)=>{let Le=X(O.id),Ae=ne===O.id,z=Ae&&Fe==="above",ae=Ae&&Fe==="below",Ue=Ae&&Fe==="child",xt={};return Ue&&(xt.backgroundColor=`${t.accent}15`,xt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":O.id,className:`flex items-center cursor-pointer group ${_===O.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Le?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Le?t.accentLight:Ue?`${t.accent}15`:ve%2===0?t.bgPrimary:t.bgGrid,...xt},onMouseEnter:()=>N(O.id),onMouseLeave:()=>N(null),onClick:st=>{let hr=Do(e).map(he=>he.id),Ia=navigator.platform.toUpperCase().indexOf("MAC")>=0?st.metaKey:st.ctrlKey;ze(O.id,hr,Ia,st.shiftKey),s?.(O);},onDoubleClick:st=>{st.stopPropagation(),n?.(O);},onContextMenu:st=>{st.preventDefault(),B({isOpen:true,x:st.clientX,y:st.clientY,type:"task",task:O}),d?.(O,st);},whileHover:{backgroundColor:Le?t.accentLight:t.hoverBg},children:[z&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ae&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Z.map((st,Hr)=>{let hr=Hr===Z.length-1,yr=st.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${yr?"justify-start":"justify-center"}`,style:{width:`${st.width}px`,minWidth:`${st.minWidth??(yr?200:60)}px`,maxWidth:`${st.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:hr?"none":`1px solid ${L===O.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ve(st,O,yr?V:0)},`${O.id}-${st.id}`)})]},O.id)})}),jsxRuntime.jsx(No,{isOpen:S.isOpen,x:S.x,y:S.y,items:S.type==="header"&&S.columnId?Oe(S.columnId):S.type==="task"&&S.task?P(S.task):[],onClose:()=>B({...S,isOpen:false}),theme:t}),Ze&&Tt&&_&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Tt.x+12,top:Tt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let O=Y.find(V=>V.task.id===_)?.task;return O?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:O.name})}):null})()}),document.body)]})}function Vc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,d]=react.useState(e),[m,i]=react.useState(t),[c,l]=react.useState(null),[u,b]=react.useState(null),[y,C]=react.useState(null),[g,v]=react.useState(null),[h,p]=react.useState(0),[k,x]=react.useState(0),[D,T]=react.useState(null),[w,A]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:d,ghostWidth:m,setGhostWidth:i,connectionLine:c,setConnectionLine:l,hoveredTaskId:u,setHoveredTaskId:b,activeZone:y,setActiveZone:C,draggedSegmentIndex:g,setDraggedSegmentIndex:v,draggedSegmentStartX:h,setDraggedSegmentStartX:p,segmentDragOffsetX:k,setSegmentDragOffsetX:x,hoveredSegmentIndex:D,setHoveredSegmentIndex:T,isHovered:w,setIsHovered:A,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(j,ce)=>{r("none"),l(null),b(null),d(j),i(ce),x(0),v(null),p(0);}}}function Wn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:d,onClick:m,onDoubleClick:i,onContextMenu:c,onDateChange:l,onDependencyCreate:u,allTaskPositions:b=[],onDragMove:y,onHoverChange:C}){let g=Vc(t,r),v=react.useRef(null),h=react.useRef(null),p=react.useRef(null),{dragMode:k,setDragMode:x,dragOffset:D,setDragOffset:T,ghostX:w,setGhostX:A,ghostWidth:L,setGhostWidth:N,connectionLine:H,setConnectionLine:$,hoveredTaskId:j,setHoveredTaskId:ce,activeZone:J,setActiveZone:re,draggedSegmentIndex:ue,setDraggedSegmentIndex:Ce,draggedSegmentStartX:Se,setDraggedSegmentStartX:F,segmentDragOffsetX:R,setSegmentDragOffsetX:S,hoveredSegmentIndex:B,setHoveredSegmentIndex:_,isHovered:te,setIsHovered:ne,isDragging:de,isResizing:Fe,isConnecting:Q,resetDragState:Ye}=g,Te=32,Ke=8,Tt=e.endDate&&e.endDate<new Date&&e.progress<100,Et=e.isCriticalPath,Ze=o.name==="neutral"||o.today==="#1C1917",vt=e.status==="completed"||e.progress===100,bt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},me=e.isCriticalPath||Tt?"#DC2626":e.color?e.color:e.priority&&bt[e.priority]?bt[e.priority]:o.taskBarPrimary,se=(ge=>ge>=80?20:ge>=60?15:ge>=50?12:10)(r),pe=r<50,ze=r<40;react.useEffect(()=>{if(C)if(te&&!de&&!e.segments){let ge=a<100;C({task:e,x:t,y:a,width:r,height:Te,showBelow:ge});}else C(null);},[te,de,e,t,a,r,Te,C]);let X=ge=>ge.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Be=()=>{let ge=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ge} day${ge!==1?"s":""}`},G=ge=>Math.round(ge/s)*s,Y=ge=>{let Ve=Math.round(ge/s),Oe=new Date(n);return Oe.setDate(Oe.getDate()+Ve),Oe},He=(ge,Ve)=>{for(let Oe of b){if(Oe.id===e.id)continue;let P=5;if(ge>=Oe.x-P&&ge<=Oe.x+Oe.width+P&&Ve>=Oe.y-P&&Ve<=Oe.y+Oe.height+P)return Oe.id}return null},Re=react.useCallback((ge,Ve,Oe)=>{ge.preventDefault(),ge.stopPropagation();let P=v.current?.ownerSVGElement;if(!P)return;let Z=P.createSVGPoint();Z.x=ge.clientX,Z.y=ge.clientY;let ye=Z.matrixTransform(P.getScreenCTM()?.inverse()),O=Oe!==void 0?Oe:t,V=Ve;if(!V){let ve=ye.x-O;ge.shiftKey?(V="connect",$({x:t+r,y:a+Te/2})):ge.ctrlKey||ge.metaKey?V="move":ge.altKey?V=ve<r/2?"resize-start":"resize-end":ze?ve<r/2?V="move":V="resize-end":pe?ve<=se/2?V="resize-start":ve>=r-se/2?V="resize-end":V="move":ve<=se?V="resize-start":ve>=r-se?V="resize-end":V="move";}x(V),ne(false),re(null),V==="move"?T(ye.x-O):V==="connect"?$({x:t+r,y:a+Te/2}):T(0),A(O),N(r);},[t,r,a,Te]),je=react.useCallback(ge=>{let Ve=v.current?.ownerSVGElement;if(!Ve)return;let Oe=Ve.closest(".gantt-timeline-scroll");if(!Oe)return;let P=Oe.getBoundingClientRect(),Z=60,ye=15,O=0;if(ge.clientX<P.left+Z){let V=P.left+Z-ge.clientX;O=-Math.min(ye,V/2);}else if(ge.clientX>P.right-Z){let V=ge.clientX-(P.right-Z);O=Math.min(ye,V/2);}return O!==0&&(Oe.scrollLeft+=O),O!==0},[]),We=react.useCallback(ge=>{if(k==="none")return;p.current=ge;let Ve=v.current?.ownerSVGElement;if(!Ve)return;if(k==="move"||k==="resize-start"||k==="resize-end"){let Z=je(ge);Z&&!h.current?h.current=window.setInterval(()=>{p.current&&(je(p.current),We(p.current));},16):!Z&&h.current&&(window.clearInterval(h.current),h.current=null);}let Oe=Ve.createSVGPoint();Oe.x=ge.clientX,Oe.y=ge.clientY;let P=Oe.matrixTransform(Ve.getScreenCTM()?.inverse());if(k==="connect"){$({x:P.x,y:P.y});let Z=He(P.x,P.y);ce(Z);}else if(k==="move"){let Z=P.x-D,ye=G(Z);A(ye),N(r);let O=Math.round((ye-t)/s);if(y?.(e.id,O,true),e.segments&&e.segments.length>0&&ue!==null){let V=ye-Se;S(V);}}else if(k==="resize-start"){let Z=P.x,ye=G(Z),O=t+r-ye;O>=s&&(A(ye),N(O));}else if(k==="resize-end"){let Z=P.x,O=G(Z)-t;O>=s&&N(O);}},[k,t,r,s,D,e,G,ue,Se,He,ce,$,A,N,S,y,je]),le=react.useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),p.current=null,k!=="none"){if(k==="connect")j&&u&&u(e,j),$(null),ce(null);else {let ge=e.endDate.getTime()-e.startDate.getTime(),Ve,Oe,P=true;if(k==="move"){if(Ve=Y(w),Oe=new Date(Ve.getTime()+ge),e.segments&&e.segments.length>0&&ue!==null){let Z=Math.round(R/s),ye=e.segments.map((Le,Ae)=>{if(Ae===ue){let z=new Date(Le.startDate),ae=new Date(Le.endDate);return z.setDate(z.getDate()+Z),ae.setDate(ae.getDate()+Z),{startDate:z,endDate:ae}}return Le}),O=ye.flatMap(Le=>[Le.startDate,Le.endDate]),V=new Date(Math.min(...O.map(Le=>Le.getTime()))),ve=new Date(Math.max(...O.map(Le=>Le.getTime())));l?.({...e,segments:ye},V,ve),Ye(t,r);return}}else k==="resize-start"?(Ve=Y(w),Oe=e.endDate,Ve>Oe&&(console.warn("Invalid date range: start date must be before or equal to end date"),P=false)):k==="resize-end"?(Ve=e.startDate,Oe=Y(w+L),Oe<Ve&&(console.warn("Invalid date range: end date must be after or equal to start date"),P=false)):P=false;P&&Ve&&Oe&&(Oe.getTime()<Ve.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,Ve,Oe));}y?.(e.id,0,false),Ye(t,r);}},[k,w,L,e,l,j,u,t,r,s,Y,R,ue,Ye,y]);react.useEffect(()=>{if(k==="none")return;let ge=Oe=>{We(Oe);},Ve=()=>{le();};return window.addEventListener("mousemove",ge),window.addEventListener("mouseup",Ve),()=>{window.removeEventListener("mousemove",ge),window.removeEventListener("mouseup",Ve),h.current&&(window.clearInterval(h.current),h.current=null);}},[k,We,le]);let Ie=de&&!Q?w:t,ee=de&&!Q?L:r,_e=d.taskClass(e);return jsxRuntime.jsxs("g",{ref:v,"data-task-bar":"true",onClick:()=>!de&&m?.(e),onDoubleClick:ge=>{de||(ge.stopPropagation(),i?.(e));},onContextMenu:ge=>{ge.preventDefault(),c?.(e,ge);},onMouseEnter:()=>!de&&ne(true),onMouseLeave:()=>{de||(ne(false),re(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:Te,fill:"transparent",style:{pointerEvents:"all"}}),te&&!de&&!pe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:se,height:Te,fill:J==="resize-start"?o.accent:"transparent",opacity:J==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-start"),onMouseDown:ge=>Re(ge,"resize-start")}),jsxRuntime.jsx("rect",{x:t+se,y:a,width:r-se*2,height:Te,fill:J==="move"?o.accent:"transparent",opacity:J==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>re("move"),onMouseDown:ge=>Re(ge,"move")}),jsxRuntime.jsx("rect",{x:t+r-se,y:a,width:se,height:Te,fill:J==="resize-end"?o.accent:"transparent",opacity:J==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-end"),onMouseDown:ge=>Re(ge,"resize-end")})]}),te&&!de&&ze&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Te,fill:J==="move"?o.accent:"transparent",opacity:J==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>re("move"),onMouseDown:ge=>Re(ge,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Te,fill:J==="resize-end"?o.accent:"transparent",opacity:J==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-end"),onMouseDown:ge=>Re(ge,"resize-end")}),te&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Te-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),de&&!Q&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:w,y:a,width:L,height:Te,rx:Ke,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie,y:a,width:ee,height:Te,rx:Ke,fill:me,"data-task-class":_e,initial:{opacity:0,scale:.95},animate:{opacity:de&&!Q?.15:e.parentId?.6:te?.9:.8,scale:te&&!de?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ge=>Re(ge),style:{cursor:de?Q?"crosshair":Fe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Ie,y:a,width:ee*(e.progress/100),height:Te,rx:Ke,fill:me,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((ge,Ve)=>{let Oe=(ge.startDate.getTime()-n.getTime())/864e5*s,Z=(ge.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Oe+s,ye=de&&k==="move"&&ue===Ve,O=B===Ve,V=ye?Oe+R:Oe;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!de&&_(Ve),onMouseLeave:()=>!de&&_(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:V,y:a,width:Z,height:Te,rx:Ke,fill:me,initial:{opacity:0,scale:.95},animate:{opacity:ye||e.parentId?.6:O?.9:.8,scale:O&&!de?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ve=>{ve.stopPropagation(),Ce(Ve),F(Oe),Re(ve,void 0,Oe);},style:{cursor:de?Q?"crosshair":Fe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:V,y:a,width:Z*(e.progress/100),height:Te,rx:Ke,fill:me,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ve}`)}),Ze&&(Tt||Et)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Et&&!Tt&&jsxRuntime.jsx("rect",{x:Ie,y:a,width:ee,height:Te,rx:Ke,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Tt&&jsxRuntime.jsx("rect",{x:Ie,y:a,width:ee,height:Te,rx:Ke,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ee>60&&!e.segments&&(()=>{let ge=d.taskLabel(e),Ve=typeof ge=="string"?ge:e.name,Oe=Ve.length>Math.floor(ee/8)?`${Ve.substring(0,Math.floor(ee/8))}...`:Ve;return jsxRuntime.jsx("text",{x:Ie+12,y:a+Te/2,dominantBaseline:"middle",fill:vt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:vt?"line-through":"none"},children:Oe})})(),ee>100&&e.progress>0&&e.progress<100&&!de&&!e.segments&&jsxRuntime.jsxs("text",{x:Ie+ee-12,y:a+Te/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&ee>80&&!de&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Ie+ee-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Ie+ee-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(te||Fe)&&!Q&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Ie-2,y:a,width:16,height:Te,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>re("resize-start"),onMouseLeave:()=>re(null),onMouseDown:ge=>{ge.stopPropagation(),Re(ge,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie+4,y:a+8,width:3,height:Te-16,rx:1.5,fill:J==="resize-start"||k==="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:Ie+ee-14,y:a,width:16,height:Te,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>re("resize-end"),onMouseLeave:()=>re(null),onMouseDown:ge=>{ge.stopPropagation(),Re(ge,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie+ee-7,y:a+8,width:3,height:Te-16,rx:1.5,fill:J==="resize-end"||k==="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:te&&!de&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+Te/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>re("connect"),onMouseLeave:()=>re(null),onMouseDown:ge=>{ge.stopPropagation(),Re(ge,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Te/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:J==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Q&&H&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Te/2,x2:H.x,y2:H.y,stroke:j?o.statusCompleted:o.accent,strokeWidth:j?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:j?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:H.x,cy:H.y,r:j?8:6,fill:j?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),j&&jsxRuntime.jsx(framerMotion.motion.text,{x:H.x+15,y:H.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:H.x+10},animate:{opacity:1,x:H.x+15},transition:{duration:.2},children:"Connect"})]}),(te||de)&&!Q&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie-2,y:a-2,width:ee+4,height:Te+4,rx:Ke+2,fill:"none",stroke:de?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:de?.6:.4,initial:{opacity:0},animate:{opacity:de?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Fe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:w,y1:0,x2:w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:w+L,y1:0,x2:w+L,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:te&&!de&&!e.segments&&!C&&(()=>{let Oe=a<100,P=Oe?a+Te+13:a-82-13,Z=Oe?`M ${Ie+ee/2-6} ${a+Te+3} L ${Ie+ee/2} ${a+Te+13} L ${Ie+ee/2+6} ${a+Te+3}`:`M ${Ie+ee/2-6} ${a-13} L ${Ie+ee/2} ${a-3} L ${Ie+ee/2+6} ${a-13}`,ye=P+22,O=P+40,V=P+55,ve=P+70,Le=Oe?P+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Oe?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Oe?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Z,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Ie+ee/2-120,y:P,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:Ie+ee/2,y:ye,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Ie+ee/2-110,y:O,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Ie+ee/2-70,y:O,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:X(e.startDate)}),jsxRuntime.jsx("text",{x:Ie+ee/2-110,y:V,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Ie+ee/2-70,y:V,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:X(e.endDate)}),jsxRuntime.jsx("text",{x:Ie+ee/2+10,y:O,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Ie+ee/2+65,y:O,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Be()}),jsxRuntime.jsx("text",{x:Ie+ee/2+10,y:V,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Ie+ee/2+65,y:V,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:Ie+ee/2-110,y:ve,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Ie+ee/2-50,y:ve,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?"...":""]})]}),!Oe&&jsxRuntime.jsx("text",{x:Ie+ee/2,y:Le,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ze?"Left: move \u2022 Right: resize":pe?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function Yc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:d}=e,m=82,i=13,c=d?o+n+i:o-m-i,l=d?`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}`,u=c+22,b=c+40,y=c+55,C=c+70,g=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),v=()=>{if(!a.startDate||!a.endDate)return "N/A";let k=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${k} day${k!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:d?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:d?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:c,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:u,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:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?g(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?g(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:v()}),jsxRuntime.jsx("text",{x:r+s/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(k=>k.name).join(", ").substring(0,30),a.assignees.map(k=>k.name).join(", ").length>30?"...":""]})]})]})})}function Vn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:d=false}){let [m,i]=react.useState(false),[c,l]=react.useState(null),u=r-t,b=u>0,y=Math.abs(u)<5,v=20,h=!y&&a<=e,p,k;if(y)if(k=(e+a)/2,n==="squared")p=`M ${e} ${t} L ${a} ${r}`;else {let J=Math.min(Math.abs(a-e)/3,30);p=`M ${e} ${t} C ${e+J} ${t}, ${a-J} ${r}, ${a} ${r}`;}else if(k=a-v,h){let re=e+15,ue=a-v,Ce=b?t+20:t-20;if(k=ue,n==="squared")p=`M ${e} ${t} L ${re} ${t} L ${re} ${Ce} L ${ue} ${Ce} L ${ue} ${r} L ${a} ${r}`;else {let Se=(t+r)/2;p=`M ${e} ${t} C ${re+30} ${t}, ${ue-30} ${Se}, ${ue} ${Se} C ${ue+30} ${Se}, ${a-20} ${r}, ${a} ${r}`;}}else if(n==="squared")p=`M ${e} ${t} L ${k} ${t} L ${k} ${r} L ${a} ${r}`;else {let J=a-e,re=e+J/2,ue=Math.min(J*.4,80);p=`M ${e} ${t} C ${e+ue} ${t}, ${re} ${t}, ${re} ${(t+r)/2} C ${re} ${r}, ${a-ue} ${r}, ${a} ${r}`;}let x=5,D=`M ${a} ${r} L ${a-x} ${r-x*.5} M ${a} ${r} L ${a-x} ${r+x*.5}`,T=o.dependency,w=o.dependencyHover||T,A="#f87171",L="rgba(248, 113, 113, 0.15)",N=k,H=(t+r)/2;if(c)if(y)N=Math.max(e+10,Math.min(a-10,c.x)),H=t;else if(h){let J=e+15,re=a-v,ue=b?t+20:t-20,Ce=[[e,t,J,t],[J,t,J,ue],[J,ue,re,ue],[re,ue,re,r],[re,r,a,r]],Se=1/0,F={x:N,y:H};for(let R of Ce){let S=$(c.x,c.y,R[0],R[1],R[2],R[3]),B=Math.hypot(c.x-S.x,c.y-S.y);B<Se&&(Se=B,F=S);}N=F.x,H=F.y;}else {let J=[[e,t,k,t],[k,t,k,r],[k,r,a,r]],re=1/0,ue={x:N,y:H};for(let Ce of J){let Se=$(c.x,c.y,Ce[0],Ce[1],Ce[2],Ce[3]),F=Math.hypot(c.x-Se.x,c.y-Se.y);F<re&&(re=F,ue=Se);}N=ue.x,H=ue.y;}function $(J,re,ue,Ce,Se,F){let R=Se-ue,S=F-Ce,B=R*R+S*S;if(B===0)return {x:ue,y:Ce};let _=((J-ue)*R+(re-Ce)*S)/B;return _=Math.max(0,Math.min(1,_)),{x:ue+_*R,y:Ce+_*S}}let j=J=>{let re=J.currentTarget.ownerSVGElement;if(!re)return;let ue=re.getBoundingClientRect();l({x:J.clientX-ue.left,y:J.clientY-ue.top});},ce=()=>{i(false),l(null);};return d?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:ce,onMouseMove:j,children:[jsxRuntime.jsx("path",{d:p,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:p,fill:"none",stroke:w,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:p,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:J=>{J.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:N,cy:H,r:9,fill:L,stroke:A,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:H-3,x2:N+3,y2:H+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:H-3,x2:N-3,y2:H+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:ce,onMouseMove:j,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:p,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:p,fill:"none",stroke:m?w:T,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:T,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:T,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:J=>{J.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:N,cy:H,r:9,fill:L,stroke:A,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:H-3,x2:N+3,y2:H+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:H-3,x2:N-3,y2:H+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Kn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),d=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:d+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-d/2,y:a+16-d/2,width:d,height:d,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-(d+4)/2,y:a+16-(d+4)/2,width:d+4,height:d+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 xe={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(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,d=new Set,m=i=>{if(!n.has(i)){n.add(i),d.add(i);let c=r.get(i)||[];for(let l of c){if(!n.has(l)&&m(l))return true;if(d.has(l))return true}}return d.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=xe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=xe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=xe.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=xe.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
112
- `)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=xe.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=xe.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)=>xe.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=xe.findTaskById(e,t);return !a||!a.dependencies?[]:xe.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>xe.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>xe.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=xe.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=>xe.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=xe.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"]],d=s.map(m=>{let i=m.startDate&&m.endDate?xe.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?xe.formatDate(m.startDate):"N/A",m.endDate?xe.formatDate(m.endDate):"N/A",i>0?`${i} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:n,body:d,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=xe.flattenTasks(e).map(m=>{let i=m.startDate&&m.endDate?xe.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?xe.formatDate(m.startDate):"","End Date":m.endDate?xe.formatDate(m.endDate):"","Duration (days)":i>0?i:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(c=>c.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 d=a.utils.book_new();a.utils.book_append_sheet(d,s,"Gantt Tasks"),a.writeFile(d,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=xe.flattenTasks(e),o=new Map;r.forEach((u,b)=>{o.set(u.id,b+1);});let s=u=>u.toISOString().replace("Z",""),n=xe.getEarliestStartDate(e)||new Date,d=xe.getLatestEndDate(e)||new Date,m=r.map((u,b)=>{let y=o.get(u.id),C=u.startDate&&u.endDate?xe.calculateDuration(u.startDate,u.endDate):0,g=(u.dependencies||[]).filter(v=>o.has(v)).map(v=>`
111
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function bi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);},m=e.reduce((i,c)=>{let l=c.category||"Other";return i[l]||(i[l]=[]),i[l].push(c),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,c])=>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:c.map(l=>jsxRuntime.jsxs("button",{onClick:()=>d(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function yi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,d]=react.useState("export"),[m,i]=react.useState("json"),[c,l]=react.useState(null),p=react.useRef(null);if(!t)return null;let b=async()=>{let w=o?.current||void 0,g=await rd(e,m,w);od(g,m);},y=async w=>{let g=w.target.files?.[0];if(g){try{let v=await id(g),h=g.name.endsWith(".json")?"json":"csv",u=sd(v,h);l(u),u.success&&r&&r(u,v);}catch(v){l({success:false,errors:[`Failed to read file: ${v instanceof Error?v.message:"Unknown error"}`]});}p.current&&(p.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:()=>d("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:()=>d("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(w=>jsxRuntime.jsxs("button",{onClick:()=>i(w),className:f("p-4 rounded-lg border-2 transition-all text-center",m===w?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[w==="json"&&"\u{1F4C4}",w==="csv"&&"\u{1F4CA}",w==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:w})]},w))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:b,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:p,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>p.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"})]})]}),c&&jsxRuntime.jsxs("div",{className:f("p-4 rounded-lg",c.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",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:c.errors.map((w,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",w]},g))})]})]})]})]})]})}var Sb=["URGENT","HIGH","MEDIUM","LOW"],Eb=[{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"}],Pb=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function vi({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:d,availableUsers:m=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:l=true,compact:p=false,groupBy:b="none",onGroupByChange:y}){let[w,g]=react.useState(true),v=react.useCallback(D=>{a({search:D.target.value});},[a]),h=react.useCallback(D=>{a({dateFilter:D.target.value});},[a]),u=react.useCallback(D=>{r({by:D.target.value});},[r]),k=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),x=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 ${p?"filter-bar--compact":""} ${w?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!w),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:w?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter: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:w?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),x&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!w&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),d&&jsxRuntime.jsx("button",{onClick:d,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:v,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:D=>{let T=D.target.value;a({priorities:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Sb.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 T=D.target.value;a({assignees:T==="all"?[]:[T]});},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 T=D.target.value;a({labels:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:u,className:"filter-bar__select filter-bar__select--sm",children:Eb.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:k,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:b,onChange:D=>y(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Pb.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))})}),x&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function xi({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:d,onExportGanttCSV:m}){let[i,c]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let b=y=>{l.current&&!l.current.contains(y.target)&&c(false);};return i&&document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b);}},[i]);let p=b=>{b(),c(false);};return jsxRuntime.jsxs("div",{className:f("relative",r),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>c(!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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",b.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",b.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:()=>p(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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>p(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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>p(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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>p(async()=>await d?.()),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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>p(()=>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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>p(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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>p(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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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 ki={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"}},wi={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"}},Ci={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"}},eo={dark:ki,light:wi,neutral:Ci},An="dark";var In=react.createContext(void 0),Ub="asakaa-theme";function Cc({children:e,defaultTheme:t=An,storageKey:a=Ub}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let d=localStorage.getItem(a);if(d&&(d==="dark"||d==="light"||d==="neutral"))return d}return t}),s=react.useCallback(d=>{o(d),typeof window<"u"&&localStorage.setItem(a,d);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let d=document.documentElement,m=eo[r];Object.entries(m.colors).forEach(([c,l])=>{l&&d.style.setProperty(`--theme-${$b(c)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([c,l])=>{let p=m.colors[c];p&&d.style.setProperty(l,p);}),d.setAttribute("data-theme",r),d.classList.remove("theme-dark","theme-light","theme-neutral"),d.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:eo};return jsxRuntime.jsx(In.Provider,{value:n,children:e})}function wo(){let e=react.useContext(In);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function $b(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ti({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=wo();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(eo).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 Tc(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 Ln={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Nc={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Ni={en:Ln,es:Nc};function Dc(e){return Ni[e]||Ni.en}function Di(e,t){let a=Dc(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 To=react.createContext(Ln);function Ir(){return react.useContext(To)}function ih({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[d,m]=react.useState(false),[i,c]=react.useState(null),l=react.useRef(null),p=Ir();if(react.useEffect(()=>{let g=v=>{l.current&&!l.current.contains(v.target)&&m(false);};return d&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[d]),!(t||a||r||o||s||n))return null;let y=[{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(g=>g.handler),w=async(g,v)=>{if(v){c(g);try{await v();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!d),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:d?e.accent:e.bgSecondary,border:`1px solid ${d?e.accent:e.borderLight}`,color:d?"#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:p.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:d&&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:y.map((g,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(g.id,g.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:v<y.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.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===g.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):g.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function lh({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 dh({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 ch({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Ir();react.useEffect(()=>{let i=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=d.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:d.map((i,c)=>{let l=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:c<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:i.label}),l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function mh({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),d=react.useRef(null),m=Ir();react.useEffect(()=>{if(!s)return;let p=setTimeout(()=>{let b=w=>{d.current&&!d.current.contains(w.target)&&n(false);},y=w=>{w.key==="Escape"&&n(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",y),d._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(p),d._cleanup&&d._cleanup();}},[s]);let i=[{value:"all",label:m.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:m.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:m.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:m.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,l=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p=>{p.stopPropagation(),n(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?l?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?l?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:c?"#3B82F6":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:m.toolbar.filter||"Filters"}),c&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:l?"#0F1117":"#FFFFFF",border:`1px solid ${l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:l?"#6B7280":"#9CA3AF"},children:m.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-2",children:i.map(p=>{let b=t===p.value&&!r,y=()=>p.value==="all"?b?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(p.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:b?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${b?p.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:p.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]},p.value)})}),jsxRuntime.jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?l?"#3B82F6":"#2563EB":l?"#6B7280":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:m.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]})})]})})]})}function Rn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:d,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:l,onCreateTask:p,taskFilter:b="all",onTaskFilterChange:y,hideCompleted:w=false,onHideCompletedChange:g,onExportPNG:v,onExportPDF:h,onExportExcel:u,onExportCSV:k,onExportJSON:x,onExportMSProject:D}){let T=Ir(),C=v||h||u||k||x||D,I=[{value:"day",label:T.toolbar.day},{value:"week",label:T.toolbar.week},{value:"month",label:T.toolbar.month}],L=[{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(dh,{options:I,value:t,onChange:N=>a(N),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(ch,{theme:e,value:d,onChange:m}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(mh,{theme:e,value:b,onChange:y,hideCompleted:w,onHideCompletedChange:g})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[c&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||T.toolbar.createTask})]}),(C||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ih,{theme:e,onExportPNG:v,onExportPDF:h,onExportExcel:u,onExportCSV:k,onExportJSON:x,onExportMSProject:D}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(lh,{options:L,value:s,onChange:N=>n(N),theme:e})]})]})}function On({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),d=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let c=l=>{d.current&&!d.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let c=m.current.getBoundingClientRect();n({x:c.left,y:c.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(it,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:d,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(c=>jsxRuntime.jsxs("button",{onClick:()=>{t(c.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:c.label}),c.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function No({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[d,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let c=200,l=r.length*36+8,p=8,b=window.innerWidth,y=window.innerHeight,w=t,g=a;t+c+p>b&&(w=t-c,w<p&&(w=p)),a+l+p>y&&(g=y-l-p,g<p&&(g=p)),m({x:w,y:g});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let c=p=>{n.current&&!n.current.contains(p.target)&&o();},l=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let i=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c: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:`${d.x}px`,top:`${d.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(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:l=>{c.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var It={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 Bc({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:d,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:l,enableKeyboard:p=true}){let b=react.useRef(false),y=react.useCallback(u=>{b.current=u;},[]),w=react.useCallback(u=>{let k=[],x=D=>{for(let T of D)k.push(T),T.subtasks&&T.subtasks.length>0&&T.isExpanded&&x(T.subtasks);};return x(u),k},[]),g=react.useCallback(()=>{let u=w(e);for(let k of u)if(t.has(k.id))return k;return null},[e,t,w]),v=react.useCallback((u,k)=>{let x=w(e);if(x.length===0)return;let D=g();if(!D){a(x[0].id,false);return}let T=x.findIndex(L=>L.id===D.id);if(T===-1)return;let C=u==="up"?T-1:T+1;if(C<0||C>=x.length)return;let I=x[C];a(I.id,k);},[e,g,w,a]),h=react.useCallback(u=>{if(!p)return;let k=u.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||b.current){u.key==="Escape"&&(k.blur(),b.current=false);return}let T=navigator.platform.toUpperCase().indexOf("MAC")>=0?u.metaKey:u.ctrlKey,C=Array.from(t),I=g();if(u.key==="ArrowUp"){u.preventDefault(),v("up",u.shiftKey);return}if(u.key==="ArrowDown"){u.preventDefault(),v("down",u.shiftKey);return}if(I&&(u.key==="ArrowRight"||u.key==="ArrowLeft")){I.subtasks&&I.subtasks.length>0&&(u.preventDefault(),(u.key==="ArrowRight"&&!I.isExpanded||u.key==="ArrowLeft"&&I.isExpanded)&&c(I.id));return}if(u.altKey&&(u.key==="ArrowUp"||u.key==="ArrowDown")){C.length>0&&(u.preventDefault(),n(C,u.key==="ArrowUp"?"up":"down"));return}if(u.key==="Tab"&&!u.shiftKey){C.length>0&&(u.preventDefault(),d(C));return}if(u.key==="Tab"&&u.shiftKey){C.length>0&&(u.preventDefault(),m(C));return}if(u.key==="Enter"&&!u.shiftKey&&!T){I&&(u.preventDefault(),r(I.id,"below"));return}if(u.key==="Enter"&&u.shiftKey&&!T){I&&(u.preventDefault(),r(I.id,"above"));return}if(u.key==="Enter"&&T){I&&(u.preventDefault(),l(I.id));return}if(u.key==="F2"){I&&(u.preventDefault(),i(I.id));return}if(u.key==="Delete"||u.key==="Backspace"&&T){C.length>0&&(u.preventDefault(),o(C));return}if(u.key==="d"&&T&&!u.shiftKey){C.length>0&&(u.preventDefault(),s(C));return}},[p,t,g,v,r,o,s,n,d,m,i,c,l]);return react.useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:y}}function Oc(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(l=>{t(new Set([l])),r(l);},[]),s=react.useCallback(l=>{t(p=>{let b=new Set(p);return b.has(l)?b.delete(l):b.add(l),b}),r(l);},[]),n=react.useCallback((l,p)=>{if(!a){o(l);return}let b=p.indexOf(a),y=p.indexOf(l);if(b===-1||y===-1){o(l);return}let w=Math.min(b,y),g=Math.max(b,y),v=p.slice(w,g+1);t(new Set(v)),r(l);},[a,o]),d=react.useCallback((l,p,b,y)=>{y?n(l,p):b?s(l):o(l);},[o,s,n]),m=react.useCallback((l,p)=>{p?t(b=>{let y=new Set(b);return y.add(l),y}):o(l);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),c=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:d,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:c}}function Do(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let d={...r[n],parentId:o,level:s,position:n};t.push(d),d.subtasks&&d.subtasks.length>0&&d.isExpanded&&a(d.subtasks,d.id,s+1);}};return a(e),t}function zc(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=zc(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=Do(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],n=(l,p)=>{let b=[];return {tasks:l.filter(w=>{if(p.has(w.id))return b.push(w),false;if(w.subtasks){let g=n(w.subtasks,p);w.subtasks=g.tasks,b.push(...g.removed);}return true}),removed:b}},d=(l,p,b)=>l.map(y=>y.id===p?{...y,subtasks:[...y.subtasks||[],...b],isExpanded:true}:y.subtasks?{...y,subtasks:d(y.subtasks,p,b)}:y),m=new Set(t),{tasks:i,removed:c}=n(e,m);return d(i,s.id,c)}function Bi(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,c,l)=>{for(let p=0;p<i.length;p++){let b=i[p];if(b.id===c&&b.subtasks){let y=b.subtasks.findIndex(w=>w.id===l);if(y!==-1){let[w]=b.subtasks.splice(y,1);return w}}if(b.subtasks){let y=n(b.subtasks,c,l);if(y)return y}}return null},d=(i,c,l)=>{let p=i.findIndex(b=>b.id===c);if(p!==-1)return i.splice(p+1,0,l),i;for(let b of i)b.subtasks&&d(b.subtasks,c,l);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?d(s.subtasks,o.id,m):d(a,o.id,m));}return a}function Ri(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,d,m)=>{let i=n.findIndex(l=>l.id===d);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,d,m))return true;return false}let c=m==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],true)};return s(r,o,a),r}function Oi(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 zi(e,t){let a=[...e];for(let r of t){let o=n=>{let d=n.findIndex(c=>c.id===r);if(d===-1){for(let c of n)if(c.subtasks&&o(c.subtasks))return true;return false}let m=n[d],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(d+1,0,i),true},s=n=>n.map(d=>({...d,id:`${d.id}-copy-${Date.now()}`,subtasks:d.subtasks?s(d.subtasks):void 0}));o(a);}return a}function Uc(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"},d=m=>{let i=m.findIndex(l=>l.id===t);if(i===-1){for(let l of m)if(l.subtasks&&d(l.subtasks))return true;return false}let c=a==="above"?i:i+1;return m.splice(c,0,n),true};return d(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 $i(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:$i(a.subtasks,t)}:a)}function Hi(e,t){let a=c=>{for(let l of c){if(l.id===t)return l;if(l.subtasks){let p=a(l.subtasks);if(p)return p}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,d=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(d),color:r?.color||"#3B82F6"},i=c=>c.map(l=>{if(l.id===t){let p=l.subtasks||[];return {...l,subtasks:[...p,m],isExpanded:true}}return l.subtasks?{...l,subtasks:i(l.subtasks)}:l});return {tasks:i(e),newTask:m}}function $c(e,t,a,r){if(t===a)return e;let o=zc(e,t);if(!o)return e;if(a){let d=(m,i)=>{if(!m.subtasks)return false;for(let c of m.subtasks)if(c.id===i||d(c,i))return true;return false};if(d(o,a))return e}let s=d=>d.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 d=r!==void 0?r:n.length;n.splice(d,0,{...o,parentId:void 0});}else {let d=m=>m.map(i=>{if(i.id===a){let c=i.subtasks||[],l=r!==void 0?r:c.length,p=[...c];return p.splice(l,0,{...o,parentId:a}),{...i,subtasks:p,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:d(i.subtasks)}:i});n=d(n);}return n}function $n({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:d,onTaskToggle:m,scrollTop:i,columns:c,onToggleColumn:l,onColumnResize:p,onTaskUpdate:b,onTaskIndent:y,onTaskOutdent:w,onTaskMove:g,onMultiTaskDelete:v,onTaskDuplicate:h,onTaskCreate:u,onTaskRename:k,onCreateSubtask:x,onOpenTaskModal:D,onDeleteRequest:T,onTaskReparent:C}){let I=react.useContext(To),[L,N]=react.useState(null),[_,O]=react.useState(null),[W,le]=react.useState(""),de=react.useRef(null),[pe,ke]=react.useState(null),[Te,xe]=react.useState(0),[F,R]=react.useState(0),[S,B]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[G,Z]=react.useState(null),[ae,ie]=react.useState(null),[Fe,Q]=react.useState(null),Ye=react.useRef(0),Ne=5,Ke=react.useRef(false),[Tt,Et]=react.useState(null),[Ze,vt]=react.useState(false),[bt,Gt]=react.useState(null),[ce,A]=react.useState(false),oe=react.useRef(null);react.useEffect(()=>{function z(j){oe.current&&!oe.current.contains(j.target)&&A(false);}if(ce)return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[ce]),react.useEffect(()=>{_&&de.current&&(de.current.focus(),de.current.select());},[_]),react.useEffect(()=>{if(!pe)return;let z=ye=>{let Le=ye.clientX-Te,Ae=F+Le;p?.(pe,Ae);},j=()=>{ke(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",z),document.addEventListener("mouseup",j),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",j),document.body.style.cursor="",document.body.style.userSelect="";}},[pe,Te,F,p]);let{selectedTaskIds:me,handleTaskClick:ze,isTaskSelected:X}=Oc(),{setIsEditing:Be}=Bc({tasks:e,selectedTaskIds:me,onTaskSelect:(z,j)=>{let Le=Do(e).map(Ae=>Ae.id);ze(z,Le,j||false,false);},onTaskCreate:u||(()=>{}),onTaskDelete:v||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:w||(()=>{}),onTaskRename:z=>{let j=Do(e).find(ye=>ye.id===z);j&&We(j);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:z=>{let j=Do(e).find(ye=>ye.id===z);j&&D&&D(j);},enableKeyboard:true}),V=(z,j=0)=>{let ye=[];for(let Le of z)ye.push({task:Le,level:j}),Le.subtasks&&Le.subtasks.length>0&&Le.isExpanded&&ye.push(...V(Le.subtasks,j+1));return ye},Y=V(e),He=48,Re=Math.max(Y.length*a,600-He),je=z=>!z.startDate||!z.endDate?"-":`${Math.ceil((z.endDate.getTime()-z.startDate.getTime())/(1e3*60*60*24))}d`,We=z=>{O(z.id),le(z.name),Be(true);},se=z=>{W.trim()&&W!==e.find(j=>j.id===z)?.name&&k?.(z,W.trim()),O(null),le(""),Be(false);},Ie=()=>{O(null),le(""),Be(false);},ee=(z,j)=>{j.stopPropagation(),x?.(z.id);},_e=(z,j)=>{j.preventDefault(),Ye.current=j.clientY,Z(z),Ke.current=false,vt(false),Et({x:j.clientX,y:j.clientY});},Na=z=>{if(!G||(Math.abs(z.clientY-Ye.current)>Ne&&!Ke.current&&(Ke.current=true,vt(true)),Et({x:z.clientX,y:z.clientY}),!Ke.current))return;let ye=document.querySelectorAll("[data-task-row]"),Le=null,Ae=null;ye.forEach(U=>{let te=U.getBoundingClientRect(),Ue=U.getAttribute("data-task-row");if(Ue&&Ue!==G&&z.clientY>=te.top&&z.clientY<=te.bottom){Le=Ue;let xt=z.clientY-te.top,st=te.height;xt<st*.25?Ae="above":xt>st*.75?Ae="below":Ae="child";}}),ie(Le),Q(Ae);},ue=()=>{if(Ke.current&&G&&ae&&Fe){if(Fe==="child")C?.(G,ae);else if(Fe==="above"||Fe==="below"){let z=(Le,Ae,U=null)=>{for(let te of Le){if(te.id===Ae)return U;if(te.subtasks){let Ue=z(te.subtasks,Ae,te.id);if(Ue!==void 0)return Ue}}},j=z(e,ae,null),ye=(Le,Ae)=>{let U=Le.findIndex(te=>te.id===Ae);return Fe==="below"?U+1:U};if(j===null){let Le=ye(e,ae);C?.(G,null,Le);}else {let Le=Y.find(Ae=>Ae.task.id===j)?.task;if(Le?.subtasks){let Ae=ye(Le.subtasks,ae);C?.(G,j,Ae);}}}}Z(null),ie(null),Q(null),Et(null),Ke.current=false,vt(false);};react.useEffect(()=>{if(G)return document.addEventListener("mousemove",Na),document.addEventListener("mouseup",ue),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Na),document.removeEventListener("mouseup",ue),document.body.style.cursor="",document.body.style.userSelect="";}},[G,ae,Fe]);let Ve=(z,j,ye)=>{switch(z.id){case "name":let Le=_===j.id,Ae=L===j.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ye*20}px`},children:[C&&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:Ae?1:.3},onMouseDown:be=>_e(j.id,be),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),j.subtasks&&j.subtasks.length>0?jsxRuntime.jsx("button",{onClick:be=>{be.stopPropagation(),m?.(j.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:j.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:j.color||"#3B82F6",opacity:j.parentId?.6:1,borderColor:j.isMilestone?t.accent:"transparent",borderWidth:j.isMilestone?"2px":"0px"},title:j.isMilestone?"Milestone":j.parentId?"Subtask":"Task"})}),Le?jsxRuntime.jsx("input",{ref:de,type:"text",value:W,onChange:be=>le(be.target.value),onKeyDown:be=>{be.key==="Enter"?se(j.id):be.key==="Escape"&&Ie();},onBlur:()=>se(j.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:be=>be.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:j.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:j.parentId?"13px":"14px",fontWeight:j.isMilestone?600:j.parentId?400:600,letterSpacing:j.parentId?"0":"-0.01em"},title:j.name,children:j.name}),Ae&&!Le&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:be=>be.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:be=>ee(j,be),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:be=>{be.stopPropagation(),We(j);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let te=z.id==="startDate"?"startDate":"endDate",Ue=j[te],xt=bt?.taskId===j.id&&bt?.field===te,st=be=>be?(typeof be=="string"?new Date(be):be).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:be=>be.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:be=>{if(xt)Gt(null);else {let kt=be.currentTarget.getBoundingClientRect();Gt({taskId:j.id,field:te,month:Ue?typeof Ue=="string"?new Date(Ue):Ue:new Date,position:{top:kt.bottom+4,left:kt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:st(Ue)})]}),xt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Gt(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:bt?.position.top,left:bt?.position.left},onClick:be=>be.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let be=new Date,kt=new Date(be);kt.setDate(be.getDate()+1);let tt=new Date(be);tt.setDate(be.getDate()+7);let co=new Date(be);return co.setDate(be.getDate()+14),[{label:"Hoy",date:be},{label:"Ma\xF1ana",date:kt},{label:"Pr\xF3xima semana",date:tt},{label:"2 semanas",date:co}].map((vr,Qa)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:er=>er.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:er=>er.currentTarget.style.backgroundColor="transparent",onClick:()=>{b?.(j.id,{[te]:vr.date}),Gt(null);},children:vr.label},Qa))})(),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:be=>be.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:be=>be.currentTarget.style.backgroundColor="transparent",onClick:()=>{b?.(j.id,{[te]:void 0}),Gt(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:()=>Gt(be=>be?{...be,month:new Date(be.month.getFullYear(),be.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:bt?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Gt(be=>be?{...be,month:new Date(be.month.getFullYear(),be.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((be,kt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:be},kt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let be=bt?.month||new Date,kt=be.getFullYear(),tt=be.getMonth(),co=new Date(kt,tt,1).getDay(),Io=new Date(kt,tt+1,0).getDate(),vr=new Date,Qa=[];for(let _t=co-1;_t>=0;_t--)Qa.push({day:new Date(kt,tt,-_t).getDate(),date:new Date(kt,tt-1,new Date(kt,tt,-_t).getDate()),isCurrentMonth:false});for(let _t=1;_t<=Io;_t++)Qa.push({day:_t,date:new Date(kt,tt,_t),isCurrentMonth:true});let er=42-Qa.length;for(let _t=1;_t<=er;_t++)Qa.push({day:_t,date:new Date(kt,tt+1,_t),isCurrentMonth:false});return Qa.map((_t,xs)=>{let ks=_t.date.toDateString()===vr.toDateString(),Lo=(Ue?typeof Ue=="string"?new Date(Ue):Ue:null)?.toDateString()===_t.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:_t.isCurrentMonth?Lo?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Lo?"#3B82F6":"transparent",boxShadow:ks&&!Lo?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{b?.(j.id,{[te]:_t.date}),Gt(null);},children:_t.day},xs)})})()})]})]})]}),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:je(j)})});case "assignees":let Hr=r.filter(be=>j.assignees?.some(kt=>kt.name===be.name||kt.initials===be.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:be=>be.stopPropagation(),children:jsxRuntime.jsx(Yr,{assignedUsers:Hr,availableUsers:r,onChange:be=>{let kt=be.map(tt=>({id:tt.id,name:tt.name,initials:tt.initials,color:tt.color}));b?.(j.id,{assignees:kt.length>0?kt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:be=>be.stopPropagation(),children:jsxRuntime.jsx(Dd,{status:j.status||"todo",onChange:be=>{b?.(j.id,{status:be,progress:be==="completed"?100:j.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${j.progress}%`,backgroundColor:j.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[j.progress,"%"]})]});case "priority":let hr={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},yr={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ia=hr[j.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:be=>be.stopPropagation(),children:jsxRuntime.jsx(jr,{priority:Ia,onChange:be=>{be&&b?.(j.id,{priority:yr[be]||"medium"});}})});default:return null}},Oe=z=>[{id:"hide",label:"Hide Column",icon:It.Hide,onClick:()=>l(z),disabled:z==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:It.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:It.SortDesc,onClick:()=>{}}],P=z=>z.subtasks&&z.subtasks.length>0?[{id:"addSubtask",label:I?.contextMenu?.addSubtask||"Add Subtask",icon:It.Add,onClick:()=>{x?.(z.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:I?.contextMenu?.deleteTask||"Delete Task",icon:It.Delete,onClick:()=>{T?T(z.id,z.name):v?.([z.id]);}}]:[{id:"edit",label:I?.contextMenu?.editTask||"Edit Task",icon:It.Pencil,onClick:()=>{n?.(z);}},{id:"addSubtask",label:I?.contextMenu?.addSubtask||"Add Subtask",icon:It.Add,onClick:()=>{x?.(z.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:I?.contextMenu?.markIncomplete||"Mark Incomplete",icon:It.MarkIncomplete,onClick:()=>{b?.(z.id,{status:"todo",progress:0});},disabled:z.status==="todo"},{id:"setInProgress",label:I?.contextMenu?.setInProgress||"Set In Progress",icon:It.SetInProgress,onClick:()=>{b?.(z.id,{status:"in-progress"});},disabled:z.status==="in-progress"},{id:"markComplete",label:I?.contextMenu?.markComplete||"Mark Complete",icon:It.MarkComplete,onClick:()=>{b?.(z.id,{status:"completed",progress:100});},disabled:z.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:I?.contextMenu?.splitTask||"Split Task",icon:It.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:I?.contextMenu?.deleteTask||"Delete Task",icon:It.Delete,onClick:()=>{T?T(z.id,z.name):v?.([z.id]);}}],J=c.filter(z=>z.visible),he=J.reduce((z,j)=>z+j.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:he},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${He}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:J.map((z,j)=>{let ye=j===J.length-1,Le=z.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Le?"":"justify-center"}`,style:{width:`${z.width}px`,minWidth:`${z.minWidth??(Le?200:60)}px`,maxWidth:`${z.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ye?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Ae=>{Ae.preventDefault(),B({isOpen:true,x:Ae.clientX,y:Ae.clientY,type:"header",columnId:z.id});},onMouseEnter:Ae=>{Ae.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Ae=>{Ae.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:z.label,children:z.label}),z.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:pe===z.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Ae=>{Ae.preventDefault(),Ae.stopPropagation(),ke(z.id),xe(Ae.clientX),R(z.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},z.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(On,{columns:c,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>A(!ce),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"})}),ce&&jsxRuntime.jsxs("div",{ref:oe,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:z=>z.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>A(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Re},children:Y.map(({task:z,level:j},ye)=>{let Le=X(z.id),Ae=ae===z.id,U=Ae&&Fe==="above",te=Ae&&Fe==="below",Ue=Ae&&Fe==="child",xt={};return Ue&&(xt.backgroundColor=`${t.accent}15`,xt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":z.id,className:`flex items-center cursor-pointer group ${G===z.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Le?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Le?t.accentLight:Ue?`${t.accent}15`:ye%2===0?t.bgPrimary:t.bgGrid,...xt},onMouseEnter:()=>N(z.id),onMouseLeave:()=>N(null),onClick:st=>{let hr=Do(e).map(be=>be.id),Ia=navigator.platform.toUpperCase().indexOf("MAC")>=0?st.metaKey:st.ctrlKey;ze(z.id,hr,Ia,st.shiftKey),s?.(z);},onDoubleClick:st=>{st.stopPropagation(),n?.(z);},onContextMenu:st=>{st.preventDefault(),B({isOpen:true,x:st.clientX,y:st.clientY,type:"task",task:z}),d?.(z,st);},whileHover:{backgroundColor:Le?t.accentLight:t.hoverBg},children:[U&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),te&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),J.map((st,Hr)=>{let hr=Hr===J.length-1,yr=st.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${yr?"justify-start":"justify-center"}`,style:{width:`${st.width}px`,minWidth:`${st.minWidth??(yr?200:60)}px`,maxWidth:`${st.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:hr?"none":`1px solid ${L===z.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ve(st,z,yr?j:0)},`${z.id}-${st.id}`)})]},z.id)})}),jsxRuntime.jsx(No,{isOpen:S.isOpen,x:S.x,y:S.y,items:S.type==="header"&&S.columnId?Oe(S.columnId):S.type==="task"&&S.task?P(S.task):[],onClose:()=>B({...S,isOpen:false}),theme:t}),Ze&&Tt&&G&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Tt.x+12,top:Tt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let z=Y.find(j=>j.task.id===G)?.task;return z?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:z.name})}):null})()}),document.body)]})}function Vc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,d]=react.useState(e),[m,i]=react.useState(t),[c,l]=react.useState(null),[p,b]=react.useState(null),[y,w]=react.useState(null),[g,v]=react.useState(null),[h,u]=react.useState(0),[k,x]=react.useState(0),[D,T]=react.useState(null),[C,I]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:d,ghostWidth:m,setGhostWidth:i,connectionLine:c,setConnectionLine:l,hoveredTaskId:p,setHoveredTaskId:b,activeZone:y,setActiveZone:w,draggedSegmentIndex:g,setDraggedSegmentIndex:v,draggedSegmentStartX:h,setDraggedSegmentStartX:u,segmentDragOffsetX:k,setSegmentDragOffsetX:x,hoveredSegmentIndex:D,setHoveredSegmentIndex:T,isHovered:C,setIsHovered:I,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(W,le)=>{r("none"),l(null),b(null),d(W),i(le),x(0),v(null),u(0);}}}function Wn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:d,onClick:m,onDoubleClick:i,onContextMenu:c,onDateChange:l,onDependencyCreate:p,allTaskPositions:b=[],onDragMove:y,onHoverChange:w}){let g=Vc(t,r),v=react.useRef(null),h=react.useRef(null),u=react.useRef(null),{dragMode:k,setDragMode:x,dragOffset:D,setDragOffset:T,ghostX:C,setGhostX:I,ghostWidth:L,setGhostWidth:N,connectionLine:_,setConnectionLine:O,hoveredTaskId:W,setHoveredTaskId:le,activeZone:de,setActiveZone:pe,draggedSegmentIndex:ke,setDraggedSegmentIndex:Te,draggedSegmentStartX:xe,setDraggedSegmentStartX:F,segmentDragOffsetX:R,setSegmentDragOffsetX:S,hoveredSegmentIndex:B,setHoveredSegmentIndex:G,isHovered:Z,setIsHovered:ae,isDragging:ie,isResizing:Fe,isConnecting:Q,resetDragState:Ye}=g,Ne=32,Ke=8,Tt=e.endDate&&e.endDate<new Date&&e.progress<100,Et=e.isCriticalPath,Ze=o.name==="neutral"||o.today==="#1C1917",vt=e.status==="completed"||e.progress===100,bt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ce=e.isCriticalPath||Tt?"#DC2626":e.color?e.color:e.priority&&bt[e.priority]?bt[e.priority]:o.taskBarPrimary,oe=(ue=>ue>=80?20:ue>=60?15:ue>=50?12:10)(r),me=r<50,ze=r<40;react.useEffect(()=>{if(w)if(Z&&!ie&&!e.segments){let ue=a<100;w({task:e,x:t,y:a,width:r,height:Ne,showBelow:ue});}else w(null);},[Z,ie,e,t,a,r,Ne,w]);let X=ue=>ue.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Be=()=>{let ue=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ue} day${ue!==1?"s":""}`},V=ue=>Math.round(ue/s)*s,Y=ue=>{let Ve=Math.round(ue/s),Oe=new Date(n);return Oe.setDate(Oe.getDate()+Ve),Oe},He=(ue,Ve)=>{for(let Oe of b){if(Oe.id===e.id)continue;let P=5;if(ue>=Oe.x-P&&ue<=Oe.x+Oe.width+P&&Ve>=Oe.y-P&&Ve<=Oe.y+Oe.height+P)return Oe.id}return null},Re=react.useCallback((ue,Ve,Oe)=>{ue.preventDefault(),ue.stopPropagation();let P=v.current?.ownerSVGElement;if(!P)return;let J=P.createSVGPoint();J.x=ue.clientX,J.y=ue.clientY;let he=J.matrixTransform(P.getScreenCTM()?.inverse()),z=Oe!==void 0?Oe:t,j=Ve;if(!j){let ye=he.x-z;ue.shiftKey?(j="connect",O({x:t+r,y:a+Ne/2})):ue.ctrlKey||ue.metaKey?j="move":ue.altKey?j=ye<r/2?"resize-start":"resize-end":ze?ye<r/2?j="move":j="resize-end":me?ye<=oe/2?j="resize-start":ye>=r-oe/2?j="resize-end":j="move":ye<=oe?j="resize-start":ye>=r-oe?j="resize-end":j="move";}x(j),ae(false),pe(null),j==="move"?T(he.x-z):j==="connect"?O({x:t+r,y:a+Ne/2}):T(0),I(z),N(r);},[t,r,a,Ne]),je=react.useCallback(ue=>{let Ve=v.current?.ownerSVGElement;if(!Ve)return;let Oe=Ve.closest(".gantt-timeline-scroll");if(!Oe)return;let P=Oe.getBoundingClientRect(),J=60,he=15,z=0;if(ue.clientX<P.left+J){let j=P.left+J-ue.clientX;z=-Math.min(he,j/2);}else if(ue.clientX>P.right-J){let j=ue.clientX-(P.right-J);z=Math.min(he,j/2);}return z!==0&&(Oe.scrollLeft+=z),z!==0},[]),We=react.useCallback(ue=>{if(k==="none")return;u.current=ue;let Ve=v.current?.ownerSVGElement;if(!Ve)return;if(k==="move"||k==="resize-start"||k==="resize-end"){let J=je(ue);J&&!h.current?h.current=window.setInterval(()=>{u.current&&(je(u.current),We(u.current));},16):!J&&h.current&&(window.clearInterval(h.current),h.current=null);}let Oe=Ve.createSVGPoint();Oe.x=ue.clientX,Oe.y=ue.clientY;let P=Oe.matrixTransform(Ve.getScreenCTM()?.inverse());if(k==="connect"){O({x:P.x,y:P.y});let J=He(P.x,P.y);le(J);}else if(k==="move"){let J=P.x-D,he=V(J);I(he),N(r);let z=Math.round((he-t)/s);if(y?.(e.id,z,true),e.segments&&e.segments.length>0&&ke!==null){let j=he-xe;S(j);}}else if(k==="resize-start"){let J=P.x,he=V(J),z=t+r-he;z>=s&&(I(he),N(z));}else if(k==="resize-end"){let J=P.x,z=V(J)-t;z>=s&&N(z);}},[k,t,r,s,D,e,V,ke,xe,He,le,O,I,N,S,y,je]),se=react.useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),u.current=null,k!=="none"){if(k==="connect")W&&p&&p(e,W),O(null),le(null);else {let ue=e.endDate.getTime()-e.startDate.getTime(),Ve,Oe,P=true;if(k==="move"){if(Ve=Y(C),Oe=new Date(Ve.getTime()+ue),e.segments&&e.segments.length>0&&ke!==null){let J=Math.round(R/s),he=e.segments.map((Le,Ae)=>{if(Ae===ke){let U=new Date(Le.startDate),te=new Date(Le.endDate);return U.setDate(U.getDate()+J),te.setDate(te.getDate()+J),{startDate:U,endDate:te}}return Le}),z=he.flatMap(Le=>[Le.startDate,Le.endDate]),j=new Date(Math.min(...z.map(Le=>Le.getTime()))),ye=new Date(Math.max(...z.map(Le=>Le.getTime())));l?.({...e,segments:he},j,ye),Ye(t,r);return}}else k==="resize-start"?(Ve=Y(C),Oe=e.endDate,Ve>Oe&&(console.warn("Invalid date range: start date must be before or equal to end date"),P=false)):k==="resize-end"?(Ve=e.startDate,Oe=Y(C+L),Oe<Ve&&(console.warn("Invalid date range: end date must be after or equal to start date"),P=false)):P=false;P&&Ve&&Oe&&(Oe.getTime()<Ve.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,Ve,Oe));}y?.(e.id,0,false),Ye(t,r);}},[k,C,L,e,l,W,p,t,r,s,Y,R,ke,Ye,y]);react.useEffect(()=>{if(k==="none")return;let ue=Oe=>{We(Oe);},Ve=()=>{se();};return window.addEventListener("mousemove",ue),window.addEventListener("mouseup",Ve),()=>{window.removeEventListener("mousemove",ue),window.removeEventListener("mouseup",Ve),h.current&&(window.clearInterval(h.current),h.current=null);}},[k,We,se]);let Ie=ie&&!Q?C:t,ee=ie&&!Q?L:r,_e=d.taskClass(e);return jsxRuntime.jsxs("g",{ref:v,"data-task-bar":"true",onClick:()=>!ie&&m?.(e),onDoubleClick:ue=>{ie||(ue.stopPropagation(),i?.(e));},onContextMenu:ue=>{ue.preventDefault(),c?.(e,ue);},onMouseEnter:()=>!ie&&ae(true),onMouseLeave:()=>{ie||(ae(false),pe(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:Ne,fill:"transparent",style:{pointerEvents:"all"}}),Z&&!ie&&!me&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:oe,height:Ne,fill:de==="resize-start"?o.accent:"transparent",opacity:de==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>pe("resize-start"),onMouseDown:ue=>Re(ue,"resize-start")}),jsxRuntime.jsx("rect",{x:t+oe,y:a,width:r-oe*2,height:Ne,fill:de==="move"?o.accent:"transparent",opacity:de==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>pe("move"),onMouseDown:ue=>Re(ue,"move")}),jsxRuntime.jsx("rect",{x:t+r-oe,y:a,width:oe,height:Ne,fill:de==="resize-end"?o.accent:"transparent",opacity:de==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>pe("resize-end"),onMouseDown:ue=>Re(ue,"resize-end")})]}),Z&&!ie&&ze&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Ne,fill:de==="move"?o.accent:"transparent",opacity:de==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>pe("move"),onMouseDown:ue=>Re(ue,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ne,fill:de==="resize-end"?o.accent:"transparent",opacity:de==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>pe("resize-end"),onMouseDown:ue=>Re(ue,"resize-end")}),Z&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ne-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ie&&!Q&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:C,y:a,width:L,height:Ne,rx:Ke,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie,y:a,width:ee,height:Ne,rx:Ke,fill:ce,"data-task-class":_e,initial:{opacity:0,scale:.95},animate:{opacity:ie&&!Q?.15:e.parentId?.6:Z?.9:.8,scale:Z&&!ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ue=>Re(ue),style:{cursor:ie?Q?"crosshair":Fe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Ie,y:a,width:ee*(e.progress/100),height:Ne,rx:Ke,fill:ce,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((ue,Ve)=>{let Oe=(ue.startDate.getTime()-n.getTime())/864e5*s,J=(ue.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Oe+s,he=ie&&k==="move"&&ke===Ve,z=B===Ve,j=he?Oe+R:Oe;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!ie&&G(Ve),onMouseLeave:()=>!ie&&G(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:j,y:a,width:J,height:Ne,rx:Ke,fill:ce,initial:{opacity:0,scale:.95},animate:{opacity:he||e.parentId?.6:z?.9:.8,scale:z&&!ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ye=>{ye.stopPropagation(),Te(Ve),F(Oe),Re(ye,void 0,Oe);},style:{cursor:ie?Q?"crosshair":Fe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:j,y:a,width:J*(e.progress/100),height:Ne,rx:Ke,fill:ce,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ve}`)}),Ze&&(Tt||Et)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Et&&!Tt&&jsxRuntime.jsx("rect",{x:Ie,y:a,width:ee,height:Ne,rx:Ke,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Tt&&jsxRuntime.jsx("rect",{x:Ie,y:a,width:ee,height:Ne,rx:Ke,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ee>60&&!e.segments&&(()=>{let ue=d.taskLabel(e),Ve=typeof ue=="string"?ue:e.name,Oe=Ve.length>Math.floor(ee/8)?`${Ve.substring(0,Math.floor(ee/8))}...`:Ve;return jsxRuntime.jsx("text",{x:Ie+12,y:a+Ne/2,dominantBaseline:"middle",fill:vt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:vt?"line-through":"none"},children:Oe})})(),ee>100&&e.progress>0&&e.progress<100&&!ie&&!e.segments&&jsxRuntime.jsxs("text",{x:Ie+ee-12,y:a+Ne/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&ee>80&&!ie&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Ie+ee-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Ie+ee-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Z||Fe)&&!Q&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Ie-2,y:a,width:16,height:Ne,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>pe("resize-start"),onMouseLeave:()=>pe(null),onMouseDown:ue=>{ue.stopPropagation(),Re(ue,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie+4,y:a+8,width:3,height:Ne-16,rx:1.5,fill:de==="resize-start"||k==="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:Ie+ee-14,y:a,width:16,height:Ne,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>pe("resize-end"),onMouseLeave:()=>pe(null),onMouseDown:ue=>{ue.stopPropagation(),Re(ue,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie+ee-7,y:a+8,width:3,height:Ne-16,rx:1.5,fill:de==="resize-end"||k==="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&&!ie&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+Ne/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>pe("connect"),onMouseLeave:()=>pe(null),onMouseDown:ue=>{ue.stopPropagation(),Re(ue,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Ne/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:de==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Q&&_&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Ne/2,x2:_.x,y2:_.y,stroke:W?o.statusCompleted:o.accent,strokeWidth:W?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:W?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:_.x,cy:_.y,r:W?8:6,fill:W?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),W&&jsxRuntime.jsx(framerMotion.motion.text,{x:_.x+15,y:_.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:_.x+10},animate:{opacity:1,x:_.x+15},transition:{duration:.2},children:"Connect"})]}),(Z||ie)&&!Q&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Ie-2,y:a-2,width:ee+4,height:Ne+4,rx:Ke+2,fill:"none",stroke:ie?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:ie?.6:.4,initial:{opacity:0},animate:{opacity:ie?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Fe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:C,y1:0,x2:C,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:C+L,y1:0,x2:C+L,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Z&&!ie&&!e.segments&&!w&&(()=>{let Oe=a<100,P=Oe?a+Ne+13:a-82-13,J=Oe?`M ${Ie+ee/2-6} ${a+Ne+3} L ${Ie+ee/2} ${a+Ne+13} L ${Ie+ee/2+6} ${a+Ne+3}`:`M ${Ie+ee/2-6} ${a-13} L ${Ie+ee/2} ${a-3} L ${Ie+ee/2+6} ${a-13}`,he=P+22,z=P+40,j=P+55,ye=P+70,Le=Oe?P+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Oe?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Oe?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:J,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Ie+ee/2-120,y:P,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:Ie+ee/2,y:he,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Ie+ee/2-110,y:z,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Ie+ee/2-70,y:z,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:X(e.startDate)}),jsxRuntime.jsx("text",{x:Ie+ee/2-110,y:j,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Ie+ee/2-70,y:j,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:X(e.endDate)}),jsxRuntime.jsx("text",{x:Ie+ee/2+10,y:z,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Ie+ee/2+65,y:z,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Be()}),jsxRuntime.jsx("text",{x:Ie+ee/2+10,y:j,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Ie+ee/2+65,y:j,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:Ie+ee/2-110,y:ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Ie+ee/2-50,y:ye,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?"...":""]})]}),!Oe&&jsxRuntime.jsx("text",{x:Ie+ee/2,y:Le,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ze?"Left: move \u2022 Right: resize":me?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function Yc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:d}=e,m=82,i=13,c=d?o+n+i:o-m-i,l=d?`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}`,p=c+22,b=c+40,y=c+55,w=c+70,g=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),v=()=>{if(!a.startDate||!a.endDate)return "N/A";let k=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${k} day${k!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:d?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:d?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:c,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:p,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:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?g(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?g(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:v()}),jsxRuntime.jsx("text",{x:r+s/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(k=>k.name).join(", ").substring(0,30),a.assignees.map(k=>k.name).join(", ").length>30?"...":""]})]})]})})}function Vn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:d=false}){let[m,i]=react.useState(false),[c,l]=react.useState(null),p=r-t,b=p>0,y=Math.abs(p)<5,w=20,g=!y&&a<=e,v,h,u=a-e,k=e+u/2,x=24,D=8;if(y)h=(e+a)/2,n==="squared"?v=`M ${e} ${t} L ${a} ${r}`:v=`M ${e} ${t} C ${k} ${t}, ${k} ${r}, ${a} ${r}`;else if(h=a-w,n==="squared")if(g){let Te=e+15,xe=a-w,F=b?t+20:t-20;h=xe,v=`M ${e} ${t} L ${Te} ${t} L ${Te} ${F} L ${xe} ${F} L ${xe} ${r} L ${a} ${r}`;}else v=`M ${e} ${t} L ${h} ${t} L ${h} ${r} L ${a} ${r}`;else {let ke=b?r+x:t+x;v=`M ${e} ${t} C ${e+D*2} ${t}, ${e+D*2} ${ke}, ${k} ${ke} S ${a-D*2} ${r}, ${a} ${r}`;}let T=5,C=`M ${a} ${r} L ${a-T} ${r-T*.5} M ${a} ${r} L ${a-T} ${r+T*.5}`,I=o.dependency,L=o.dependencyHover||I,N="#f87171",_="rgba(248, 113, 113, 0.15)",O=h,W=(t+r)/2;if(c)if(y)O=Math.max(e+10,Math.min(a-10,c.x)),W=t;else if(g){let ke=e+15,Te=a-w,xe=b?t+20:t-20,F=[[e,t,ke,t],[ke,t,ke,xe],[ke,xe,Te,xe],[Te,xe,Te,r],[Te,r,a,r]],R=1/0,S={x:O,y:W};for(let B of F){let G=le(c.x,c.y,B[0],B[1],B[2],B[3]),Z=Math.hypot(c.x-G.x,c.y-G.y);Z<R&&(R=Z,S=G);}O=S.x,W=S.y;}else {let ke=[[e,t,h,t],[h,t,h,r],[h,r,a,r]],Te=1/0,xe={x:O,y:W};for(let F of ke){let R=le(c.x,c.y,F[0],F[1],F[2],F[3]),S=Math.hypot(c.x-R.x,c.y-R.y);S<Te&&(Te=S,xe=R);}O=xe.x,W=xe.y;}function le(ke,Te,xe,F,R,S){let B=R-xe,G=S-F,Z=B*B+G*G;if(Z===0)return {x:xe,y:F};let ae=((ke-xe)*B+(Te-F)*G)/Z;return ae=Math.max(0,Math.min(1,ae)),{x:xe+ae*B,y:F+ae*G}}let de=ke=>{let Te=ke.currentTarget.ownerSVGElement;if(!Te)return;let xe=Te.getBoundingClientRect();l({x:ke.clientX-xe.left,y:ke.clientY-xe.top});},pe=()=>{i(false),l(null);};return d?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:pe,onMouseMove:de,children:[jsxRuntime.jsx("path",{d:v,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:v,fill:"none",stroke:L,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:v,fill:"none",stroke:L,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:L,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:L,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:ke=>{ke.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:O,cy:W,r:9,fill:_,stroke:N,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:O-3,y1:W-3,x2:O+3,y2:W+3,stroke:N,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:O+3,y1:W-3,x2:O-3,y2:W+3,stroke:N,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:pe,onMouseMove:de,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:v,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:v,fill:"none",stroke:m?L:I,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:C,fill:"none",stroke:m?L:I,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?L:I,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:ke=>{ke.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:O,cy:W,r:9,fill:_,stroke:N,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:O-3,y1:W-3,x2:O+3,y2:W+3,stroke:N,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:O+3,y1:W-3,x2:O-3,y2:W+3,stroke:N,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Kn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),d=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:d+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-d/2,y:a+16-d/2,width:d,height:d,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-(d+4)/2,y:a+16-(d+4)/2,width:d+4,height:d+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 ve={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,d=new Set,m=i=>{if(!n.has(i)){n.add(i),d.add(i);let c=r.get(i)||[];for(let l of c){if(!n.has(l)&&m(l))return true;if(d.has(l))return true}}return d.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=ve.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ve.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ve.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=ve.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
112
+ `)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=ve.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=ve.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>ve.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=ve.findTaskById(e,t);return !a||!a.dependencies?[]:ve.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>ve.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>ve.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=ve.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>ve.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=ve.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],d=s.map(m=>{let i=m.startDate&&m.endDate?ve.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?ve.formatDate(m.startDate):"N/A",m.endDate?ve.formatDate(m.endDate):"N/A",i>0?`${i} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:n,body:d,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=ve.flattenTasks(e).map(m=>{let i=m.startDate&&m.endDate?ve.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?ve.formatDate(m.startDate):"","End Date":m.endDate?ve.formatDate(m.endDate):"","Duration (days)":i>0?i:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(c=>c.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 d=a.utils.book_new();a.utils.book_append_sheet(d,s,"Gantt Tasks"),a.writeFile(d,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=ve.flattenTasks(e),o=new Map;r.forEach((p,b)=>{o.set(p.id,b+1);});let s=p=>p.toISOString().replace("Z",""),n=ve.getEarliestStartDate(e)||new Date,d=ve.getLatestEndDate(e)||new Date,m=r.map((p,b)=>{let y=o.get(p.id),w=p.startDate&&p.endDate?ve.calculateDuration(p.startDate,p.endDate):0,g=(p.dependencies||[]).filter(v=>o.has(v)).map(v=>`
113
113
  <PredecessorLink>
114
114
  <PredecessorUID>${o.get(v)}</PredecessorUID>
115
115
  <Type>1</Type>
@@ -120,36 +120,36 @@
120
120
  <Task>
121
121
  <UID>${y}</UID>
122
122
  <ID>${b+1}</ID>
123
- <Name>${u.name.replace(/[<>&'"]/g,v=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[v]||v)}</Name>
123
+ <Name>${p.name.replace(/[<>&'"]/g,v=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[v]||v)}</Name>
124
124
  <Type>0</Type>
125
125
  <IsNull>0</IsNull>
126
126
  <CreateDate>${s(new Date)}</CreateDate>
127
127
  <WBS>${b+1}</WBS>
128
128
  <OutlineNumber>${b+1}</OutlineNumber>
129
- <OutlineLevel>${u.level||0}</OutlineLevel>
129
+ <OutlineLevel>${p.level||0}</OutlineLevel>
130
130
  <Priority>500</Priority>
131
- <Start>${u.startDate?s(u.startDate):""}</Start>
132
- <Finish>${u.endDate?s(u.endDate):""}</Finish>
133
- <Duration>PT${C*8}H0M0S</Duration>
131
+ <Start>${p.startDate?s(p.startDate):""}</Start>
132
+ <Finish>${p.endDate?s(p.endDate):""}</Finish>
133
+ <Duration>PT${w*8}H0M0S</Duration>
134
134
  <DurationFormat>7</DurationFormat>
135
- <Work>PT${C*8}H0M0S</Work>
136
- <Stop>${u.endDate?s(u.endDate):""}</Stop>
137
- <Resume>${u.startDate?s(u.startDate):""}</Resume>
135
+ <Work>PT${w*8}H0M0S</Work>
136
+ <Stop>${p.endDate?s(p.endDate):""}</Stop>
137
+ <Resume>${p.startDate?s(p.startDate):""}</Resume>
138
138
  <ResumeValid>0</ResumeValid>
139
139
  <EffortDriven>1</EffortDriven>
140
140
  <Recurring>0</Recurring>
141
141
  <OverAllocated>0</OverAllocated>
142
142
  <Estimated>0</Estimated>
143
- <Milestone>${u.isMilestone?"1":"0"}</Milestone>
144
- <Summary>${u.subtasks&&u.subtasks.length>0?"1":"0"}</Summary>
145
- <Critical>${u.isCriticalPath?"1":"0"}</Critical>
143
+ <Milestone>${p.isMilestone?"1":"0"}</Milestone>
144
+ <Summary>${p.subtasks&&p.subtasks.length>0?"1":"0"}</Summary>
145
+ <Critical>${p.isCriticalPath?"1":"0"}</Critical>
146
146
  <IsSubproject>0</IsSubproject>
147
147
  <IsSubprojectReadOnly>0</IsSubprojectReadOnly>
148
148
  <ExternalTask>0</ExternalTask>
149
- <EarlyStart>${u.startDate?s(u.startDate):""}</EarlyStart>
150
- <EarlyFinish>${u.endDate?s(u.endDate):""}</EarlyFinish>
151
- <LateStart>${u.startDate?s(u.startDate):""}</LateStart>
152
- <LateFinish>${u.endDate?s(u.endDate):""}</LateFinish>
149
+ <EarlyStart>${p.startDate?s(p.startDate):""}</EarlyStart>
150
+ <EarlyFinish>${p.endDate?s(p.endDate):""}</EarlyFinish>
151
+ <LateStart>${p.startDate?s(p.startDate):""}</LateStart>
152
+ <LateFinish>${p.endDate?s(p.endDate):""}</LateFinish>
153
153
  <StartVariance>0</StartVariance>
154
154
  <FinishVariance>0</FinishVariance>
155
155
  <WorkVariance>0</WorkVariance>
@@ -157,22 +157,22 @@
157
157
  <TotalSlack>0</TotalSlack>
158
158
  <FixedCost>0</FixedCost>
159
159
  <FixedCostAccrual>3</FixedCostAccrual>
160
- <PercentComplete>${u.progress}</PercentComplete>
161
- <PercentWorkComplete>${u.progress}</PercentWorkComplete>
160
+ <PercentComplete>${p.progress}</PercentComplete>
161
+ <PercentWorkComplete>${p.progress}</PercentWorkComplete>
162
162
  <Cost>0</Cost>
163
163
  <OvertimeCost>0</OvertimeCost>
164
164
  <OvertimeWork>PT0H0M0S</OvertimeWork>
165
- <ActualStart>${u.progress>0&&u.startDate?s(u.startDate):""}</ActualStart>
166
- <ActualFinish>${u.progress===100&&u.endDate?s(u.endDate):""}</ActualFinish>
167
- <ActualDuration>PT${Math.round(C*u.progress/100)*8}H0M0S</ActualDuration>
165
+ <ActualStart>${p.progress>0&&p.startDate?s(p.startDate):""}</ActualStart>
166
+ <ActualFinish>${p.progress===100&&p.endDate?s(p.endDate):""}</ActualFinish>
167
+ <ActualDuration>PT${Math.round(w*p.progress/100)*8}H0M0S</ActualDuration>
168
168
  <ActualCost>0</ActualCost>
169
169
  <ActualOvertimeCost>0</ActualOvertimeCost>
170
- <ActualWork>PT${Math.round(C*u.progress/100)*8}H0M0S</ActualWork>
170
+ <ActualWork>PT${Math.round(w*p.progress/100)*8}H0M0S</ActualWork>
171
171
  <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
172
- <RegularWork>PT${C*8}H0M0S</RegularWork>
173
- <RemainingDuration>PT${Math.round(C*(100-u.progress)/100)*8}H0M0S</RemainingDuration>
172
+ <RegularWork>PT${w*8}H0M0S</RegularWork>
173
+ <RemainingDuration>PT${Math.round(w*(100-p.progress)/100)*8}H0M0S</RemainingDuration>
174
174
  <RemainingCost>0</RemainingCost>
175
- <RemainingWork>PT${Math.round(C*(100-u.progress)/100)*8}H0M0S</RemainingWork>
175
+ <RemainingWork>PT${Math.round(w*(100-p.progress)/100)*8}H0M0S</RemainingWork>
176
176
  <RemainingOvertimeCost>0</RemainingOvertimeCost>
177
177
  <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
178
178
  <ACWP>0</ACWP>
@@ -195,8 +195,8 @@
195
195
  </Task>`}).join(""),i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
196
196
  <Project xmlns="http://schemas.microsoft.com/project">
197
197
  <SaveVersion>14</SaveVersion>
198
- <Name>${t.replace(/[<>&'"]/g,u=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[u]||u)}</Name>
199
- <Title>${t.replace(/[<>&'"]/g,u=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[u]||u)}</Title>
198
+ <Name>${t.replace(/[<>&'"]/g,p=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[p]||p)}</Name>
199
+ <Title>${t.replace(/[<>&'"]/g,p=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[p]||p)}</Title>
200
200
  <CreationDate>${s(new Date)}</CreationDate>
201
201
  <LastSaved>${s(new Date)}</LastSaved>
202
202
  <ScheduleFromStart>1</ScheduleFromStart>
@@ -339,9 +339,9 @@
339
339
  </Calendars>
340
340
  <Tasks>${m}
341
341
  </Tasks>
342
- </Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(c),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=xe.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 c=i.startDate&&i.endDate?xe.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let b of i.dependencies){let y=t.find(C=>C.id===b);if(y){o(y);let C=r.get(b)?.ef||0;l=Math.max(l,C);}}let u=l+c;r.set(i.id,{es:l,ef:u});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,d=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?xe.calculateDuration(i.startDate,i.endDate):0,l=t.filter(y=>y.dependencies&&y.dependencies.includes(i.id)),u=s;if(l.length>0)for(let y of l){d(y);let C=n.get(y.id)?.ls||0;u=Math.min(u,C);}let b=u-c;n.set(i.id,{ls:b,lf:u});};a.forEach(d);let m=[];for(let i of a){let c=r.get(i.id),l=n.get(i.id);if(c&&l){let u=l.ls-c.es;Math.abs(u)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=xe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(xe.calculateCriticalPath(e).includes(t))return 0;let o=xe.getDependentTasks(e,t);if(o.length===0){let d=xe.getLatestEndDate(e);if(!d)return null;let m=xe.calculateDuration(a.endDate,d);return Math.max(0,m)}let s=o.filter(d=>d.startDate).map(d=>d.startDate.getTime()).sort((d,m)=>d-m)[0];if(!s)return null;let n=xe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>xe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=xe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=xe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let d=xe.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=xe.calculateEndDate(m,d),c=l=>l.map(u=>u.id===n.id?{...u,startDate:m,endDate:i}:u.subtasks?{...u,subtasks:c(u.subtasks)}:u);s=c(s),s=xe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,d)=>{if(a===0)return [];let m=[],i=o.getTime(),c=1e3*60*60*24,l=xe.findTaskById(e,t);if(!l||!l.endDate)return [];let u=(b,y,C=new Set)=>{if(C.has(b))return;C.add(b);let g=xe.getDependentTasks(e,b);for(let v of g){if(!v.startDate||!v.endDate)continue;let h=r.findIndex(N=>N.id===v.id);if(h===-1)continue;let p=v.startDate.getTime(),x=(v.endDate.getTime()-p)/c,T=(p-i)/c*s,w=T+y*s,A=Math.max(x*s,s),L=d+h*n+12;m.push({taskId:v.id,taskName:v.name,originalX:T,previewX:w,width:A,y:L,rowIndex:h,daysDelta:y,color:v.color}),u(v.id,y,C);}};return u(t,a),m},splitTask:(e,t,a,r=3)=>{let o=xe.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 d=new Date(o.endDate);d.setDate(d.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:d}],i=c=>c.map(l=>l.id===o.id?{...l,endDate:d,segments:m}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function qn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:d="en",templates:m,dependencyLineStyle:i="curved",onTaskClick:c,onTaskDblClick:l,onTaskContextMenu:u,onTaskDateChange:b,onDependencyCreate:y,onDependencyDelete:C}){let v=Ir(),[h,p]=react.useState([]),[k,x]=react.useState(null),D=react.useCallback(F=>{x(F);},[]),T=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),w=r==="day"?60:r==="week"?20:8,A=T*w*n,L=F=>{let R=new Date(Date.UTC(F.getFullYear(),F.getMonth(),F.getDate())),S=R.getUTCDay()||7;R.setUTCDate(R.getUTCDate()+4-S);let B=new Date(Date.UTC(R.getUTCFullYear(),0,1));return Math.ceil(((R.getTime()-B.getTime())/864e5+1)/7)},N=F=>{let R=F.getDay();return R===0||R===6},H=react.useCallback(F=>{let R=Math.round(F/(w*n)),S=new Date(o);return S.setDate(S.getDate()+R),S},[o,w,n]),$=react.useCallback((F,R)=>{if(R.startDate&&R.endDate)return;let S=F.currentTarget.ownerSVGElement;if(!S)return;let B=S.createSVGPoint();B.x=F.clientX,B.y=F.clientY;let _=B.matrixTransform(S.getScreenCTM()?.inverse()),te=H(_.x),ne=new Date(te);ne.setDate(ne.getDate()+1),b?.(R,te,ne);},[H,b]),j=react.useMemo(()=>{let F=_=>_.map(te=>{if(te.subtasks&&te.subtasks.length>0){let ne=F(te.subtasks),de=ne.filter(Fe=>Fe.startDate&&Fe.endDate);if(de.length>0){let Fe=de.map(Ke=>Ke.startDate.getTime()),Q=de.map(Ke=>Ke.endDate.getTime()),Ye=new Date(Math.min(...Fe)),Te=new Date(Math.max(...Q));return {...te,subtasks:ne,startDate:Ye,endDate:Te}}return {...te,subtasks:ne}}return te}),R=(_,te=[])=>{for(let ne of _)te.push(ne),ne.subtasks&&ne.subtasks.length>0&&(ne.isExpanded===void 0||ne.isExpanded)&&R(ne.subtasks,te);return te},S=F(e);return R(S)},[e]),ce=react.useCallback(F=>{if(!F.startDate||!F.endDate)return {x:0,width:0};let R=F.startDate.getTime(),S=F.endDate.getTime(),B=o.getTime(),_=(R-B)/(1e3*60*60*24),te=(S-R)/(1e3*60*60*24),ne=_*w*n,de=Math.max(w*n,40),Fe=Math.max(te*w*n,de);return {x:ne,width:Fe}},[o,w,n]),J=react.useMemo(()=>j.filter(F=>F.startDate&&F.endDate).map(F=>{let{x:R,width:S}=ce(F),_=j.findIndex(te=>te.id===F.id)*a+12;return {id:F.id,x:R,y:_,width:S,height:32}}),[j,ce]),re=react.useCallback((F,R,S)=>{if(!S||R===0){p([]);return}let B=xe.calculateCascadePreview(e,F,R,j,o,w*n,a,48);p(B);},[e,j,o,w,n,a,48]),ue=react.useMemo(()=>{let F=[],R=new Date(o);for(;R<=s;){let _=(R.getTime()-o.getTime())/864e5*w*n;if(r==="day")F.push({date:new Date(R),label:R.toLocaleDateString(d,{day:"numeric",month:"short"}),x:_}),R.setDate(R.getDate()+1);else if(r==="week"){let te=L(R);F.push({date:new Date(R),label:`${v.labels.week} ${te}`,x:_}),R.setDate(R.getDate()+7);}else F.push({date:new Date(R),label:R.toLocaleDateString(d,{month:"short",year:"numeric"}),x:_}),R.setMonth(R.getMonth()+1);}return F},[o,s,r,w,n,d,v.labels.week]),Ce=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*w*n,[o,w,n]),Se=Math.max(j.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(A,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(A,1e3),height:48,fill:t.bgGrid}),ue.map((F,R)=>jsxRuntime.jsxs("g",{children:[R>0&&jsxRuntime.jsx("line",{x1:F.x,y1:0,x2:F.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:F.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:F.label})]},`header-${R}`)),Ce>=0&&Ce<=A&&jsxRuntime.jsx("circle",{cx:Ce,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(A,1e3),height:Se,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(A,1e3),height:Se,fill:t.bgPrimary}),ue.map((F,R)=>{let S=ue[R+1]?.x||A,B=N(F.date);return jsxRuntime.jsxs("g",{children:[B&&jsxRuntime.jsx("rect",{x:F.x,y:0,width:S-F.x,height:j.length*a,fill:t.bgWeekend,opacity:1}),R>0&&jsxRuntime.jsx("line",{x1:F.x,y1:0,x2:F.x,y2:j.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},R)}),j.map((F,R)=>{let S=F.startDate&&F.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:R*a,width:A,height:a,fill:R%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${F.id}`),!S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:R*a,width:A,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:B=>$(B,F),onMouseEnter:B=>{B.currentTarget.setAttribute("fill",t.accentLight),B.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:B=>{B.currentTarget.setAttribute("fill","transparent"),B.currentTarget.setAttribute("opacity","1");}},`clickable-${F.id}`),jsxRuntime.jsx("text",{x:Ce>0?Ce:100,y:R*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:v.labels.clickToSetDates},`placeholder-${F.id}`)]})]},`row-group-${F.id}`)}),j.map((F,R)=>{if(!F.startDate||!F.endDate)return null;let{x:S,width:B}=ce(F),_=R*a+12,te=F.subtasks&&F.subtasks.length>0&&!F.isMilestone;return F.isMilestone?jsxRuntime.jsx(Kn,{task:F,x:S+B/2,y:_+16,theme:t,onClick:c},F.id):te?jsxRuntime.jsxs("g",{onClick:()=>c?.(F),onContextMenu:ne=>{ne.preventDefault(),ne.stopPropagation(),u?.(F,ne);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:S,y:_,width:B,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:S,y1:_,x2:S+B,y2:_,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:_,x2:S,y2:_+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S+B,y1:_,x2:S+B,y2:_+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:_+32,x2:S+B,y2:_+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),B>60&&jsxRuntime.jsx("text",{x:S+12,y:_+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:F.name})]},F.id):jsxRuntime.jsx(Wn,{task:F,x:S,y:_,width:B,theme:t,dayWidth:w*n,startDate:o,templates:m,onClick:c,onDoubleClick:l,onContextMenu:u,onDateChange:b,onDependencyCreate:y,allTaskPositions:J,onDragMove:re,onHoverChange:D},F.id)}),j.map((F,R)=>!F.dependencies||F.dependencies.length===0||!F.startDate||!F.endDate?null:F.dependencies.map(S=>{let B=j.find(Te=>Te.id===S);if(!B||!B.startDate||!B.endDate)return null;let _=j.findIndex(Te=>Te.id===S),te=ce(B),ne=ce(F),de=te.x+te.width,Fe=_*a+28,Q=ne.x,Ye=R*a+28;return jsxRuntime.jsx(Vn,{x1:de,y1:Fe,x2:Q,y2:Ye,theme:t,lineStyle:i,onDelete:()=>C?.(F.id,S)},`dep-${S}-${F.id}`)})),h.map(F=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:F.previewX,y:F.y-48,width:F.width,height:32,rx:8,fill:F.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(F.daysDelta)>0&&jsxRuntime.jsx("text",{x:F.previewX+F.width/2,y:F.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:F.daysDelta>0?`+${F.daysDelta}d`:`${F.daysDelta}d`})]},`cascade-preview-${F.taskId}`)),Ce>=0&&Ce<=A&&jsxRuntime.jsx("line",{x1:Ce,y1:0,x2:Ce,y2:Se,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),k&&jsxRuntime.jsx(Yc,{tooltipData:k,theme:t})]})]})}var e0=['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"'],Zc=()=>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"})]}),t0=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),a0=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),r0=()=>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"})}),o0=()=>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 Xn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:d,onDependencyDelete:m}){let[i,c]=react.useState(false),[l,u]=react.useState(false),[b,y]=react.useState([]),[C,g]=react.useState(""),[v,h]=react.useState(false),[p,k]=react.useState(true),x=react.useRef(null),D=react.useRef(null),T=react.useRef(null),{enabled:w=true,placeholder:A='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:L="bottom-right",onCommand:N,suggestions:H=e0,maxHistory:$=50,persistHistory:j}=a,ce=j?.storageKey||"gantt-ai-history",J=j?.maxMessages??5;react.useEffect(()=>{if(j?.enabled)try{let R=localStorage.getItem(ce);if(R){let B=JSON.parse(R).map(_=>({..._,timestamp:new Date(_.timestamp)}));y(B.slice(-J));}}catch(R){console.warn("[GanttAIAssistant] Failed to load persisted history:",R);}},[j?.enabled,ce,J]),react.useEffect(()=>{if(j?.enabled&&b.length>0)try{let R=b.filter(S=>!S.isLoading).slice(-J);localStorage.setItem(ce,JSON.stringify(R));}catch(R){console.warn("[GanttAIAssistant] Failed to persist history:",R);}},[b,j?.enabled,ce,J]),react.useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"});},[b]),react.useEffect(()=>{i&&!l&&x.current&&setTimeout(()=>x.current?.focus(),100);},[i,l]);let re=react.useCallback(R=>{if(R.success)switch(R.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":R.taskId&&R.updates&&o?.(R.taskId,R.updates);break;case "create_task":R.newTask&&s?.(R.newTask);break;case "delete_task":R.taskId&&n?.(R.taskId);break;case "link_tasks":R.dependencyFrom&&R.dependencyTo&&d?.(R.dependencyFrom,R.dependencyTo);break;case "unlink_tasks":R.taskId&&R.dependencyFrom&&m?.(R.taskId,R.dependencyFrom);break}},[o,s,n,d,m]),ue=react.useCallback(async R=>{if(!R.trim()||v)return;let S={id:`user-${Date.now()}`,role:"user",content:R,timestamp:new Date};y(_=>[..._.slice(-($-1)),S]),g(""),k(false),h(true);let B={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(_=>[..._,B]);try{if(N){let _=await N(R,e);y(te=>{let ne=te.filter(Fe=>!Fe.isLoading),de={id:`assistant-${Date.now()}`,role:"assistant",content:_.message,timestamp:new Date,command:_};return [...ne,de]}),re(_);}else y(_=>[..._.filter(ne=>!ne.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(_){y(te=>[...te.filter(de=>!de.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${_ instanceof Error?_.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[v,$,N,e,re]),Ce=R=>{R.preventDefault(),ue(C);},Se=R=>{g(R),x.current?.focus();};if(react.useEffect(()=>{let R=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),c(B=>!B),i||u(false)),S.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[i]),react.useEffect(()=>{if(!i)return;let R=B=>{let _=B.target;T.current&&!T.current.contains(_)&&c(false);},S=setTimeout(()=>{document.addEventListener("mousedown",R);},100);return ()=>{clearTimeout(S),document.removeEventListener("mousedown",R);}},[i]),!w)return null;let F={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(it,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${F[L]} 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:()=>c(true),children:[jsxRuntime.jsx(Zc,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:T,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${F[L]} 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(Zc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>u(R=>!R),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(r0,{})}),jsxRuntime.jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(a0,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[b.length===0&&p&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:H.slice(0,4).map((R,S)=>jsxRuntime.jsx("button",{onClick:()=>Se(R),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:R.length>30?R.slice(0,30)+"...":R},S))})]}),b.map(R=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${R.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${R.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:R.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:R.role==="user"?"white":t.textPrimary},children:[R.isLoading?jsxRuntime.jsx(o0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:R.content}),R.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:R.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:R.command.success?"#10B981":"#EF4444"},children:[R.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:R.command.type.replace(/_/g," ")})]})]})},R.id)),jsxRuntime.jsx("div",{ref:D})]}),jsxRuntime.jsxs("form",{onSubmit:Ce,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:x,type:"text",value:C,onChange:R=>g(R.target.value),placeholder:A,disabled:v,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!C.trim()||v,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:C.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:C.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(t0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Qc(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,c=true)=>{r(l=>{let u=typeof i=="function"?i(l.present):i;if(o.current)return {...l,present:u};if(!c)return {...l,present:u};let b=[...l.past,l.present];return b.length>t&&b.shift(),{past:b,present:u,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:c,future:[i.present,...i.future]}});},[]),d=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],l=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:l}});},[]),m=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:d,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function em({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let d=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=d?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!d&&m&&n.key==="y"){n.preventDefault(),t();return}if(d&&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 l0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${xe.formatDate(e.startDate)} - ${xe.formatDate(e.endDate)}`);let a=xe.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=>xe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function tm(e){return {...l0,...e}}var b0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},om=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:d="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:c=[],templates:l,enableAutoCriticalPath:u=true,persistExpandedState:b,persistFilter:y,aiAssistant:C,locale:g="en",customTranslations:v,showCreateTaskButton:h=false,createTaskLabel:p,onCreateTask:k,taskFilter:x,onTaskFilterChange:D,onThemeChange:T,onTaskClick:w,onTaskDblClick:A,onTaskContextMenu:L,onTaskUpdate:N,onProgressChange:H,onTaskEdit:$,onTaskAddSubtask:j,onTaskMarkIncomplete:ce,onTaskSetInProgress:J,onDependencyCreate:re,onDependencyDelete:ue,onBeforeTaskAdd:Ce,onAfterTaskAdd:Se,onBeforeTaskUpdate:F,onAfterTaskUpdate:R,onBeforeTaskDelete:S,onAfterTaskDelete:B}=a,te=react.useContext(In)?.theme,[ne,de]=react.useState(te||s||"dark"),[Fe,Q]=react.useState(n),[Ye,Te]=react.useState(d),[Ke,Tt]=react.useState(1),Et=react.useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[Ze,vt]=react.useState(()=>{if(!y)return "all";try{let E=typeof y=="string"?y:"gantt-filter-state",M=localStorage.getItem(E);if(M){let W=JSON.parse(M);if(W.taskFilter)return W.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),bt=x??Ze,Gt=D??vt,[me,I]=react.useState(()=>{if(!y)return false;try{let E=typeof y=="string"?y:"gantt-filter-state",M=localStorage.getItem(E);if(M){let W=JSON.parse(M);if(typeof W.hideCompleted=="boolean")return W.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});react.useEffect(()=>{let E=Et();if(E)try{let M={taskFilter:bt,hideCompleted:me};localStorage.setItem(E,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving filter state to localStorage:",M);}},[bt,me,Et]);let[se,pe]=react.useState(0),[ze,X]=react.useState(false),[Be,G]=react.useState(null),[Y,He]=react.useState({isOpen:false,x:0,y:0,task:null}),[Re,je]=react.useState(null),[We,le]=react.useState(null);react.useEffect(()=>{te&&te!==ne&&de(te);},[te]),react.useEffect(()=>{s&&s!==ne&&de(s);},[s]);let Ie=react.useCallback(E=>{de(E),T?.(E);},[T]),{state:ee,setState:_e,undo:Na,redo:ge,canUndo:Ve,canRedo:Oe,clearHistory:P}=Qc(t,50),Z=react.useCallback(()=>b?typeof b=="string"?b:"gantt-expanded-tasks":null,[b]),ye=react.useRef(new Map),O=react.useRef(false);if(!O.current&&b){O.current=true;let E=typeof b=="string"?b:"gantt-expanded-tasks";try{let M=localStorage.getItem(E);if(M){let W=JSON.parse(M);Array.isArray(W)&&(ye.current=new Map(W));}}catch(M){console.warn("[GanttBoard] Error loading expanded state from localStorage:",M);}}let V=react.useCallback(()=>{let E=Z();if(E)try{let M=Array.from(ye.current.entries());localStorage.setItem(E,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving expanded state to localStorage:",M);}},[Z]);react.useEffect(()=>{let E=M=>M.map(W=>{let oe=ye.current.get(W.id),fe=oe!==void 0?{...W,isExpanded:oe}:W;return fe.subtasks?.length?{...fe,subtasks:E(fe.subtasks)}:fe});ye.current.size>0?_e(E(t)):_e(t);},[t,_e]);let ve=react.useRef(t),Le=react.useRef(true);react.useEffect(()=>{if(Le.current){Le.current=false,ve.current=ee;return}if(!r)return;let E=JSON.stringify(ve.current),M=JSON.stringify(ee);E!==M&&(ve.current=ee,r(ee));},[ee,r]);let Ae=react.useMemo(()=>Di(g,v),[g,v]),z=react.useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[ae,Ue]=react.useState(()=>z(Ae));react.useEffect(()=>{Ue(E=>E.map(M=>({...M,label:Ae.columns[M.id==="name"?"taskName":M.id]||M.label})));},[Ae]);let xt=react.useMemo(()=>ae.filter(M=>M.visible).reduce((M,W)=>M+W.width,0),[ae]),st=react.useRef(ae.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=ae.filter(oe=>oe.visible),M=E.map(oe=>oe.id).join(","),W=st.current;if(M!==W){let oe=E.some(Ee=>Ee.id!=="name"),fe=W.includes(",");oe?!fe&&oe&&G(null):G(null),st.current=M;}},[ae]);let Hr=60,hr=.6,yr=react.useMemo(()=>{let M=xt+Hr,W=typeof window<"u"?window.innerWidth*hr:800,oe=Math.max(M,W);return Be!==null?Math.max(200,Math.min(Be,oe)):Math.max(200,M)},[Be,xt]),Ia=react.useRef(null),he=react.useRef(null),kt=react.useRef(null),tt=react.useMemo(()=>Tc(ne),[ne]),co=react.useMemo(()=>({theme:tt,themeName:ne}),[tt,ne]),Io=react.useMemo(()=>tm(l),[l]),vr=react.useMemo(()=>{if(!u)return ee;let E=xe.calculateCriticalPath(ee),M=W=>W.map(oe=>({...oe,isCriticalPath:E.includes(oe.id),subtasks:oe.subtasks?M(oe.subtasks):void 0}));return M(ee)},[ee,u]),Qa=react.useMemo(()=>{if(bt==="all"&&!me)return vr;let E=M=>{let W=[];for(let oe of M){let fe=oe.subtasks?.length?E(oe.subtasks):void 0,Ee=false;if(me)Ee=oe.progress<100;else switch(bt){case "all":Ee=true;break;case "incomplete":Ee=oe.progress<100;break;case "in_progress":Ee=oe.progress>0&&oe.progress<100;break;case "completed":Ee=oe.progress===100;break}(Ee||fe&&fe.length>0)&&W.push({...oe,subtasks:fe});}return W};return E(vr)},[vr,bt,me]),er=b0(Ye);em({undo:Na,redo:ge,canUndo:Ve,canRedo:Oe,enabled:true}),react.useImperativeHandle(o,()=>({getTask:E=>xe.findTaskById(ee,E),addTask:(E,M)=>{_e(W=>{if(!M)return [...W,{...E,level:0}];let oe=fe=>fe.map(Ee=>Ee.id===M?{...Ee,subtasks:[...Ee.subtasks||[],{...E,parentId:M,level:(Ee.level||0)+1}],isExpanded:true}:Ee.subtasks?{...Ee,subtasks:oe(Ee.subtasks)}:Ee);return oe(W)});},updateTask:(E,M)=>{_e(W=>{let oe=fe=>fe.map(Ee=>Ee.id===E?{...Ee,...M}:Ee.subtasks?{...Ee,subtasks:oe(Ee.subtasks)}:Ee);return oe(W)});},deleteTask:E=>{_e(M=>{let W=oe=>oe.filter(fe=>fe.id===E?false:(fe.subtasks&&(fe.subtasks=W(fe.subtasks)),true));return W(M)});},deleteTasks:E=>{_e(M=>Oi(M,E));},duplicateTask:E=>{_e(M=>zi(M,[E]));},splitTask:(E,M,W=3)=>{_e(oe=>xe.splitTask(oe,E,M,W));},calculateEndDate:xe.calculateEndDate,calculateDuration:xe.calculateDuration,validateDependency:(E,M)=>!xe.validateDependencies(ee,E,M),getAllTasks:()=>xe.flattenTasks(ee),getTasksByStatus:E=>xe.flattenTasks(ee).filter(M=>M.status===E),getTasksByParent:E=>E?xe.findTaskById(ee,E)?.subtasks||[]:ee.filter(W=>!W.parentId),getCriticalPath:()=>xe.flattenTasks(ee).filter(E=>E.isCriticalPath),indentTask:E=>{_e(M=>Li(M,[E]));},outdentTask:E=>{_e(M=>Bi(M,[E]));},moveTask:(E,M)=>{_e(W=>Ri(W,[E],M));},createSubtask:async E=>{let{tasks:M,newTask:W}=Hi(ee,E);if(Ce){let oe=Ce({...W,parentId:E});if((oe instanceof Promise?await oe:oe)===false)return}_e(M),Se&&Se({...W,parentId:E});},scrollToTask:E=>{let W=xe.flattenTasks(ee).findIndex(oe=>oe.id===E);if(W!==-1&&Ia.current){let oe=W*er;Ia.current.scrollTo({top:oe,behavior:"smooth"}),he.current&&he.current.scrollTo({top:oe,behavior:"smooth"});}},highlightTask:(E,M=2e3)=>{},expandTask:E=>{_e(M=>{let W=oe=>oe.map(fe=>fe.id===E?{...fe,isExpanded:true}:fe.subtasks?{...fe,subtasks:W(fe.subtasks)}:fe);return W(M)});},collapseTask:E=>{_e(M=>{let W=oe=>oe.map(fe=>fe.id===E?{...fe,isExpanded:false}:fe.subtasks?{...fe,subtasks:W(fe.subtasks)}:fe);return W(M)});},expandAll:()=>{_e(E=>{let M=W=>W.map(oe=>({...oe,isExpanded:true,subtasks:oe.subtasks?M(oe.subtasks):void 0}));return M(E)});},collapseAll:()=>{_e(E=>{let M=W=>W.map(oe=>({...oe,isExpanded:false,subtasks:oe.subtasks?M(oe.subtasks):void 0}));return M(E)});},undo:Na,redo:ge,canUndo:()=>Ve,canRedo:()=>Oe,clearHistory:P,exportToPNG:async()=>{if(!kt.current||!Ia.current||!he.current)throw new Error("Gantt container not found");let E=kt.current,M=Ia.current.querySelector(".gantt-grid-scroll"),W=he.current,oe=M?.scrollTop||0,fe=W.scrollTop,Ee=E.style.overflow,Nt=E.style.height;try{let ot=M?.querySelector(".gantt-taskgrid-content"),Ot=W.querySelector("svg"),ma=ot?.scrollHeight||M?.scrollHeight||600,ua=Ot?.getBoundingClientRect().height||W.scrollHeight,Gr=(E.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(ma,ua)+20;M&&(M.scrollTop=0),W.scrollTop=0,E.style.overflow="visible",E.style.height=`${Gr}px`,await new Promise(kr=>setTimeout(kr,100));let tr=await rm__default.default(E,{backgroundColor:tt.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:kr=>{let po=window.getComputedStyle(kr),_r=parseInt(po.zIndex,10);return !isNaN(_r)&&_r>=50||po.position==="fixed"}});return new Promise((kr,po)=>{tr.toBlob(_r=>{_r?kr(_r):po(new Error("Failed to create blob from canvas"));},"image/png");})}finally{E.style.overflow=Ee,E.style.height=Nt,M&&(M.scrollTop=oe),W.scrollTop=fe;}},exportToPDF:async E=>{await xe.exportToPDF(ee,E);},exportToExcel:async E=>{await xe.exportToExcel(ee,E);},exportToJSON:()=>xe.exportToJSON(ee),exportToCSV:()=>xe.exportToCSV(ee),importFromJSON:E=>{let M=xe.importFromJSON(E);_e(M);},getTasks:()=>ee,refresh:()=>{_e(E=>[...E]);},clearAll:()=>{_e([]);}}),[ee,Na,ge,Ve,Oe,P,tt,er]);let _t=react.useCallback(E=>{Ue(M=>M.map(W=>W.id===E?{...W,visible:!W.visible}:W));},[]),xs=react.useCallback((E,M)=>{Ue(W=>W.map(oe=>{if(oe.id!==E)return oe;let fe=oe.minWidth??100,Ee=oe.maxWidth??800,Nt=Math.max(fe,Math.min(Ee,M));return {...oe,width:Nt}}));},[]),ks=react.useCallback(E=>{_e(M=>{let W=$i(M,E),oe=fe=>{for(let Ee of fe){if(Ee.id===E){ye.current.set(E,Ee.isExpanded??true);return}Ee.subtasks?.length&&oe(Ee.subtasks);}};return oe(W),V(),W}),a.onTaskToggleExpand?.(E);},[a,V]),Wr=react.useCallback((E,M)=>{if(F&&F(E,M)===false)return;let oe=xe.findTaskById(ee,E)?.progress,fe=Nt=>Nt.map(ot=>ot.id===E?{...ot,...M}:ot.subtasks?{...ot,subtasks:fe(ot.subtasks)}:ot);_e(fe(ee));let Ee=xe.findTaskById(fe(ee),E);Ee&&(N?.(Ee),R?.(Ee),M.progress!==void 0&&oe!==void 0&&M.progress!==oe&&H?.(E,oe,M.progress));},[ee,N,F,R,H]),Lo=react.useCallback(E=>{E.length!==0&&(_e(M=>Li(M,E)),a.onTaskIndent?.(E[0]));},[a]),pu=react.useCallback(E=>{E.length!==0&&(_e(M=>Bi(M,E)),a.onTaskOutdent?.(E[0]));},[a]),uu=react.useCallback((E,M,W)=>{_e(oe=>$c(oe,E,M,W)),a.onTaskReparent?.(E,M,W);},[a]),gu=react.useCallback((E,M)=>{E.length!==0&&(_e(W=>Ri(W,E,M)),a.onTaskMove?.(E[0],M));},[a]),ws=react.useCallback(async E=>{let M=[];for(let W of E)S&&await Promise.resolve(S(W))===false||M.push(W);M.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(M):(_e(W=>Oi(W,M)),M.forEach(W=>a.onTaskDelete?.(W))),B&&M.forEach(W=>B(W)));},[a,S,B]),fu=react.useCallback(E=>{_e(M=>zi(M,E)),E.forEach(M=>a.onTaskDuplicate?.(M));},[a]),bu=react.useCallback((E,M)=>{_e(W=>{let{tasks:oe,newTask:fe}=Uc(W,E,M);return Ce&&Ce(fe)===false?W:(a.onTaskCreate?.(fe.parentId,fe.position||0),Se?.(fe),oe)});},[a,Ce,Se]),hu=react.useCallback((E,M)=>{_e(W=>Ui(W,E,M)),a.onTaskRename?.(E,M);},[a]),Cs=react.useCallback(E=>{_e(M=>{let{tasks:W}=Hi(M,E);return a.onTaskCreate?.(E,0),W});},[a]),yu=react.useCallback((E,M,W)=>{let oe=E.startDate?Math.round((M.getTime()-E.startDate.getTime())/864e5):0,fe=ot=>ot.map(Ot=>Ot.id===E.id?{...Ot,startDate:M,endDate:W,...E.segments&&{segments:E.segments}}:Ot.subtasks?{...Ot,subtasks:fe(Ot.subtasks)}:Ot),Ee=fe(ee);Ee=xe.autoScheduleDependents(Ee,E.id,oe),_e(Ee);let Nt={...E,startDate:M,endDate:W};N?.(Nt);},[ee,N]),vu=react.useCallback((E,M)=>{L?.(E,M),He({isOpen:true,x:M.clientX,y:M.clientY,task:E});},[L]),xu=react.useCallback((E,M)=>{let W=xe.splitTask(ee,E.id,M);_e(W),He({isOpen:false,x:0,y:0,task:null});},[ee]),_l=react.useCallback(E=>{let M=xe.findTaskById(ee,E.id)||E;A?.(M),$||je(M);},[ee,A,$]),Vl=react.useCallback((E,M,W)=>{let oe=new Map,fe=ma=>{ma.forEach(ua=>{ua.dependencies&&oe.set(ua.id,ua.dependencies),ua.subtasks&&fe(ua.subtasks);});};fe(W);let Ee=oe.get(M)||[];oe.set(M,[...Ee,E]);let Nt=new Set,ot=new Set,Ot=ma=>{if(!Nt.has(ma)){Nt.add(ma),ot.add(ma);let ua=oe.get(ma)||[];for(let xr of ua){if(!Nt.has(xr)&&Ot(xr))return true;if(ot.has(xr))return true}}return ot.delete(ma),false};return Ot(M)},[]),jl=react.useCallback((E,M)=>{if(Vl(E.id,M,ee)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
342
+ </Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(c),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=ve.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let c=i.startDate&&i.endDate?ve.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let b of i.dependencies){let y=t.find(w=>w.id===b);if(y){o(y);let w=r.get(b)?.ef||0;l=Math.max(l,w);}}let p=l+c;r.set(i.id,{es:l,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,d=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?ve.calculateDuration(i.startDate,i.endDate):0,l=t.filter(y=>y.dependencies&&y.dependencies.includes(i.id)),p=s;if(l.length>0)for(let y of l){d(y);let w=n.get(y.id)?.ls||0;p=Math.min(p,w);}let b=p-c;n.set(i.id,{ls:b,lf:p});};a.forEach(d);let m=[];for(let i of a){let c=r.get(i.id),l=n.get(i.id);if(c&&l){let p=l.ls-c.es;Math.abs(p)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=ve.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ve.calculateCriticalPath(e).includes(t))return 0;let o=ve.getDependentTasks(e,t);if(o.length===0){let d=ve.getLatestEndDate(e);if(!d)return null;let m=ve.calculateDuration(a.endDate,d);return Math.max(0,m)}let s=o.filter(d=>d.startDate).map(d=>d.startDate.getTime()).sort((d,m)=>d-m)[0];if(!s)return null;let n=ve.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>ve.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ve.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ve.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let d=ve.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=ve.calculateEndDate(m,d),c=l=>l.map(p=>p.id===n.id?{...p,startDate:m,endDate:i}:p.subtasks?{...p,subtasks:c(p.subtasks)}:p);s=c(s),s=ve.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,d)=>{if(a===0)return [];let m=[],i=o.getTime(),c=1e3*60*60*24,l=ve.findTaskById(e,t);if(!l||!l.endDate)return [];let p=(b,y,w=new Set)=>{if(w.has(b))return;w.add(b);let g=ve.getDependentTasks(e,b);for(let v of g){if(!v.startDate||!v.endDate)continue;let h=r.findIndex(N=>N.id===v.id);if(h===-1)continue;let u=v.startDate.getTime(),x=(v.endDate.getTime()-u)/c,T=(u-i)/c*s,C=T+y*s,I=Math.max(x*s,s),L=d+h*n+12;m.push({taskId:v.id,taskName:v.name,originalX:T,previewX:C,width:I,y:L,rowIndex:h,daysDelta:y,color:v.color}),p(v.id,y,w);}};return p(t,a),m},splitTask:(e,t,a,r=3)=>{let o=ve.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let d=new Date(o.endDate);d.setDate(d.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:d}],i=c=>c.map(l=>l.id===o.id?{...l,endDate:d,segments:m}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function qn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:d="en",templates:m,dependencyLineStyle:i="curved",onTaskClick:c,onTaskDblClick:l,onTaskContextMenu:p,onTaskDateChange:b,onDependencyCreate:y,onDependencyDelete:w}){let v=Ir(),[h,u]=react.useState([]),[k,x]=react.useState(null),D=react.useCallback(F=>{x(F);},[]),T=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),C=r==="day"?60:r==="week"?20:8,I=T*C*n,L=F=>{let R=new Date(Date.UTC(F.getFullYear(),F.getMonth(),F.getDate())),S=R.getUTCDay()||7;R.setUTCDate(R.getUTCDate()+4-S);let B=new Date(Date.UTC(R.getUTCFullYear(),0,1));return Math.ceil(((R.getTime()-B.getTime())/864e5+1)/7)},N=F=>{let R=F.getDay();return R===0||R===6},_=react.useCallback(F=>{let R=Math.round(F/(C*n)),S=new Date(o);return S.setDate(S.getDate()+R),S},[o,C,n]),O=react.useCallback((F,R)=>{if(R.startDate&&R.endDate)return;let S=F.currentTarget.ownerSVGElement;if(!S)return;let B=S.createSVGPoint();B.x=F.clientX,B.y=F.clientY;let G=B.matrixTransform(S.getScreenCTM()?.inverse()),Z=_(G.x),ae=new Date(Z);ae.setDate(ae.getDate()+1),b?.(R,Z,ae);},[_,b]),W=react.useMemo(()=>{let F=G=>G.map(Z=>{if(Z.subtasks&&Z.subtasks.length>0){let ae=F(Z.subtasks),ie=ae.filter(Fe=>Fe.startDate&&Fe.endDate);if(ie.length>0){let Fe=ie.map(Ke=>Ke.startDate.getTime()),Q=ie.map(Ke=>Ke.endDate.getTime()),Ye=new Date(Math.min(...Fe)),Ne=new Date(Math.max(...Q));return {...Z,subtasks:ae,startDate:Ye,endDate:Ne}}return {...Z,subtasks:ae}}return Z}),R=(G,Z=[])=>{for(let ae of G)Z.push(ae),ae.subtasks&&ae.subtasks.length>0&&(ae.isExpanded===void 0||ae.isExpanded)&&R(ae.subtasks,Z);return Z},S=F(e);return R(S)},[e]),le=react.useCallback(F=>{if(!F.startDate||!F.endDate)return {x:0,width:0};let R=F.startDate.getTime(),S=F.endDate.getTime(),B=o.getTime(),G=(R-B)/(1e3*60*60*24),Z=(S-R)/(1e3*60*60*24),ae=G*C*n,ie=Math.max(C*n,40),Fe=Math.max(Z*C*n,ie);return {x:ae,width:Fe}},[o,C,n]),de=react.useMemo(()=>W.filter(F=>F.startDate&&F.endDate).map(F=>{let{x:R,width:S}=le(F),G=W.findIndex(Z=>Z.id===F.id)*a+12;return {id:F.id,x:R,y:G,width:S,height:32}}),[W,le]),pe=react.useCallback((F,R,S)=>{if(!S||R===0){u([]);return}let B=ve.calculateCascadePreview(e,F,R,W,o,C*n,a,48);u(B);},[e,W,o,C,n,a,48]),ke=react.useMemo(()=>{let F=[],R=new Date(o);for(;R<=s;){let G=(R.getTime()-o.getTime())/864e5*C*n;if(r==="day")F.push({date:new Date(R),label:R.toLocaleDateString(d,{day:"numeric",month:"short"}),x:G}),R.setDate(R.getDate()+1);else if(r==="week"){let Z=L(R);F.push({date:new Date(R),label:`${v.labels.week} ${Z}`,x:G}),R.setDate(R.getDate()+7);}else F.push({date:new Date(R),label:R.toLocaleDateString(d,{month:"short",year:"numeric"}),x:G}),R.setMonth(R.getMonth()+1);}return F},[o,s,r,C,n,d,v.labels.week]),Te=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*C*n,[o,C,n]),xe=Math.max(W.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(I,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(I,1e3),height:48,fill:t.bgGrid}),ke.map((F,R)=>jsxRuntime.jsxs("g",{children:[R>0&&jsxRuntime.jsx("line",{x1:F.x,y1:0,x2:F.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:F.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:F.label})]},`header-${R}`)),Te>=0&&Te<=I&&jsxRuntime.jsx("circle",{cx:Te,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(I,1e3),height:xe,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(I,1e3),height:xe,fill:t.bgPrimary}),ke.map((F,R)=>{let S=ke[R+1]?.x||I,B=N(F.date);return jsxRuntime.jsxs("g",{children:[B&&jsxRuntime.jsx("rect",{x:F.x,y:0,width:S-F.x,height:W.length*a,fill:t.bgWeekend,opacity:1}),R>0&&jsxRuntime.jsx("line",{x1:F.x,y1:0,x2:F.x,y2:W.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},R)}),W.map((F,R)=>{let S=F.startDate&&F.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:R*a,width:I,height:a,fill:R%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${F.id}`),!S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:R*a,width:I,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:B=>O(B,F),onMouseEnter:B=>{B.currentTarget.setAttribute("fill",t.accentLight),B.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:B=>{B.currentTarget.setAttribute("fill","transparent"),B.currentTarget.setAttribute("opacity","1");}},`clickable-${F.id}`),jsxRuntime.jsx("text",{x:Te>0?Te:100,y:R*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:v.labels.clickToSetDates},`placeholder-${F.id}`)]})]},`row-group-${F.id}`)}),W.map((F,R)=>{if(!F.startDate||!F.endDate)return null;let{x:S,width:B}=le(F),G=R*a+12,Z=F.subtasks&&F.subtasks.length>0&&!F.isMilestone;return F.isMilestone?jsxRuntime.jsx(Kn,{task:F,x:S+B/2,y:G+16,theme:t,onClick:c},F.id):Z?jsxRuntime.jsxs("g",{onClick:()=>c?.(F),onContextMenu:ae=>{ae.preventDefault(),ae.stopPropagation(),p?.(F,ae);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:S,y:G,width:B,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:S,y1:G,x2:S+B,y2:G,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:G,x2:S,y2:G+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S+B,y1:G,x2:S+B,y2:G+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:G+32,x2:S+B,y2:G+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),B>60&&jsxRuntime.jsx("text",{x:S+12,y:G+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:F.name})]},F.id):jsxRuntime.jsx(Wn,{task:F,x:S,y:G,width:B,theme:t,dayWidth:C*n,startDate:o,templates:m,onClick:c,onDoubleClick:l,onContextMenu:p,onDateChange:b,onDependencyCreate:y,allTaskPositions:de,onDragMove:pe,onHoverChange:D},F.id)}),W.map((F,R)=>!F.dependencies||F.dependencies.length===0||!F.startDate||!F.endDate?null:F.dependencies.map(S=>{let B=W.find(Ne=>Ne.id===S);if(!B||!B.startDate||!B.endDate)return null;let G=W.findIndex(Ne=>Ne.id===S),Z=le(B),ae=le(F),ie=Z.x+Z.width,Fe=G*a+28,Q=ae.x,Ye=R*a+28;return jsxRuntime.jsx(Vn,{x1:ie,y1:Fe,x2:Q,y2:Ye,theme:t,lineStyle:i,onDelete:()=>w?.(F.id,S)},`dep-${S}-${F.id}`)})),h.map(F=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:F.previewX,y:F.y-48,width:F.width,height:32,rx:8,fill:F.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(F.daysDelta)>0&&jsxRuntime.jsx("text",{x:F.previewX+F.width/2,y:F.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:F.daysDelta>0?`+${F.daysDelta}d`:`${F.daysDelta}d`})]},`cascade-preview-${F.taskId}`)),Te>=0&&Te<=I&&jsxRuntime.jsx("line",{x1:Te,y1:0,x2:Te,y2:xe,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),k&&jsxRuntime.jsx(Yc,{tooltipData:k,theme:t})]})]})}var e0=['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"'],Zc=()=>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"})]}),t0=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),a0=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),r0=()=>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"})}),o0=()=>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 Xn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:d,onDependencyDelete:m}){let[i,c]=react.useState(false),[l,p]=react.useState(false),[b,y]=react.useState([]),[w,g]=react.useState(""),[v,h]=react.useState(false),[u,k]=react.useState(true),x=react.useRef(null),D=react.useRef(null),T=react.useRef(null),{enabled:C=true,placeholder:I='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:L="bottom-right",onCommand:N,suggestions:_=e0,maxHistory:O=50,persistHistory:W}=a,le=W?.storageKey||"gantt-ai-history",de=W?.maxMessages??5;react.useEffect(()=>{if(W?.enabled)try{let R=localStorage.getItem(le);if(R){let B=JSON.parse(R).map(G=>({...G,timestamp:new Date(G.timestamp)}));y(B.slice(-de));}}catch(R){console.warn("[GanttAIAssistant] Failed to load persisted history:",R);}},[W?.enabled,le,de]),react.useEffect(()=>{if(W?.enabled&&b.length>0)try{let R=b.filter(S=>!S.isLoading).slice(-de);localStorage.setItem(le,JSON.stringify(R));}catch(R){console.warn("[GanttAIAssistant] Failed to persist history:",R);}},[b,W?.enabled,le,de]),react.useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"});},[b]),react.useEffect(()=>{i&&!l&&x.current&&setTimeout(()=>x.current?.focus(),100);},[i,l]);let pe=react.useCallback(R=>{if(R.success)switch(R.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":R.taskId&&R.updates&&o?.(R.taskId,R.updates);break;case "create_task":R.newTask&&s?.(R.newTask);break;case "delete_task":R.taskId&&n?.(R.taskId);break;case "link_tasks":R.dependencyFrom&&R.dependencyTo&&d?.(R.dependencyFrom,R.dependencyTo);break;case "unlink_tasks":R.taskId&&R.dependencyFrom&&m?.(R.taskId,R.dependencyFrom);break}},[o,s,n,d,m]),ke=react.useCallback(async R=>{if(!R.trim()||v)return;let S={id:`user-${Date.now()}`,role:"user",content:R,timestamp:new Date};y(G=>[...G.slice(-(O-1)),S]),g(""),k(false),h(true);let B={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(G=>[...G,B]);try{if(N){let G=await N(R,e);y(Z=>{let ae=Z.filter(Fe=>!Fe.isLoading),ie={id:`assistant-${Date.now()}`,role:"assistant",content:G.message,timestamp:new Date,command:G};return [...ae,ie]}),pe(G);}else y(G=>[...G.filter(ae=>!ae.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(G){y(Z=>[...Z.filter(ie=>!ie.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${G instanceof Error?G.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[v,O,N,e,pe]),Te=R=>{R.preventDefault(),ke(w);},xe=R=>{g(R),x.current?.focus();};if(react.useEffect(()=>{let R=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),c(B=>!B),i||p(false)),S.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[i]),react.useEffect(()=>{if(!i)return;let R=B=>{let G=B.target;T.current&&!T.current.contains(G)&&c(false);},S=setTimeout(()=>{document.addEventListener("mousedown",R);},100);return ()=>{clearTimeout(S),document.removeEventListener("mousedown",R);}},[i]),!C)return null;let F={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(it,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${F[L]} 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:()=>c(true),children:[jsxRuntime.jsx(Zc,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:T,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${F[L]} 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(Zc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>p(R=>!R),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(r0,{})}),jsxRuntime.jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(a0,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[b.length===0&&u&&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:_.slice(0,4).map((R,S)=>jsxRuntime.jsx("button",{onClick:()=>xe(R),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:R.length>30?R.slice(0,30)+"...":R},S))})]}),b.map(R=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${R.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${R.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:R.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:R.role==="user"?"white":t.textPrimary},children:[R.isLoading?jsxRuntime.jsx(o0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:R.content}),R.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:R.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:R.command.success?"#10B981":"#EF4444"},children:[R.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:R.command.type.replace(/_/g," ")})]})]})},R.id)),jsxRuntime.jsx("div",{ref:D})]}),jsxRuntime.jsxs("form",{onSubmit:Te,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:x,type:"text",value:w,onChange:R=>g(R.target.value),placeholder:I,disabled:v,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!w.trim()||v,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:w.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:w.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(t0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Qc(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,c=true)=>{r(l=>{let p=typeof i=="function"?i(l.present):i;if(o.current)return {...l,present:p};if(!c)return {...l,present:p};let b=[...l.past,l.present];return b.length>t&&b.shift(),{past:b,present:p,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:c,future:[i.present,...i.future]}});},[]),d=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],l=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:l}});},[]),m=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:d,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function em({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let d=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=d?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!d&&m&&n.key==="y"){n.preventDefault(),t();return}if(d&&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 l0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ve.formatDate(e.startDate)} - ${ve.formatDate(e.endDate)}`);let a=ve.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>ve.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function tm(e){return {...l0,...e}}var b0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},om=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:d="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:c=[],templates:l,enableAutoCriticalPath:p=true,persistExpandedState:b,persistFilter:y,aiAssistant:w,locale:g="en",customTranslations:v,showCreateTaskButton:h=false,createTaskLabel:u,onCreateTask:k,taskFilter:x,onTaskFilterChange:D,onThemeChange:T,onTaskClick:C,onTaskDblClick:I,onTaskContextMenu:L,onTaskUpdate:N,onProgressChange:_,onTaskEdit:O,onTaskAddSubtask:W,onTaskMarkIncomplete:le,onTaskSetInProgress:de,onDependencyCreate:pe,onDependencyDelete:ke,onBeforeTaskAdd:Te,onAfterTaskAdd:xe,onBeforeTaskUpdate:F,onAfterTaskUpdate:R,onBeforeTaskDelete:S,onAfterTaskDelete:B}=a,Z=react.useContext(In)?.theme,[ae,ie]=react.useState(Z||s||"dark"),[Fe,Q]=react.useState(n),[Ye,Ne]=react.useState(d),[Ke,Tt]=react.useState(1),Et=react.useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[Ze,vt]=react.useState(()=>{if(!y)return "all";try{let E=typeof y=="string"?y:"gantt-filter-state",M=localStorage.getItem(E);if(M){let H=JSON.parse(M);if(H.taskFilter)return H.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),bt=x??Ze,Gt=D??vt,[ce,A]=react.useState(()=>{if(!y)return false;try{let E=typeof y=="string"?y:"gantt-filter-state",M=localStorage.getItem(E);if(M){let H=JSON.parse(M);if(typeof H.hideCompleted=="boolean")return H.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});react.useEffect(()=>{let E=Et();if(E)try{let M={taskFilter:bt,hideCompleted:ce};localStorage.setItem(E,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving filter state to localStorage:",M);}},[bt,ce,Et]);let[oe,me]=react.useState(0),[ze,X]=react.useState(false),[Be,V]=react.useState(null),[Y,He]=react.useState({isOpen:false,x:0,y:0,task:null}),[Re,je]=react.useState(null),[We,se]=react.useState(null);react.useEffect(()=>{Z&&Z!==ae&&ie(Z);},[Z]),react.useEffect(()=>{s&&s!==ae&&ie(s);},[s]);let Ie=react.useCallback(E=>{ie(E),T?.(E);},[T]),{state:ee,setState:_e,undo:Na,redo:ue,canUndo:Ve,canRedo:Oe,clearHistory:P}=Qc(t,50),J=react.useCallback(()=>b?typeof b=="string"?b:"gantt-expanded-tasks":null,[b]),he=react.useRef(new Map),z=react.useRef(false);if(!z.current&&b){z.current=true;let E=typeof b=="string"?b:"gantt-expanded-tasks";try{let M=localStorage.getItem(E);if(M){let H=JSON.parse(M);Array.isArray(H)&&(he.current=new Map(H));}}catch(M){console.warn("[GanttBoard] Error loading expanded state from localStorage:",M);}}let j=react.useCallback(()=>{let E=J();if(E)try{let M=Array.from(he.current.entries());localStorage.setItem(E,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving expanded state to localStorage:",M);}},[J]);react.useEffect(()=>{let E=M=>M.map(H=>{let re=he.current.get(H.id),ge=re!==void 0?{...H,isExpanded:re}:H;return ge.subtasks?.length?{...ge,subtasks:E(ge.subtasks)}:ge});he.current.size>0?_e(E(t)):_e(t);},[t,_e]);let ye=react.useRef(t),Le=react.useRef(true);react.useEffect(()=>{if(Le.current){Le.current=false,ye.current=ee;return}if(!r)return;let E=JSON.stringify(ye.current),M=JSON.stringify(ee);E!==M&&(ye.current=ee,r(ee));},[ee,r]);let Ae=react.useMemo(()=>Di(g,v),[g,v]),U=react.useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[te,Ue]=react.useState(()=>U(Ae));react.useEffect(()=>{Ue(E=>E.map(M=>({...M,label:Ae.columns[M.id==="name"?"taskName":M.id]||M.label})));},[Ae]);let xt=react.useMemo(()=>te.filter(M=>M.visible).reduce((M,H)=>M+H.width,0),[te]),st=react.useRef(te.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=te.filter(re=>re.visible),M=E.map(re=>re.id).join(","),H=st.current;if(M!==H){let re=E.some(Ee=>Ee.id!=="name"),ge=H.includes(",");re?!ge&&re&&V(null):V(null),st.current=M;}},[te]);let Hr=60,hr=.6,yr=react.useMemo(()=>{let M=xt+Hr,H=typeof window<"u"?window.innerWidth*hr:800,re=Math.max(M,H);return Be!==null?Math.max(200,Math.min(Be,re)):Math.max(200,M)},[Be,xt]),Ia=react.useRef(null),be=react.useRef(null),kt=react.useRef(null),tt=react.useMemo(()=>Tc(ae),[ae]),co=react.useMemo(()=>({theme:tt,themeName:ae}),[tt,ae]),Io=react.useMemo(()=>tm(l),[l]),vr=react.useMemo(()=>{if(!p)return ee;let E=ve.calculateCriticalPath(ee),M=H=>H.map(re=>({...re,isCriticalPath:E.includes(re.id),subtasks:re.subtasks?M(re.subtasks):void 0}));return M(ee)},[ee,p]),Qa=react.useMemo(()=>{if(bt==="all"&&!ce)return vr;let E=M=>{let H=[];for(let re of M){let ge=re.subtasks?.length?E(re.subtasks):void 0,Ee=false;if(ce)Ee=re.progress<100;else switch(bt){case "all":Ee=true;break;case "incomplete":Ee=re.progress<100;break;case "in_progress":Ee=re.progress>0&&re.progress<100;break;case "completed":Ee=re.progress===100;break}(Ee||ge&&ge.length>0)&&H.push({...re,subtasks:ge});}return H};return E(vr)},[vr,bt,ce]),er=b0(Ye);em({undo:Na,redo:ue,canUndo:Ve,canRedo:Oe,enabled:true}),react.useImperativeHandle(o,()=>({getTask:E=>ve.findTaskById(ee,E),addTask:(E,M)=>{_e(H=>{if(!M)return [...H,{...E,level:0}];let re=ge=>ge.map(Ee=>Ee.id===M?{...Ee,subtasks:[...Ee.subtasks||[],{...E,parentId:M,level:(Ee.level||0)+1}],isExpanded:true}:Ee.subtasks?{...Ee,subtasks:re(Ee.subtasks)}:Ee);return re(H)});},updateTask:(E,M)=>{_e(H=>{let re=ge=>ge.map(Ee=>Ee.id===E?{...Ee,...M}:Ee.subtasks?{...Ee,subtasks:re(Ee.subtasks)}:Ee);return re(H)});},deleteTask:E=>{_e(M=>{let H=re=>re.filter(ge=>ge.id===E?false:(ge.subtasks&&(ge.subtasks=H(ge.subtasks)),true));return H(M)});},deleteTasks:E=>{_e(M=>Oi(M,E));},duplicateTask:E=>{_e(M=>zi(M,[E]));},splitTask:(E,M,H=3)=>{_e(re=>ve.splitTask(re,E,M,H));},calculateEndDate:ve.calculateEndDate,calculateDuration:ve.calculateDuration,validateDependency:(E,M)=>!ve.validateDependencies(ee,E,M),getAllTasks:()=>ve.flattenTasks(ee),getTasksByStatus:E=>ve.flattenTasks(ee).filter(M=>M.status===E),getTasksByParent:E=>E?ve.findTaskById(ee,E)?.subtasks||[]:ee.filter(H=>!H.parentId),getCriticalPath:()=>ve.flattenTasks(ee).filter(E=>E.isCriticalPath),indentTask:E=>{_e(M=>Li(M,[E]));},outdentTask:E=>{_e(M=>Bi(M,[E]));},moveTask:(E,M)=>{_e(H=>Ri(H,[E],M));},createSubtask:async E=>{let{tasks:M,newTask:H}=Hi(ee,E);if(Te){let re=Te({...H,parentId:E});if((re instanceof Promise?await re:re)===false)return}_e(M),xe&&xe({...H,parentId:E});},scrollToTask:E=>{let H=ve.flattenTasks(ee).findIndex(re=>re.id===E);if(H!==-1&&Ia.current){let re=H*er;Ia.current.scrollTo({top:re,behavior:"smooth"}),be.current&&be.current.scrollTo({top:re,behavior:"smooth"});}},highlightTask:(E,M=2e3)=>{},expandTask:E=>{_e(M=>{let H=re=>re.map(ge=>ge.id===E?{...ge,isExpanded:true}:ge.subtasks?{...ge,subtasks:H(ge.subtasks)}:ge);return H(M)});},collapseTask:E=>{_e(M=>{let H=re=>re.map(ge=>ge.id===E?{...ge,isExpanded:false}:ge.subtasks?{...ge,subtasks:H(ge.subtasks)}:ge);return H(M)});},expandAll:()=>{_e(E=>{let M=H=>H.map(re=>({...re,isExpanded:true,subtasks:re.subtasks?M(re.subtasks):void 0}));return M(E)});},collapseAll:()=>{_e(E=>{let M=H=>H.map(re=>({...re,isExpanded:false,subtasks:re.subtasks?M(re.subtasks):void 0}));return M(E)});},undo:Na,redo:ue,canUndo:()=>Ve,canRedo:()=>Oe,clearHistory:P,exportToPNG:async()=>{if(!kt.current||!Ia.current||!be.current)throw new Error("Gantt container not found");let E=kt.current,M=Ia.current.querySelector(".gantt-grid-scroll"),H=be.current,re=M?.scrollTop||0,ge=H.scrollTop,Ee=E.style.overflow,Nt=E.style.height;try{let ot=M?.querySelector(".gantt-taskgrid-content"),Ot=H.querySelector("svg"),ma=ot?.scrollHeight||M?.scrollHeight||600,ua=Ot?.getBoundingClientRect().height||H.scrollHeight,Gr=(E.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(ma,ua)+20;M&&(M.scrollTop=0),H.scrollTop=0,E.style.overflow="visible",E.style.height=`${Gr}px`,await new Promise(kr=>setTimeout(kr,100));let tr=await rm__default.default(E,{backgroundColor:tt.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:kr=>{let po=window.getComputedStyle(kr),_r=parseInt(po.zIndex,10);return !isNaN(_r)&&_r>=50||po.position==="fixed"}});return new Promise((kr,po)=>{tr.toBlob(_r=>{_r?kr(_r):po(new Error("Failed to create blob from canvas"));},"image/png");})}finally{E.style.overflow=Ee,E.style.height=Nt,M&&(M.scrollTop=re),H.scrollTop=ge;}},exportToPDF:async E=>{await ve.exportToPDF(ee,E);},exportToExcel:async E=>{await ve.exportToExcel(ee,E);},exportToJSON:()=>ve.exportToJSON(ee),exportToCSV:()=>ve.exportToCSV(ee),importFromJSON:E=>{let M=ve.importFromJSON(E);_e(M);},getTasks:()=>ee,refresh:()=>{_e(E=>[...E]);},clearAll:()=>{_e([]);}}),[ee,Na,ue,Ve,Oe,P,tt,er]);let _t=react.useCallback(E=>{Ue(M=>M.map(H=>H.id===E?{...H,visible:!H.visible}:H));},[]),xs=react.useCallback((E,M)=>{Ue(H=>H.map(re=>{if(re.id!==E)return re;let ge=re.minWidth??100,Ee=re.maxWidth??800,Nt=Math.max(ge,Math.min(Ee,M));return {...re,width:Nt}}));},[]),ks=react.useCallback(E=>{_e(M=>{let H=$i(M,E),re=ge=>{for(let Ee of ge){if(Ee.id===E){he.current.set(E,Ee.isExpanded??true);return}Ee.subtasks?.length&&re(Ee.subtasks);}};return re(H),j(),H}),a.onTaskToggleExpand?.(E);},[a,j]),Wr=react.useCallback((E,M)=>{if(F&&F(E,M)===false)return;let re=ve.findTaskById(ee,E)?.progress,ge=Nt=>Nt.map(ot=>ot.id===E?{...ot,...M}:ot.subtasks?{...ot,subtasks:ge(ot.subtasks)}:ot);_e(ge(ee));let Ee=ve.findTaskById(ge(ee),E);Ee&&(N?.(Ee),R?.(Ee),M.progress!==void 0&&re!==void 0&&M.progress!==re&&_?.(E,re,M.progress));},[ee,N,F,R,_]),Lo=react.useCallback(E=>{E.length!==0&&(_e(M=>Li(M,E)),a.onTaskIndent?.(E[0]));},[a]),pu=react.useCallback(E=>{E.length!==0&&(_e(M=>Bi(M,E)),a.onTaskOutdent?.(E[0]));},[a]),uu=react.useCallback((E,M,H)=>{_e(re=>$c(re,E,M,H)),a.onTaskReparent?.(E,M,H);},[a]),gu=react.useCallback((E,M)=>{E.length!==0&&(_e(H=>Ri(H,E,M)),a.onTaskMove?.(E[0],M));},[a]),ws=react.useCallback(async E=>{let M=[];for(let H of E)S&&await Promise.resolve(S(H))===false||M.push(H);M.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(M):(_e(H=>Oi(H,M)),M.forEach(H=>a.onTaskDelete?.(H))),B&&M.forEach(H=>B(H)));},[a,S,B]),fu=react.useCallback(E=>{_e(M=>zi(M,E)),E.forEach(M=>a.onTaskDuplicate?.(M));},[a]),bu=react.useCallback((E,M)=>{_e(H=>{let{tasks:re,newTask:ge}=Uc(H,E,M);return Te&&Te(ge)===false?H:(a.onTaskCreate?.(ge.parentId,ge.position||0),xe?.(ge),re)});},[a,Te,xe]),hu=react.useCallback((E,M)=>{_e(H=>Ui(H,E,M)),a.onTaskRename?.(E,M);},[a]),Cs=react.useCallback(E=>{_e(M=>{let{tasks:H}=Hi(M,E);return a.onTaskCreate?.(E,0),H});},[a]),yu=react.useCallback((E,M,H)=>{let re=E.startDate?Math.round((M.getTime()-E.startDate.getTime())/864e5):0,ge=ot=>ot.map(Ot=>Ot.id===E.id?{...Ot,startDate:M,endDate:H,...E.segments&&{segments:E.segments}}:Ot.subtasks?{...Ot,subtasks:ge(Ot.subtasks)}:Ot),Ee=ge(ee);Ee=ve.autoScheduleDependents(Ee,E.id,re),_e(Ee);let Nt={...E,startDate:M,endDate:H};N?.(Nt);},[ee,N]),vu=react.useCallback((E,M)=>{L?.(E,M),He({isOpen:true,x:M.clientX,y:M.clientY,task:E});},[L]),xu=react.useCallback((E,M)=>{let H=ve.splitTask(ee,E.id,M);_e(H),He({isOpen:false,x:0,y:0,task:null});},[ee]),_l=react.useCallback(E=>{let M=ve.findTaskById(ee,E.id)||E;I?.(M),O||je(M);},[ee,I,O]),Vl=react.useCallback((E,M,H)=>{let re=new Map,ge=ma=>{ma.forEach(ua=>{ua.dependencies&&re.set(ua.id,ua.dependencies),ua.subtasks&&ge(ua.subtasks);});};ge(H);let Ee=re.get(M)||[];re.set(M,[...Ee,E]);let Nt=new Set,ot=new Set,Ot=ma=>{if(!Nt.has(ma)){Nt.add(ma),ot.add(ma);let ua=re.get(ma)||[];for(let xr of ua){if(!Nt.has(xr)&&Ot(xr))return true;if(ot.has(xr))return true}}return ot.delete(ma),false};return Ot(M)},[]),jl=react.useCallback((E,M)=>{if(Vl(E.id,M,ee)){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 W=oe=>oe.map(fe=>{if(fe.id===M){let Ee=fe.dependencies||[];if(!Ee.includes(E.id))return {...fe,dependencies:[...Ee,E.id]}}return fe.subtasks?{...fe,subtasks:W(fe.subtasks)}:fe});_e(W(ee)),re?.(E.id,M);},[ee,re,Vl]),Kl=react.useCallback((E,M)=>{let W=oe=>oe.map(fe=>{if(fe.id===E&&fe.dependencies){let Ee=fe.dependencies.filter(Nt=>Nt!==M);return {...fe,dependencies:Ee}}return fe.subtasks?{...fe,subtasks:W(fe.subtasks)}:fe});_e(W(ee)),ue?.(E,M);},[ee,ue]),{startDate:mn,endDate:ku}=react.useMemo(()=>{let E=ee.filter(Ee=>Ee.startDate&&Ee.endDate);if(E.length===0){let Ee=new Date,Nt=new Date(Ee);Nt.setDate(Nt.getDate()-30);let ot=new Date(Ee);return ot.setDate(ot.getDate()+60),{startDate:Nt,endDate:ot}}let M=E.flatMap(Ee=>[Ee.startDate,Ee.endDate]).filter(Ee=>Ee!==void 0),W=new Date(Math.min(...M.map(Ee=>Ee.getTime()))),oe=new Date(Math.max(...M.map(Ee=>Ee.getTime()))),fe=Fe==="day"?7:Fe==="week"?14:30;return W.setDate(W.getDate()-fe),oe.setDate(oe.getDate()+fe),{startDate:W,endDate:oe}},[ee,Fe]),wu=react.useCallback(async()=>{if(!kt.current||!Ia.current||!he.current)return;await new Promise(Gr=>setTimeout(Gr,200));let E=kt.current,M=Ia.current.querySelector(".gantt-grid-scroll"),W=he.current,oe=M?.scrollTop||0,fe=M?.scrollLeft||0,Ee=W.scrollTop,Nt=W.scrollLeft,ot=E.style.overflow,Ot=E.style.height,ma=M?.style.overflow||"",ua=W.style.overflow,xr=E.style.width,pn=W.style.width;try{let Gr=M?.querySelector(".gantt-taskgrid-content"),tr=W.querySelector("svg"),kr=tr?.getAttribute("height")?parseInt(tr.getAttribute("height"),10):tr?.getBoundingClientRect().height||0,po=Gr?.scrollHeight||M?.scrollHeight||600,_r=Math.max(kr,W.scrollHeight),Xl=tr?.getAttribute("width")?parseInt(tr.getAttribute("width"),10):tr?.getBoundingClientRect().width||W.scrollWidth,Mu=E.querySelector('[class*="h-12"]')?.offsetHeight||48,Ns=Math.max(po,_r,kr),Ds=Mu+Ns+50,Ss=(M?.offsetWidth||300)+Xl+10;M&&(M.scrollTop=0,M.scrollLeft=0),W.scrollTop=0,W.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Ds}px`,E.style.width=`${Ss}px`,M&&(M.style.overflow="visible",M.style.height=`${Ns+50}px`),W.style.overflow="visible",W.style.height=`${Ns+50}px`,W.style.width=`${Xl+10}px`,await new Promise(Ps=>setTimeout(Ps,150));let Fu=await rm__default.default(E,{backgroundColor:tt.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:Ss,height:Ds,windowWidth:Ss+100,windowHeight:Ds+100,scrollX:0,scrollY:0,ignoreElements:Ps=>{let Jl=window.getComputedStyle(Ps),Zl=parseInt(Jl.zIndex,10);return !isNaN(Zl)&&Zl>=50||Jl.position==="fixed"}}),Es=document.createElement("a");Es.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Es.href=Fu.toDataURL("image/png"),Es.click();}finally{E.style.overflow=ot,E.style.height=Ot,E.style.width=xr,M&&(M.style.overflow=ma,M.style.height="",M.scrollTop=oe,M.scrollLeft=fe),W.style.overflow=ua,W.style.height="",W.style.width=pn,W.scrollTop=Ee,W.scrollLeft=Nt;}},[tt]),Cu=react.useCallback(async()=>{await xe.exportToPDF(ee);},[ee]),Tu=react.useCallback(async()=>{await xe.exportToExcel(ee);},[ee]),Nu=react.useCallback(()=>{let E=xe.exportToCSV(ee),M=new Blob([E],{type:"text/csv;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(M),W.download="gantt-chart.csv",W.click(),URL.revokeObjectURL(W.href);},[ee]),Du=react.useCallback(()=>{let E=xe.exportToJSON(ee),M=new Blob([E],{type:"application/json;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(M),W.download="gantt-chart.json",W.click(),URL.revokeObjectURL(W.href);},[ee]),Su=react.useCallback(()=>{xe.exportToMSProject(ee,"Gantt Project","project.xml");},[ee]),Eu=E=>{E.preventDefault(),X(true);},mo=react.useRef(false),[Ts,Yl]=react.useState(false),Bo=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=he.current,M=Ia.current?.querySelector(".gantt-grid-scroll");if(!E||!M)return;let W=()=>{if(mo.current)return;mo.current=true;let ot=E.scrollTop;pe(ot),M.scrollTop=ot,requestAnimationFrame(()=>{mo.current=false;});},oe=()=>{if(mo.current)return;mo.current=true;let ot=M.scrollTop;pe(ot),E.scrollTop=ot,requestAnimationFrame(()=>{mo.current=false;});},fe=ot=>{if(ze&&M){let ma=M.parentElement?.getBoundingClientRect()?.left||0,ua=ot.clientX-ma,xr=200,pn=xt+Hr,Gr=window.innerWidth*hr,tr=Math.max(pn,Gr);ua>=xr&&ua<=tr&&G(ua);}if(Ts&&E){let Ot=ot.clientX-Bo.current.x,ma=ot.clientY-Bo.current.y;E.scrollLeft=Bo.current.scrollLeft-Ot,E.scrollTop=Bo.current.scrollTop-ma;}},Ee=()=>{X(false),Yl(false);},Nt=ot=>{if(ot.button!==0)return;let Ot=ot.target;Ot.closest("[data-task-bar]")||Ot.closest("[data-dependency-line]")||Ot.closest("button")||Ot.closest('[role="button"]')||Ot.tagName==="rect"&&Ot.getAttribute("data-clickable")==="true"||(Yl(true),Bo.current={x:ot.clientX,y:ot.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},ot.preventDefault());};return E.addEventListener("scroll",W),M.addEventListener("scroll",oe),E.addEventListener("mousedown",Nt),document.addEventListener("mousemove",fe),document.addEventListener("mouseup",Ee),()=>{E.removeEventListener("scroll",W),M.removeEventListener("scroll",oe),E.removeEventListener("mousedown",Nt),document.removeEventListener("mousemove",fe),document.removeEventListener("mouseup",Ee);}},[ze,Ts,xt]);let ql=react.useRef(false),Pu=react.useRef(null);return react.useLayoutEffect(()=>{if(ql.current||ee.length===0||!he.current)return;ql.current=true,Pu.current=mn;let E=he.current,M=new Date,W=Fe==="day"?60:Fe==="week"?20:8,oe=(M.getTime()-mn.getTime())/(1e3*60*60*24),fe=E.clientWidth,Nt=oe*W*Ke-fe/2;oe>=0&&fe>0&&(E.scrollLeft=Math.max(0,Nt));},[ee.length,mn,Fe,Ke]),jsxRuntime.jsx(To.Provider,{value:Ae,children:jsxRuntime.jsx(Ls.Provider,{value:co,children:jsxRuntime.jsxs("div",{ref:kt,className:"flex flex-col h-full w-full",style:{backgroundColor:tt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Rn,{theme:tt,timeScale:Fe,onTimeScaleChange:Q,zoom:Ke,onZoomChange:Tt,currentTheme:ne,onThemeChange:Ie,rowDensity:Ye,onRowDensityChange:Te,showThemeSelector:m,showCreateTaskButton:h,createTaskLabel:p,onCreateTask:k,taskFilter:bt,onTaskFilterChange:Gt,hideCompleted:me,onHideCompletedChange:I,onExportPNG:i?wu:void 0,onExportPDF:i?Cu:void 0,onExportExcel:i?Tu:void 0,onExportCSV:i?Nu:void 0,onExportJSON:i?Du:void 0,onExportMSProject:i?Su:void 0}),jsxRuntime.jsxs("div",{ref:Ia,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:yr,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx($n,{tasks:Qa,theme:tt,rowHeight:er,availableUsers:c,templates:Io,onTaskClick:w,onTaskDblClick:_l,onTaskContextMenu:L,onTaskToggle:ks,scrollTop:se,columns:ae,onToggleColumn:_t,onColumnResize:xs,onTaskUpdate:Wr,onTaskIndent:Lo,onTaskOutdent:pu,onTaskMove:gu,onMultiTaskDelete:ws,onTaskDuplicate:fu,onTaskCreate:bu,onTaskRename:hu,onCreateSubtask:Cs,onOpenTaskModal:w?E=>w(E):void 0,onDeleteRequest:(E,M)=>le({taskId:E,taskName:M}),onTaskReparent:uu})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:tt.border,zIndex:15},onMouseDown:Eu}),jsxRuntime.jsx("div",{ref:he,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Ts?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(qn,{tasks:Qa,theme:tt,rowHeight:er,timeScale:Fe,startDate:mn,endDate:ku,zoom:Ke,locale:g,templates:Io,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:w,onTaskDblClick:_l,onTaskContextMenu:vu,onTaskDateChange:yu,onDependencyCreate:jl,onDependencyDelete:Kl})})]}),Y.task&&jsxRuntime.jsx(No,{isOpen:Y.isOpen,x:Y.x,y:Y.y,theme:tt,onClose:()=>He({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=Y.task;if(!E)return [];let M=xe.findTaskById(ee,E.id)||E;return M.subtasks&&M.subtasks.length>0?[{id:"addSubtask",label:Ae.contextMenu?.addSubtask||"Add Subtask",icon:It.Add,onClick:()=>{j?j(M):Cs(M.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Ae.contextMenu?.deleteTask||"Delete Task",icon:It.Delete,onClick:()=>{le({taskId:M.id,taskName:M.name});}}]:[{id:"edit",label:Ae.contextMenu?.editTask||"Edit Task",icon:It.Pencil,onClick:()=>{$?$(M):je(M);}},{id:"addSubtask",label:Ae.contextMenu?.addSubtask||"Add Subtask",icon:It.Add,onClick:()=>{j?j(M):Cs(M.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:Ae.contextMenu?.markIncomplete||"Mark Incomplete",icon:It.MarkIncomplete,onClick:()=>{ce?ce(M):Wr(M.id,{status:"todo",progress:0});},disabled:M.status==="todo"},{id:"setInProgress",label:Ae.contextMenu?.setInProgress||"Set In Progress",icon:It.SetInProgress,onClick:()=>{J?J(M):Wr(M.id,{status:"in-progress"});},disabled:M.status==="in-progress"},{id:"markComplete",label:Ae.contextMenu?.markComplete||"Mark Complete",icon:It.MarkComplete,onClick:()=>{Wr(M.id,{status:"completed",progress:100});},disabled:M.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:Ae.contextMenu?.splitTask||"Split Task",icon:It.Split,onClick:()=>{if(!M.startDate||!M.endDate){console.warn("Cannot split task without dates");return}let oe=M.startDate.getTime(),fe=M.endDate.getTime(),Ee=oe+(fe-oe)/2,Nt=new Date(Ee);xu(M,Nt);},disabled:!M.startDate||!M.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Ae.contextMenu?.deleteTask||"Delete Task",icon:It.Delete,onClick:()=>{le({taskId:M.id,taskName:M.name});}}]})()}),jsxRuntime.jsx(mr,{task:Re,isOpen:!!Re,onClose:()=>je(null),onTaskUpdate:E=>{Re&&(Wr(Re.id,E),je(null));},theme:ne==="light"?"light":"dark",locale:g==="es"?"es":"en",availableUsers:c,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:We&&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:()=>le(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:tt.bgSecondary,border:`1px solid ${tt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${tt.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:tt.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ae.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:tt.textSecondary,fontFamily:"Inter, sans-serif"},children:g==="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:tt.textSecondary,fontFamily:"Inter, sans-serif"},children:[g==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:tt.textPrimary},children:['"',We.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:tt.bgPrimary,borderTop:`1px solid ${tt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>le(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:tt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=tt.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:g==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{ws([We.taskId]),le(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),g==="es"?"Eliminar":"Delete"]})]})]})})}),C?.enabled&&jsxRuntime.jsx(Xn,{tasks:ee,theme:tt,config:C,onTasksUpdate:_e,onTaskUpdate:Wr,onTaskCreate:E=>{_e(M=>[...M,E]);},onTaskDelete:E=>{ws([E]);},onDependencyCreate:(E,M)=>{let W=xe.findTaskById(ee,E);W&&jl(W,M);},onDependencyDelete:Kl})]})})})});var ji=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Ki=[{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 lm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:d=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:l,attachments:u=[],onUploadAttachments:b,onDeleteAttachment:y}){let C=[...ji,...i.filter(I=>!ji.some(se=>se.id===I.id))],g=qe[m]||qe.dark,[v,h]=react.useState(false),[p,k]=react.useState(false),[x,D]=react.useState(false),[T,w]=react.useState(false),[A,L]=react.useState({top:0,left:0}),[N,H]=react.useState(null),[$,j]=react.useState(new Date),[ce,J]=react.useState({top:0,left:0}),[re,ue]=react.useState(false),[Ce,Se]=react.useState([]),[F,R]=react.useState(false),[S,B]=react.useState(""),_=react.useRef(null),te=react.useRef(null),ne=react.useRef(null),de=react.useRef(null),Fe=react.useRef(null),[Q,Ye]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Te,Ke]=react.useState({});react.useEffect(()=>{a?(Ye({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&ue(true)):(Ye({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),ue(false),Se([]));},[a,e]),react.useEffect(()=>{let I=se=>{_.current&&!_.current.contains(se.target)&&h(false),te.current&&!te.current.contains(se.target)&&k(false),ne.current&&!ne.current.contains(se.target)&&D(false),de.current&&!de.current.contains(se.target)&&w(false);};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[]);let Tt=()=>{let I={};return Q.name.trim()||(I.name="El nombre es requerido"),Q.startDate&&Q.endDate&&Q.startDate>Q.endDate&&(I.endDate="La fecha de fin debe ser posterior a la de inicio"),Ke(I),Object.keys(I).length===0},Et=async I=>{if(I.preventDefault(),!!Tt())try{let se=d==="create"&&Ce.length>0?{...Q,pendingFiles:Ce}:Q;await s(se),Se([]),t();}catch(se){console.error("Error submitting task:",se);}},Ze=(I,se)=>{Ye(pe=>{let ze={...pe,[I]:se};if(I==="status"){let X=se;X==="todo"?ze.progress=0:X==="in-progress"?(pe.progress===0||pe.progress===100)&&(ze.progress=50):X==="completed"||X==="closed"?ze.progress=100:(X==="in-review"||X==="review")&&(ze.progress=75);}if(I==="progress"){let X=typeof se=="number"?se:parseInt(se,10);X===100&&pe.status!=="completed"?ze.status="completed":X>0&&X<100&&pe.status==="todo"?ze.status="in-progress":X===0&&pe.status!=="todo"&&(ze.status="todo");}return ze}),Te[I]&&Ke(pe=>{let ze={...pe};return delete ze[I],ze});},vt=C.find(I=>I.id===Q.status)??ji[0],bt=Ki.find(I=>I.id===Q.priority)??Ki[1],Gt=Xr.find(I=>I.value===Q.color)??Xr[0],me={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:vt.color||g.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:d==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:I=>{I.currentTarget.style.backgroundColor=g.hoverBg,I.currentTarget.style.color=g.textPrimary;},onMouseLeave:I=>{I.currentTarget.style.backgroundColor="transparent",I.currentTarget.style.color=g.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Et,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:Q.name,onChange:I=>Ze("name",I.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Te.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),Te.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:Q.description||"",onChange:I=>Ze("description",I.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:_,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&h(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...me,borderColor:vt.color,backgroundColor:`${vt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:vt.color}}),jsxRuntime.jsx("span",{style:{color:vt.color},children:vt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:vt.color}})]}),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-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:C.map(I=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:se=>se.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ze("status",I.id),h(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:I.color}}),I.title,Q.status===I.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},I.id))})})]}),jsxRuntime.jsxs("div",{ref:te,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&k(!p),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:me,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:bt.color}}),jsxRuntime.jsx("span",{children:bt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:Ki.map(I=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:se=>se.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ze("priority",I.id),k(false);},children:[jsxRuntime.jsx("span",{children:I.icon}),I.label,Q.priority===I.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},I.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:ne,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:me,disabled:n,children:[Q.assignees&&Q.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:Q.assignees.slice(0,3).map((I,se)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:I.color||g.accent,borderColor:g.bgSecondary},children:I.initials},se))}),Q.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:g.textTertiary},children:["+",Q.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(I=>{let se=Q.assignees?.some(pe=>pe.name===I.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:pe=>pe.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:pe=>pe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let pe=se?(Q.assignees||[]).filter(ze=>ze.name!==I.name):[...Q.assignees||[],{name:I.name,avatar:I.avatar,initials:I.name.split(" ").map(ze=>ze[0]).join("").toUpperCase().slice(0,2),color:g.accent}];Ze("assignees",pe);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:g.accent},children:I.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:I.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:se&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},I.id)})})})]}),jsxRuntime.jsxs("div",{ref:de,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)w(false);else {if(de.current){let I=de.current.getBoundingClientRect(),se=window.innerHeight,pe=120,X=se-I.bottom<pe?I.top-pe-8:I.bottom+8;L({top:X,left:I.left});}w(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:me,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:Q.color}}),jsxRuntime.jsx("span",{children:Gt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(it,{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:`${A.top}px`,left:`${A.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Xr.slice(0,18).map(I=>{let se=Q.color===I.value;return jsxRuntime.jsx("button",{type:"button",onClick:pe=>{pe.preventDefault(),pe.stopPropagation(),Ze("color",I.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:I.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:I.value,outline:se?`2px solid ${I.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},I.value)})})})})]})})]}),c.length>0||l?jsxRuntime.jsx(Nr,{selectedTags:Q.tags||[],availableTags:c,onChange:I=>Ze("tags",I),onCreateTag:l,theme:g,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{ref:Fe,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!Q.isMilestone)if(N==="start")H(null);else {if(Fe.current){let I=Fe.current.getBoundingClientRect(),se=window.innerHeight,pe=320,X=se-I.bottom<pe?I.top-pe-8:I.bottom+8;J({top:X,left:I.left});}H("start"),j(Q.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...me,opacity:Q.isMilestone?.5:1,cursor:Q.isMilestone?"not-allowed":"pointer"},disabled:n||Q.isMilestone,children:Q.startDate?Q.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!Q.isMilestone)if(N==="end")H(null);else {if(Fe.current){let I=Fe.current.getBoundingClientRect(),se=window.innerHeight,pe=320,X=se-I.bottom<pe?I.top-pe-8:I.bottom+8;J({top:X,left:I.left});}H("end"),j(Q.endDate||Q.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...me,opacity:Q.isMilestone?.5:1,cursor:Q.isMilestone?"not-allowed":"pointer"},disabled:n||Q.isMilestone,children:Q.endDate?Q.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(it,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>H(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${ce.top}px`,left:`${ce.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let I=new Date,se=new Date(I);se.setDate(I.getDate()+1);let pe=new Date(I);pe.setDate(I.getDate()+7);let ze=new Date(I);return ze.setDate(I.getDate()+14),[{label:"Hoy",date:I},{label:"Ma\xF1ana",date:se},{label:"Pr\xF3xima semana",date:pe},{label:"2 semanas",date:ze}].map((Be,G)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:Y=>Y.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{N==="start"?(Ze("startDate",Be.date),(!Q.endDate||Be.date>Q.endDate)&&Ze("endDate",Be.date),H("end")):(Ze("endDate",Be.date),(!Q.startDate||Be.date<Q.startDate)&&Ze("startDate",Be.date),H(null));},children:Be.label},G))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:I=>I.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ze("startDate",void 0),Ze("endDate",void 0),H(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>j(new Date($.getFullYear(),$.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:$.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>j(new Date($.getFullYear(),$.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((I,se)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:I},se))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let I=$.getFullYear(),se=$.getMonth(),pe=new Date(I,se,1).getDay(),ze=new Date(I,se+1,0).getDate(),X=new Date,Be=[];for(let Y=pe-1;Y>=0;Y--)Be.push({day:new Date(I,se,-Y).getDate(),date:new Date(I,se-1,new Date(I,se,-Y).getDate()),isCurrentMonth:false});for(let Y=1;Y<=ze;Y++)Be.push({day:Y,date:new Date(I,se,Y),isCurrentMonth:true});let G=42-Be.length;for(let Y=1;Y<=G;Y++)Be.push({day:Y,date:new Date(I,se+1,Y),isCurrentMonth:false});return Be.map((Y,He)=>{let Re=Y.date.toDateString()===X.toDateString(),je=Q.startDate?.toDateString()===Y.date.toDateString(),We=Q.endDate?.toDateString()===Y.date.toDateString(),le=Q.startDate&&Q.endDate&&Y.date>=Q.startDate&&Y.date<=Q.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Y.isCurrentMonth?je||We?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:je?"#3B82F6":We?"#7C3AED":le?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Re&&!je&&!We?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{N==="start"?(Ze("startDate",Y.date),Q.endDate&&Y.date>Q.endDate&&Ze("endDate",Y.date),H("end")):(Ze("endDate",Y.date),Q.startDate&&Y.date<Q.startDate&&Ze("startDate",Y.date),H(null));},children:Y.day},He)})})()})]})]})]})})]}),Te.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Te.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:Q.progress,onChange:I=>Ze("progress",parseInt(I.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:Q.progress<30?"#EF4444":Q.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${Q.progress<30?"#EF4444":Q.progress<70?"#F59E0B":"#10B981"}20`,color:Q.progress<30?"#EF4444":Q.progress<70?"#F59E0B":"#10B981"},children:[Q.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>ue(!re),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${re?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:re&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[(b||u.length>0||d==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:g.textTertiary},children:["Adjuntos ",d==="create"?Ce.length>0&&`(${Ce.length})`:u.length>0&&`(${u.length})`]})]}),d==="create"?jsxRuntime.jsx(nr,{cardId:"pending",attachments:Ce.map((I,se)=>({id:`pending-${se}`,cardId:"pending",name:I.name,size:I.size,type:I.type,url:URL.createObjectURL(I),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:I=>Se(se=>[...se,...I]),onDelete:I=>{let se=parseInt(I.replace("pending-",""),10);Se(pe=>pe.filter((ze,X)=>X!==se));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(nr,{cardId:a?.id||"new",attachments:u,onUpload:b&&a?.id?I=>b(a.id,I):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),d==="create"&&Ce.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[Ce.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:Q.isMilestone,onChange:I=>Ze("isMilestone",I.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:g.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),Q.dependencies&&Q.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:Q.dependencies.map(I=>{let se=r.find(pe=>pe.id===I);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${g.accent}20`,color:g.accent},children:[se?.name||I.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let pe=(Q.dependencies||[]).filter(ze=>ze!==I);Ze("dependencies",pe);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},I)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{R(!F),B("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{R(false),B("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${g.border}`},children:jsxRuntime.jsx("input",{type:"text",value:S,onChange:I=>B(I.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:g.bgSecondary,color:g.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(I=>I.id!==a?.id).filter(I=>S===""||I.name.toLowerCase().includes(S.toLowerCase())).map(I=>{let se=Q.dependencies?.includes(I.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let pe=Q.dependencies||[],ze;se?ze=pe.filter(X=>X!==I.id):ze=[...pe,I.id],Ze("dependencies",ze);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:se?`${g.accent}10`:"transparent"},onMouseEnter:pe=>{se||(pe.currentTarget.style.backgroundColor=g.hoverBg);},onMouseLeave:pe=>{pe.currentTarget.style.backgroundColor=se?`${g.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:se?g.accent:"transparent",borderColor:se?g.accent:g.borderLight},children:se&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:g.textPrimary},children:I.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:g.textTertiary},children:I.id.slice(0,8)})]})]},I.id)}),r.filter(I=>I.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:g.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:I=>I.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:I=>I.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:g.accent,color:"#FFF"},onMouseEnter:I=>!n&&(I.currentTarget.style.opacity="0.9"),onMouseLeave:I=>!n&&(I.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:d==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var dm=`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 H=re=>re.map(ge=>{if(ge.id===M){let Ee=ge.dependencies||[];if(!Ee.includes(E.id))return {...ge,dependencies:[...Ee,E.id]}}return ge.subtasks?{...ge,subtasks:H(ge.subtasks)}:ge});_e(H(ee)),pe?.(E.id,M);},[ee,pe,Vl]),Kl=react.useCallback((E,M)=>{let H=re=>re.map(ge=>{if(ge.id===E&&ge.dependencies){let Ee=ge.dependencies.filter(Nt=>Nt!==M);return {...ge,dependencies:Ee}}return ge.subtasks?{...ge,subtasks:H(ge.subtasks)}:ge});_e(H(ee)),ke?.(E,M);},[ee,ke]),{startDate:mn,endDate:ku}=react.useMemo(()=>{let E=ee.filter(Ee=>Ee.startDate&&Ee.endDate);if(E.length===0){let Ee=new Date,Nt=new Date(Ee);Nt.setDate(Nt.getDate()-30);let ot=new Date(Ee);return ot.setDate(ot.getDate()+60),{startDate:Nt,endDate:ot}}let M=E.flatMap(Ee=>[Ee.startDate,Ee.endDate]).filter(Ee=>Ee!==void 0),H=new Date(Math.min(...M.map(Ee=>Ee.getTime()))),re=new Date(Math.max(...M.map(Ee=>Ee.getTime()))),ge=Fe==="day"?7:Fe==="week"?14:30;return H.setDate(H.getDate()-ge),re.setDate(re.getDate()+ge),{startDate:H,endDate:re}},[ee,Fe]),wu=react.useCallback(async()=>{if(!kt.current||!Ia.current||!be.current)return;await new Promise(Gr=>setTimeout(Gr,200));let E=kt.current,M=Ia.current.querySelector(".gantt-grid-scroll"),H=be.current,re=M?.scrollTop||0,ge=M?.scrollLeft||0,Ee=H.scrollTop,Nt=H.scrollLeft,ot=E.style.overflow,Ot=E.style.height,ma=M?.style.overflow||"",ua=H.style.overflow,xr=E.style.width,pn=H.style.width;try{let Gr=M?.querySelector(".gantt-taskgrid-content"),tr=H.querySelector("svg"),kr=tr?.getAttribute("height")?parseInt(tr.getAttribute("height"),10):tr?.getBoundingClientRect().height||0,po=Gr?.scrollHeight||M?.scrollHeight||600,_r=Math.max(kr,H.scrollHeight),Xl=tr?.getAttribute("width")?parseInt(tr.getAttribute("width"),10):tr?.getBoundingClientRect().width||H.scrollWidth,Mu=E.querySelector('[class*="h-12"]')?.offsetHeight||48,Ns=Math.max(po,_r,kr),Ds=Mu+Ns+50,Ss=(M?.offsetWidth||300)+Xl+10;M&&(M.scrollTop=0,M.scrollLeft=0),H.scrollTop=0,H.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Ds}px`,E.style.width=`${Ss}px`,M&&(M.style.overflow="visible",M.style.height=`${Ns+50}px`),H.style.overflow="visible",H.style.height=`${Ns+50}px`,H.style.width=`${Xl+10}px`,await new Promise(Ps=>setTimeout(Ps,150));let Fu=await rm__default.default(E,{backgroundColor:tt.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:Ss,height:Ds,windowWidth:Ss+100,windowHeight:Ds+100,scrollX:0,scrollY:0,ignoreElements:Ps=>{let Jl=window.getComputedStyle(Ps),Zl=parseInt(Jl.zIndex,10);return !isNaN(Zl)&&Zl>=50||Jl.position==="fixed"}}),Es=document.createElement("a");Es.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Es.href=Fu.toDataURL("image/png"),Es.click();}finally{E.style.overflow=ot,E.style.height=Ot,E.style.width=xr,M&&(M.style.overflow=ma,M.style.height="",M.scrollTop=re,M.scrollLeft=ge),H.style.overflow=ua,H.style.height="",H.style.width=pn,H.scrollTop=Ee,H.scrollLeft=Nt;}},[tt]),Cu=react.useCallback(async()=>{await ve.exportToPDF(ee);},[ee]),Tu=react.useCallback(async()=>{await ve.exportToExcel(ee);},[ee]),Nu=react.useCallback(()=>{let E=ve.exportToCSV(ee),M=new Blob([E],{type:"text/csv;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(M),H.download="gantt-chart.csv",H.click(),URL.revokeObjectURL(H.href);},[ee]),Du=react.useCallback(()=>{let E=ve.exportToJSON(ee),M=new Blob([E],{type:"application/json;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(M),H.download="gantt-chart.json",H.click(),URL.revokeObjectURL(H.href);},[ee]),Su=react.useCallback(()=>{ve.exportToMSProject(ee,"Gantt Project","project.xml");},[ee]),Eu=E=>{E.preventDefault(),X(true);},mo=react.useRef(false),[Ts,Yl]=react.useState(false),Bo=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=be.current,M=Ia.current?.querySelector(".gantt-grid-scroll");if(!E||!M)return;let H=()=>{if(mo.current)return;mo.current=true;let ot=E.scrollTop;me(ot),M.scrollTop=ot,requestAnimationFrame(()=>{mo.current=false;});},re=()=>{if(mo.current)return;mo.current=true;let ot=M.scrollTop;me(ot),E.scrollTop=ot,requestAnimationFrame(()=>{mo.current=false;});},ge=ot=>{if(ze&&M){let ma=M.parentElement?.getBoundingClientRect()?.left||0,ua=ot.clientX-ma,xr=200,pn=xt+Hr,Gr=window.innerWidth*hr,tr=Math.max(pn,Gr);ua>=xr&&ua<=tr&&V(ua);}if(Ts&&E){let Ot=ot.clientX-Bo.current.x,ma=ot.clientY-Bo.current.y;E.scrollLeft=Bo.current.scrollLeft-Ot,E.scrollTop=Bo.current.scrollTop-ma;}},Ee=()=>{X(false),Yl(false);},Nt=ot=>{if(ot.button!==0)return;let Ot=ot.target;Ot.closest("[data-task-bar]")||Ot.closest("[data-dependency-line]")||Ot.closest("button")||Ot.closest('[role="button"]')||Ot.tagName==="rect"&&Ot.getAttribute("data-clickable")==="true"||(Yl(true),Bo.current={x:ot.clientX,y:ot.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},ot.preventDefault());};return E.addEventListener("scroll",H),M.addEventListener("scroll",re),E.addEventListener("mousedown",Nt),document.addEventListener("mousemove",ge),document.addEventListener("mouseup",Ee),()=>{E.removeEventListener("scroll",H),M.removeEventListener("scroll",re),E.removeEventListener("mousedown",Nt),document.removeEventListener("mousemove",ge),document.removeEventListener("mouseup",Ee);}},[ze,Ts,xt]);let ql=react.useRef(false),Pu=react.useRef(null);return react.useLayoutEffect(()=>{if(ql.current||ee.length===0||!be.current)return;ql.current=true,Pu.current=mn;let E=be.current,M=new Date,H=Fe==="day"?60:Fe==="week"?20:8,re=(M.getTime()-mn.getTime())/(1e3*60*60*24),ge=E.clientWidth,Nt=re*H*Ke-ge/2;re>=0&&ge>0&&(E.scrollLeft=Math.max(0,Nt));},[ee.length,mn,Fe,Ke]),jsxRuntime.jsx(To.Provider,{value:Ae,children:jsxRuntime.jsx(Ls.Provider,{value:co,children:jsxRuntime.jsxs("div",{ref:kt,className:"flex flex-col h-full w-full",style:{backgroundColor:tt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Rn,{theme:tt,timeScale:Fe,onTimeScaleChange:Q,zoom:Ke,onZoomChange:Tt,currentTheme:ae,onThemeChange:Ie,rowDensity:Ye,onRowDensityChange:Ne,showThemeSelector:m,showCreateTaskButton:h,createTaskLabel:u,onCreateTask:k,taskFilter:bt,onTaskFilterChange:Gt,hideCompleted:ce,onHideCompletedChange:A,onExportPNG:i?wu:void 0,onExportPDF:i?Cu:void 0,onExportExcel:i?Tu:void 0,onExportCSV:i?Nu:void 0,onExportJSON:i?Du:void 0,onExportMSProject:i?Su:void 0}),jsxRuntime.jsxs("div",{ref:Ia,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:yr,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx($n,{tasks:Qa,theme:tt,rowHeight:er,availableUsers:c,templates:Io,onTaskClick:C,onTaskDblClick:_l,onTaskContextMenu:L,onTaskToggle:ks,scrollTop:oe,columns:te,onToggleColumn:_t,onColumnResize:xs,onTaskUpdate:Wr,onTaskIndent:Lo,onTaskOutdent:pu,onTaskMove:gu,onMultiTaskDelete:ws,onTaskDuplicate:fu,onTaskCreate:bu,onTaskRename:hu,onCreateSubtask:Cs,onOpenTaskModal:C?E=>C(E):void 0,onDeleteRequest:(E,M)=>se({taskId:E,taskName:M}),onTaskReparent:uu})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:tt.border,zIndex:15},onMouseDown:Eu}),jsxRuntime.jsx("div",{ref:be,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Ts?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(qn,{tasks:Qa,theme:tt,rowHeight:er,timeScale:Fe,startDate:mn,endDate:ku,zoom:Ke,locale:g,templates:Io,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:C,onTaskDblClick:_l,onTaskContextMenu:vu,onTaskDateChange:yu,onDependencyCreate:jl,onDependencyDelete:Kl})})]}),Y.task&&jsxRuntime.jsx(No,{isOpen:Y.isOpen,x:Y.x,y:Y.y,theme:tt,onClose:()=>He({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=Y.task;if(!E)return [];let M=ve.findTaskById(ee,E.id)||E;return M.subtasks&&M.subtasks.length>0?[{id:"addSubtask",label:Ae.contextMenu?.addSubtask||"Add Subtask",icon:It.Add,onClick:()=>{W?W(M):Cs(M.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Ae.contextMenu?.deleteTask||"Delete Task",icon:It.Delete,onClick:()=>{se({taskId:M.id,taskName:M.name});}}]:[{id:"edit",label:Ae.contextMenu?.editTask||"Edit Task",icon:It.Pencil,onClick:()=>{O?O(M):je(M);}},{id:"addSubtask",label:Ae.contextMenu?.addSubtask||"Add Subtask",icon:It.Add,onClick:()=>{W?W(M):Cs(M.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:Ae.contextMenu?.markIncomplete||"Mark Incomplete",icon:It.MarkIncomplete,onClick:()=>{le?le(M):Wr(M.id,{status:"todo",progress:0});},disabled:M.status==="todo"},{id:"setInProgress",label:Ae.contextMenu?.setInProgress||"Set In Progress",icon:It.SetInProgress,onClick:()=>{de?de(M):Wr(M.id,{status:"in-progress"});},disabled:M.status==="in-progress"},{id:"markComplete",label:Ae.contextMenu?.markComplete||"Mark Complete",icon:It.MarkComplete,onClick:()=>{Wr(M.id,{status:"completed",progress:100});},disabled:M.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:Ae.contextMenu?.splitTask||"Split Task",icon:It.Split,onClick:()=>{if(!M.startDate||!M.endDate){console.warn("Cannot split task without dates");return}let re=M.startDate.getTime(),ge=M.endDate.getTime(),Ee=re+(ge-re)/2,Nt=new Date(Ee);xu(M,Nt);},disabled:!M.startDate||!M.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Ae.contextMenu?.deleteTask||"Delete Task",icon:It.Delete,onClick:()=>{se({taskId:M.id,taskName:M.name});}}]})()}),jsxRuntime.jsx(mr,{task:Re,isOpen:!!Re,onClose:()=>je(null),onTaskUpdate:E=>{Re&&(Wr(Re.id,E),je(null));},theme:ae==="light"?"light":"dark",locale:g==="es"?"es":"en",availableUsers:c,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:We&&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:()=>se(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:tt.bgSecondary,border:`1px solid ${tt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${tt.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:tt.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ae.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:tt.textSecondary,fontFamily:"Inter, sans-serif"},children:g==="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:tt.textSecondary,fontFamily:"Inter, sans-serif"},children:[g==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:tt.textPrimary},children:['"',We.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:tt.bgPrimary,borderTop:`1px solid ${tt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>se(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:tt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=tt.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:g==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{ws([We.taskId]),se(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),g==="es"?"Eliminar":"Delete"]})]})]})})}),w?.enabled&&jsxRuntime.jsx(Xn,{tasks:ee,theme:tt,config:w,onTasksUpdate:_e,onTaskUpdate:Wr,onTaskCreate:E=>{_e(M=>[...M,E]);},onTaskDelete:E=>{ws([E]);},onDependencyCreate:(E,M)=>{let H=ve.findTaskById(ee,E);H&&jl(H,M);},onDependencyDelete:Kl})]})})})});var ji=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Ki=[{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 lm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:d=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:l,attachments:p=[],onUploadAttachments:b,onDeleteAttachment:y}){let w=[...ji,...i.filter(A=>!ji.some(oe=>oe.id===A.id))],g=qe[m]||qe.dark,[v,h]=react.useState(false),[u,k]=react.useState(false),[x,D]=react.useState(false),[T,C]=react.useState(false),[I,L]=react.useState({top:0,left:0}),[N,_]=react.useState(null),[O,W]=react.useState(new Date),[le,de]=react.useState({top:0,left:0}),[pe,ke]=react.useState(false),[Te,xe]=react.useState([]),[F,R]=react.useState(false),[S,B]=react.useState(""),G=react.useRef(null),Z=react.useRef(null),ae=react.useRef(null),ie=react.useRef(null),Fe=react.useRef(null),[Q,Ye]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Ne,Ke]=react.useState({});react.useEffect(()=>{a?(Ye({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&ke(true)):(Ye({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),ke(false),xe([]));},[a,e]),react.useEffect(()=>{let A=oe=>{G.current&&!G.current.contains(oe.target)&&h(false),Z.current&&!Z.current.contains(oe.target)&&k(false),ae.current&&!ae.current.contains(oe.target)&&D(false),ie.current&&!ie.current.contains(oe.target)&&C(false);};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);let Tt=()=>{let A={};return Q.name.trim()||(A.name="El nombre es requerido"),Q.startDate&&Q.endDate&&Q.startDate>Q.endDate&&(A.endDate="La fecha de fin debe ser posterior a la de inicio"),Ke(A),Object.keys(A).length===0},Et=async A=>{if(A.preventDefault(),!!Tt())try{let oe=d==="create"&&Te.length>0?{...Q,pendingFiles:Te}:Q;await s(oe),xe([]),t();}catch(oe){console.error("Error submitting task:",oe);}},Ze=(A,oe)=>{Ye(me=>{let ze={...me,[A]:oe};if(A==="status"){let X=oe;X==="todo"?ze.progress=0:X==="in-progress"?(me.progress===0||me.progress===100)&&(ze.progress=50):X==="completed"||X==="closed"?ze.progress=100:(X==="in-review"||X==="review")&&(ze.progress=75);}if(A==="progress"){let X=typeof oe=="number"?oe:parseInt(oe,10);X===100&&me.status!=="completed"?ze.status="completed":X>0&&X<100&&me.status==="todo"?ze.status="in-progress":X===0&&me.status!=="todo"&&(ze.status="todo");}return ze}),Ne[A]&&Ke(me=>{let ze={...me};return delete ze[A],ze});},vt=w.find(A=>A.id===Q.status)??ji[0],bt=Ki.find(A=>A.id===Q.priority)??Ki[1],Gt=Xr.find(A=>A.value===Q.color)??Xr[0],ce={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:A=>A.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:vt.color||g.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:d==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:A=>{A.currentTarget.style.backgroundColor=g.hoverBg,A.currentTarget.style.color=g.textPrimary;},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="transparent",A.currentTarget.style.color=g.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Et,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:Q.name,onChange:A=>Ze("name",A.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Ne.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),Ne.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:Q.description||"",onChange:A=>Ze("description",A.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:G,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&h(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ce,borderColor:vt.color,backgroundColor:`${vt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:vt.color}}),jsxRuntime.jsx("span",{style:{color:vt.color},children:vt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:vt.color}})]}),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-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:w.map(A=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:oe=>oe.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:oe=>oe.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ze("status",A.id),h(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:A.color}}),A.title,Q.status===A.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},A.id))})})]}),jsxRuntime.jsxs("div",{ref:Z,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&k(!u),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ce,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:bt.color}}),jsxRuntime.jsx("span",{children:bt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:u&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:Ki.map(A=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:oe=>oe.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:oe=>oe.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ze("priority",A.id),k(false);},children:[jsxRuntime.jsx("span",{children:A.icon}),A.label,Q.priority===A.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},A.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:ae,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ce,disabled:n,children:[Q.assignees&&Q.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:Q.assignees.slice(0,3).map((A,oe)=>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:A.color||g.accent,borderColor:g.bgSecondary},children:A.initials},oe))}),Q.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:g.textTertiary},children:["+",Q.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(A=>{let oe=Q.assignees?.some(me=>me.name===A.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:me=>me.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:me=>me.currentTarget.style.backgroundColor="transparent",onClick:()=>{let me=oe?(Q.assignees||[]).filter(ze=>ze.name!==A.name):[...Q.assignees||[],{name:A.name,avatar:A.avatar,initials:A.name.split(" ").map(ze=>ze[0]).join("").toUpperCase().slice(0,2),color:g.accent}];Ze("assignees",me);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:g.accent},children:A.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:A.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:oe&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},A.id)})})})]}),jsxRuntime.jsxs("div",{ref:ie,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)C(false);else {if(ie.current){let A=ie.current.getBoundingClientRect(),oe=window.innerHeight,me=120,X=oe-A.bottom<me?A.top-me-8:A.bottom+8;L({top:X,left:A.left});}C(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ce,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:Q.color}}),jsxRuntime.jsx("span",{children:Gt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(it,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>C(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${I.top}px`,left:`${I.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:A=>A.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Xr.slice(0,18).map(A=>{let oe=Q.color===A.value;return jsxRuntime.jsx("button",{type:"button",onClick:me=>{me.preventDefault(),me.stopPropagation(),Ze("color",A.value),C(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:A.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:A.value,outline:oe?`2px solid ${A.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},A.value)})})})})]})})]}),c.length>0||l?jsxRuntime.jsx(Nr,{selectedTags:Q.tags||[],availableTags:c,onChange:A=>Ze("tags",A),onCreateTag:l,theme:g,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{ref:Fe,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!Q.isMilestone)if(N==="start")_(null);else {if(Fe.current){let A=Fe.current.getBoundingClientRect(),oe=window.innerHeight,me=320,X=oe-A.bottom<me?A.top-me-8:A.bottom+8;de({top:X,left:A.left});}_("start"),W(Q.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ce,opacity:Q.isMilestone?.5:1,cursor:Q.isMilestone?"not-allowed":"pointer"},disabled:n||Q.isMilestone,children:Q.startDate?Q.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!Q.isMilestone)if(N==="end")_(null);else {if(Fe.current){let A=Fe.current.getBoundingClientRect(),oe=window.innerHeight,me=320,X=oe-A.bottom<me?A.top-me-8:A.bottom+8;de({top:X,left:A.left});}_("end"),W(Q.endDate||Q.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ce,opacity:Q.isMilestone?.5:1,cursor:Q.isMilestone?"not-allowed":"pointer"},disabled:n||Q.isMilestone,children:Q.endDate?Q.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(it,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>_(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${le.top}px`,left:`${le.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:A=>A.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let A=new Date,oe=new Date(A);oe.setDate(A.getDate()+1);let me=new Date(A);me.setDate(A.getDate()+7);let ze=new Date(A);return ze.setDate(A.getDate()+14),[{label:"Hoy",date:A},{label:"Ma\xF1ana",date:oe},{label:"Pr\xF3xima semana",date:me},{label:"2 semanas",date:ze}].map((Be,V)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:Y=>Y.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{N==="start"?(Ze("startDate",Be.date),(!Q.endDate||Be.date>Q.endDate)&&Ze("endDate",Be.date),_("end")):(Ze("endDate",Be.date),(!Q.startDate||Be.date<Q.startDate)&&Ze("startDate",Be.date),_(null));},children:Be.label},V))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:A=>A.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ze("startDate",void 0),Ze("endDate",void 0),_(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:()=>W(new Date(O.getFullYear(),O.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:O.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>W(new Date(O.getFullYear(),O.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((A,oe)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:A},oe))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let A=O.getFullYear(),oe=O.getMonth(),me=new Date(A,oe,1).getDay(),ze=new Date(A,oe+1,0).getDate(),X=new Date,Be=[];for(let Y=me-1;Y>=0;Y--)Be.push({day:new Date(A,oe,-Y).getDate(),date:new Date(A,oe-1,new Date(A,oe,-Y).getDate()),isCurrentMonth:false});for(let Y=1;Y<=ze;Y++)Be.push({day:Y,date:new Date(A,oe,Y),isCurrentMonth:true});let V=42-Be.length;for(let Y=1;Y<=V;Y++)Be.push({day:Y,date:new Date(A,oe+1,Y),isCurrentMonth:false});return Be.map((Y,He)=>{let Re=Y.date.toDateString()===X.toDateString(),je=Q.startDate?.toDateString()===Y.date.toDateString(),We=Q.endDate?.toDateString()===Y.date.toDateString(),se=Q.startDate&&Q.endDate&&Y.date>=Q.startDate&&Y.date<=Q.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Y.isCurrentMonth?je||We?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:je?"#3B82F6":We?"#7C3AED":se?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Re&&!je&&!We?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{N==="start"?(Ze("startDate",Y.date),Q.endDate&&Y.date>Q.endDate&&Ze("endDate",Y.date),_("end")):(Ze("endDate",Y.date),Q.startDate&&Y.date<Q.startDate&&Ze("startDate",Y.date),_(null));},children:Y.day},He)})})()})]})]})]})})]}),Ne.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Ne.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:Q.progress,onChange:A=>Ze("progress",parseInt(A.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:Q.progress<30?"#EF4444":Q.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${Q.progress<30?"#EF4444":Q.progress<70?"#F59E0B":"#10B981"}20`,color:Q.progress<30?"#EF4444":Q.progress<70?"#F59E0B":"#10B981"},children:[Q.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>ke(!pe),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${pe?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:pe&&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:[(b||p.length>0||d==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:g.textTertiary},children:["Adjuntos ",d==="create"?Te.length>0&&`(${Te.length})`:p.length>0&&`(${p.length})`]})]}),d==="create"?jsxRuntime.jsx(nr,{cardId:"pending",attachments:Te.map((A,oe)=>({id:`pending-${oe}`,cardId:"pending",name:A.name,size:A.size,type:A.type,url:URL.createObjectURL(A),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:A=>xe(oe=>[...oe,...A]),onDelete:A=>{let oe=parseInt(A.replace("pending-",""),10);xe(me=>me.filter((ze,X)=>X!==oe));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(nr,{cardId:a?.id||"new",attachments:p,onUpload:b&&a?.id?A=>b(a.id,A):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),d==="create"&&Te.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[Te.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:Q.isMilestone,onChange:A=>Ze("isMilestone",A.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:g.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),Q.dependencies&&Q.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:Q.dependencies.map(A=>{let oe=r.find(me=>me.id===A);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${g.accent}20`,color:g.accent},children:[oe?.name||A.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let me=(Q.dependencies||[]).filter(ze=>ze!==A);Ze("dependencies",me);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},A)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{R(!F),B("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{R(false),B("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${g.border}`},children:jsxRuntime.jsx("input",{type:"text",value:S,onChange:A=>B(A.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:g.bgSecondary,color:g.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(A=>A.id!==a?.id).filter(A=>S===""||A.name.toLowerCase().includes(S.toLowerCase())).map(A=>{let oe=Q.dependencies?.includes(A.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let me=Q.dependencies||[],ze;oe?ze=me.filter(X=>X!==A.id):ze=[...me,A.id],Ze("dependencies",ze);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:oe?`${g.accent}10`:"transparent"},onMouseEnter:me=>{oe||(me.currentTarget.style.backgroundColor=g.hoverBg);},onMouseLeave:me=>{me.currentTarget.style.backgroundColor=oe?`${g.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:oe?g.accent:"transparent",borderColor:oe?g.accent:g.borderLight},children:oe&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:g.textPrimary},children:A.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:g.textTertiary},children:A.id.slice(0,8)})]})]},A.id)}),r.filter(A=>A.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:g.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:A=>A.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:A=>A.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:g.accent,color:"#FFF"},onMouseEnter:A=>!n&&(A.currentTarget.style.opacity="0.9"),onMouseLeave:A=>!n&&(A.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:d==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var dm=`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 cm(e){return
386
386
  ${mm(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 mm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function br(e,t){let a=mm(e),r=t.toLowerCase().trim(),o=a.find(d=>d.name.toLowerCase()===r);if(o)return o;let s=a.find(d=>d.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(d=>{let m=d.name.toLowerCase();return n.every(i=>m.includes(i))})}function Yi(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 u=new Date(r);return u.setDate(u.getDate()+1),u}if(a==="yesterday"||a==="ayer"){let u=new Date(r);return u.setDate(u.getDate()-1),u}if(a==="next week"||a==="la pr\xF3xima semana"){let u=new Date(r);return u.setDate(u.getDate()+7),u}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 b={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(b!==void 0){let y=new Date(r),C=y.getDay(),g=b-C;return g<=0&&(g+=7),y.setDate(y.getDate()+g),y}}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 u=parseInt(s[1],10),b=s[2].toLowerCase(),y=new Date(r);return b==="day"||b==="d\xEDa"||b==="dias"?y.setDate(y.getDate()+u):b==="week"||b==="semana"||b==="semanas"?y.setDate(y.getDate()+u*7):(b==="month"||b==="mes"||b==="meses")&&y.setMonth(y.getMonth()+u),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let d=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(d&&d[1]&&d[2]&&d[3]){let u=parseInt(d[1],10),b=parseInt(d[2],10)-1,y=parseInt(d[3],10);return new Date(y,b,u)}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 u=parseInt(i[1],10),b=m[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(b!==void 0)return new Date(y,b,u)}let c={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let u=c[l[1].toLowerCase()],b=parseInt(l[2],10),y=l[3]?parseInt(l[3],10):r.getFullYear();if(u!==void 0)return new Date(y,u,b)}return null}function qi(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 Xi(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 pm(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 um(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(),c=r[2].trim(),l=br(t,i),u=Yi(c);if(!l)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!u)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let b=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(u);return y.setDate(y.getDate()+b),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:u,endDate:y},message:`Moved "${l.name}" to ${u.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(),c=o[2].trim(),l=br(t,i),u=qi(c);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!u||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let b=new Date(l.endDate);return b.setDate(b.getDate()+u),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:b},message:`Extended "${l.name}" by ${u} days. New end date: ${b.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(),c=s[2].trim(),l=br(t,i),u=Xi(c);return l?u===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:u},message:`Set "${l.name}" progress to ${u}%.`,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(),c=n[2].trim(),l=br(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:c},message:`Renamed "${l.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let d=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let i=d[1].trim(),c=d[2].trim(),l=br(t,i),u=br(t,c);return l?u?{type:"link_tasks",taskId:u.id,taskName:u.name,dependencyFrom:l.id,dependencyTo:u.id,message:`Linked "${l.name}" \u2192 "${u.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,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(),c=br(t,i);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.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 gm(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 S0(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 E0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Qn(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let l=a.find(u=>u.id===c);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>Qn(c,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(c=>c.type==="finish-to-start").map(c=>c.taskId));let n=c=>{if(c)return typeof c=="string"?new Date(c):c},d=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||d&&m&&Math.abs(m.getTime()-d.getTime())<=864e5;return {id:e.id,name:e.title,startDate:d,endDate:m,progress:e.progress||0,status:S0(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 fm(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:E0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function bm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Qn(r,e,t))}var Ji={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"}},Zi={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"}},es={en:Ji,es:Zi};function Qi(e){return es[e]||es.en}function ts(e,t){let a=Qi(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var el=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-blue-500"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-green-500"}];function hm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let u=b=>{d.current&&!d.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let m=el[0],i=el.find(u=>u.value===e)??m,c=i.icon,l=u=>{switch(u){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(c,{className:f("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(c,{className:f("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:el.map(u=>{let b=u.icon;return jsxRuntime.jsxs("button",{onClick:y=>{y.stopPropagation(),t(u.value),n(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===u.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(b,{className:f("w-4 h-4",u.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:l(u.value)})]},u.value)})})]})}var tl=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function vm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let c=l=>{d.current&&!d.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let m=tl.find(c=>c.value===e)??tl[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:tl.map(c=>jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),t(c.value),n(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===c.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-2 h-2 rounded-full",c.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},c.value))})]})}function os(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ns(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function km({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,d]=react.useState(false),[m,i]=react.useState(""),c=react.useRef(null);react.useEffect(()=>{let y=C=>{c.current&&!c.current.contains(C.target)&&(d(false),i(""));};return n&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]);let l=t.filter(y=>y.name.toLowerCase().includes(m.toLowerCase())||y.email?.toLowerCase().includes(m.toLowerCase())),u=y=>e.some(C=>C.name===y),b=y=>{if(a)if(u(y.name))a(e.filter(C=>C.name!==y.name));else {let C={name:y.name,initials:os(y.name),color:y.color||ns(y.name).replace("bg-","").replace("-500",""),avatar:y.avatarUrl};a([...e,C]);}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:f("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((y,C)=>jsxRuntime.jsx("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!y.avatar&&ns(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,title:y.name,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||os(y.name)},`${y.name}-${C}`)),e.length>3&&jsxRuntime.jsxs("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),d(!n);},className:f("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:f("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:f("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((y,C)=>jsxRuntime.jsx("div",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!y.avatar&&ns(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||os(y.name)},`${y.name}-${C}`)),e.length>2&&jsxRuntime.jsxs("span",{className:f("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:f("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-64",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsxRuntime.jsx("input",{type:"text",value:m,onChange:y=>i(y.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:f("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:y=>y.stopPropagation()})}),jsxRuntime.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:l.length===0?jsxRuntime.jsx("p",{className:f("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):l.map(y=>jsxRuntime.jsxs("button",{onClick:C=>{C.stopPropagation(),b(y);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!y.avatarUrl&&ns(y.name)),children:y.avatarUrl?jsxRuntime.jsx("img",{src:y.avatarUrl,alt:y.name,className:"w-full h-full rounded-full object-cover"}):os(y.name)}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:r?"text-white":"text-gray-900",children:y.name}),y.email&&jsxRuntime.jsx("div",{className:f("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:y.email})]}),u(y.name)&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},y.id))}),e.length>0&&jsxRuntime.jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((y,C)=>jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[y.name,jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),a(e.filter(v=>v.name!==y.name));},className:"hover:text-red-500",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},`${y.name}-${C}`))})]})]})}var Z0={en:["January","February","March","April","May","June","July","August","September","October","November","December"],es:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},Q0={en:["Su","Mo","Tu","We","Th","Fr","Sa"],es:["Do","Lu","Ma","Mi","Ju","Vi","S\xE1"]};function ss({value:e,onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),[d,m]=react.useState(()=>{if(e){let g=e instanceof Date?e:new Date(e);return new Date(g.getFullYear(),g.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),i=react.useRef(null),c=e?e instanceof Date?e:new Date(e):null,l=r==="es"?"es":"en";react.useEffect(()=>{let g=v=>{i.current&&!i.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let u=g=>g?g.toLocaleDateString(r==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-",b=(g,v)=>new Date(g,v+1,0).getDate(),y=(g,v)=>new Date(g,v,1).getDay(),C=()=>{let g=d.getFullYear(),v=d.getMonth(),h=b(g,v),p=y(g,v),k=new Date,x=[];for(let D=0;D<p;D++)x.push(jsxRuntime.jsx("div",{className:"w-8 h-8"},`empty-${D}`));for(let D=1;D<=h;D++){let T=new Date(g,v,D),w=c&&c.getDate()===D&&c.getMonth()===v&&c.getFullYear()===g,A=k.getDate()===D&&k.getMonth()===v&&k.getFullYear()===g;x.push(jsxRuntime.jsx("button",{onClick:L=>{L.stopPropagation(),t?.(T),n(false);},className:f("w-8 h-8 rounded-full text-sm transition-colors",w?"bg-[#3B82F6] text-white":A?a?"bg-white/10 text-white":"bg-gray-100 text-gray-900":a?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-900"),children:D},D));}return x};return o||!t?jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u(c)}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:f("w-4 h-4",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u(c)})]}),s&&jsxRuntime.jsxs("div",{className:f("absolute z-50 top-full left-0 mt-1 p-3 rounded-lg shadow-lg border",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(d.getFullYear(),d.getMonth()-1,1));},className:f("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:f("w-4 h-4",a?"text-white":"text-gray-600")})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium",a?"text-white":"text-gray-900"),children:[Z0[l][d.getMonth()]," ",d.getFullYear()]}),jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(d.getFullYear(),d.getMonth()+1,1));},className:f("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",a?"text-white":"text-gray-600")})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:Q0[l].map(g=>jsxRuntime.jsx("div",{className:f("w-8 h-6 text-xs flex items-center justify-center",a?"text-[#6B7280]":"text-gray-400"),children:g},g))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:C()}),jsxRuntime.jsxs("div",{className:"mt-3 pt-3 border-t flex gap-2",style:{borderColor:a?"rgba(255,255,255,0.1)":"#E5E7EB"},children:[jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),t?.(new Date),n(false);},className:f("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation();let v=new Date;v.setDate(v.getDate()+1),t?.(v),n(false);},className:f("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Ma\xF1ana":"Tomorrow"})]})]})]})}function Nm({value:e=0,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{onClick:s=>{if(r||!t)return;s.stopPropagation();let n=s.currentTarget.getBoundingClientRect(),d=s.clientX-n.left,m=Math.round(d/n.width*100),i=Math.max(0,Math.min(100,m));t(i);},className:f("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxRuntime.jsxs("span",{className:f("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function Em({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[d,m]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{m(e);},[e]);let c=()=>{d!==e&&t?.(d),n(false);},l=u=>{u.key==="Enter"?c():u.key==="Escape"&&(m(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:f("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:d,onChange:u=>m(u.target.value),onBlur:c,onKeyDown:l,onClick:u=>u.stopPropagation(),className:f("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:u=>{u.stopPropagation(),n(true);},className:f("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Fm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false}){let[d,m]=react.useState(false),[i,c]=react.useState(e?.toString()||""),l=react.useRef(null);react.useEffect(()=>{d&&l.current&&(l.current.focus(),l.current.select());},[d]),react.useEffect(()=>{c(e?.toString()||"");},[e]);let u=()=>{let y=parseFloat(i);if(!isNaN(y)){let C=y;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&t?.(C);}m(false);},b=y=>{y.key==="Enter"?u():y.key==="Escape"&&(c(e?.toString()||""),m(false));};return n||!t?jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:e!==void 0?e:r}):d?jsxRuntime.jsx("input",{ref:l,type:"number",value:i,onChange:y=>c(y.target.value),onBlur:u,onKeyDown:b,onClick:y=>y.stopPropagation(),min:o,max:s,className:f("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),m(true);},className:f("text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",e===void 0&&(a?"text-[#6B7280]":"text-gray-400")),children:e!==void 0?e:r})}function Am({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,d]=react.useState(false),m=react.useRef(null);return react.useEffect(()=>{let i=c=>{m.current&&!m.current.contains(c.target)&&d(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:f("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),d(!n);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:f("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:f("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),d(false);},className:f("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function Lm({value:e=false,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsx("button",{onClick:s=>{s.stopPropagation(),!r&&t&&t(!e);},disabled:r||!t,className:f("w-5 h-5 rounded border-2 flex items-center justify-center transition-colors",e?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed"),children:e&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})})}function Om({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:f("text-sm",t?"text-[#6B7280]":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:f("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function ky(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function wy(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function Hm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:d,onColumnHide:m,onColumnSort:i,availableUsers:c=[]}){let l=react.useRef(null),u=r==="es"?Um.es:Um.en;if(react.useEffect(()=>{let v=p=>{l.current&&!l.current.contains(p.target)&&t();},h=p=>{p.key==="Escape"&&t();};return document.addEventListener("mousedown",v),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let b=()=>{if(!e.task)return [];let v=[];return o&&v.push({id:"edit",label:u.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),v.push({id:"sep1",label:"",icon:null,separator:true}),d&&(v.push({id:"status",label:u.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:u.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{d({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:u.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{d({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:u.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{d({...e.task,status:"completed",progress:100}),t();}}]}),v.push({id:"priority",label:u.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:u.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{d({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:u.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{d({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:u.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{d({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:u.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{d({...e.task,priority:"low"}),t();}}]}),c.length>0&&v.push({id:"assign",label:u.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:h.name.charAt(0).toUpperCase()}),onClick:()=>{let p=e.task.assignees||[],x=p.some(D=>D.name===h.name)?p.filter(D=>D.name!==h.name):[...p,{name:h.name,initials:ky(h.name),color:h.color||wy(h.name),avatar:h.avatarUrl}];d({...e.task,assignees:x}),t();}}))})),v.push({id:"sep2",label:"",icon:null,separator:true}),s&&v.push({id:"duplicate",label:u.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&v.push({id:"delete",label:u.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),v},y=()=>{if(!e.columnId)return [];let v=[];return i&&(v.push({id:"sort-asc",label:u.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),v.push({id:"sort-desc",label:u.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),m&&e.columnId!=="name"&&(v.push({id:"sep-hide",label:"",icon:null,separator:true}),v.push({id:"hide",label:u.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{m(e.columnId),t();}})),v},C=e.type==="task"?b():y(),g={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:l,style:g,className:f("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:C.map(v=>v.separator?jsxRuntime.jsx("div",{className:f("my-1 h-px",a?"bg-white/10":"bg-gray-200")},v.id):v.submenu?jsxRuntime.jsx(Cy,{item:v,isDark:a},v.id):jsxRuntime.jsxs("button",{onClick:v.onClick,className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",v.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:f(v.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:v.icon}),v.label]},v.id))})}function Cy({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:f("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(d=>jsxRuntime.jsxs("button",{onClick:d.onClick,className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:d.icon}),d.label]},d.id))})]})}var Um={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna"}};var _m={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"})},Uy=["name","status","priority","assignees","startDate","endDate","progress","tags"];function jm({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:d}){let[m,i]=react.useState(""),c=react.useRef(null),l=d==="es"?Vm.es:Vm.en;if(react.useEffect(()=>{if(!e)return;let v=setTimeout(()=>{let h=k=>{c.current&&!c.current.contains(k.target)&&t();},p=k=>{k.key==="Escape"&&t();};document.addEventListener("mousedown",h),document.addEventListener("keydown",p),c._cleanup=()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",p);};},100);return ()=>{clearTimeout(v),c._cleanup&&c._cleanup();}},[e,t]),!e)return null;let u=v=>l.columns[v]||v,b=v=>{if(v==="name")return;let h=a.map(p=>p.id===v?{...p,visible:!p.visible}:p);o(h);},y=(v,h)=>{let p=a.find(x=>x.type===v&&(!h||x.customFieldId===h));if(p){b(p.id);return}let k={id:h||v,type:v,label:h?r.find(x=>x.id===h)?.name||v:u(v),width:120,visible:true,sortable:true,resizable:true,customFieldId:h};o([...a,k]);},C=Uy.filter(v=>u(v).toLowerCase().includes(m.toLowerCase())),g=r.filter(v=>v.name.toLowerCase().includes(m.toLowerCase()));return jsxRuntime.jsxs("div",{ref:c,className:f("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:f("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("font-medium",n?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:f("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:f("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:f("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:m,onChange:v=>i(v.target.value),placeholder:l.searchPlaceholder,className:f("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:f("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.standardFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:C.map(v=>{let h=a.find(x=>x.type===v&&!x.customFieldId),p=h?.visible??false,k=v==="name";return jsxRuntime.jsxs("button",{onClick:()=>{k||(h?b(h.id):y(v));},disabled:k,className:f("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",k&&"opacity-50 cursor-not-allowed"),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded border flex items-center justify-center",p?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:p&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:_m[v]}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:u(v)})]},v)})})]}),g.length>0&&jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:f("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.customFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:g.map(v=>{let p=a.find(k=>k.customFieldId===v.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>y(v.type,v.id),className:f("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded border flex items-center justify-center",p?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:p&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:_m[v.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:v.name})]},v.id)})})]}),s&&jsxRuntime.jsx("div",{className:f("p-3 border-t",n?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:s,className:f("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-colors",n?"bg-[#3B82F6]/20 text-[#3B82F6] hover:bg-[#3B82F6]/30":"bg-blue-50 text-blue-600 hover:bg-blue-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.createField]})})]})}var Vm={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",createField:"Create custom field",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",createField:"Crear campo personalizado",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Yy=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function qm({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[d,m]=react.useState("text"),[i,c]=react.useState([""]),l=o==="es"?Ym.es:Ym.en;react.useEffect(()=>{e&&(n(""),m("text"),c([""]));},[e]),react.useEffect(()=>{let g=v=>{v.key==="Escape"&&t();};return e&&document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]);let u=()=>{if(!s.trim())return;let g={name:s.trim(),type:d};d==="dropdown"&&(g.options=i.filter(v=>v.trim())),a(g),t();},b=()=>{c([...i,""]);},y=(g,v)=>{let h=[...i];h[g]=v,c(h);},C=g=>{i.length>1&&c(i.filter((v,h)=>h!==g));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:f("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:f("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:f("text-lg font-semibold",r?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:f("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:f("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:g=>n(g.target.value),placeholder:l.fieldNamePlaceholder,className:f("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:Yy.map(g=>jsxRuntime.jsxs("button",{onClick:()=>m(g.type),className:f("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",d===g.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:d===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:g.icon}),jsxRuntime.jsx("span",{className:f("text-xs",d===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:l.types[g.type]})]},g.type))})]}),d==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((g,v)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:g,onChange:h=>y(v,h.target.value),placeholder:`${l.option} ${v+1}`,className:f("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>C(v),className:f("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},v)),jsxRuntime.jsxs("button",{onClick:b,className:f("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:f("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:f("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:l.cancel}),jsxRuntime.jsx("button",{onClick:u,disabled:!s.trim(),className:f("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:l.create})]})]})]}):null}var Ym={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Zm={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function Qm({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,d]=react.useState(false),m=react.useRef(null),i=react.useRef(0),c=s==="es"?Zm.es:Zm.en;react.useEffect(()=>{if(!n)return;let b=C=>{Date.now()-i.current<100||m.current&&!m.current.contains(C.target)&&d(false);},y=C=>{C.key==="Escape"&&d(false);};return document.addEventListener("mousedown",b),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",y);}},[n]);let l=[{value:"all",label:c.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),n||(i.current=Date.now()),d(y=>!y);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",u&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),c.filters,u&&jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:f("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:f("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:c.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:l.map(b=>{let y=e===b.value&&!t,C=()=>b.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):b.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(b.value),r(false),d(false);},className:f("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",y&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f(y?b.color:"text-gray-400","flex-shrink-0"),children:C()}),jsxRuntime.jsx("span",{className:f("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:b.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:f("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},b.value)})}),jsxRuntime.jsx("div",{className:f("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let b=!t;r(b),b&&a("all"),d(false);},className:f("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:f("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:f("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var mv=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function op(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(...op(r.subtasks,t+1));return a}function pv({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 np({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:d=[],customFields:m=[]}){let{theme:i="dark",locale:c="en",customTranslations:l,showSearch:u=true,showHierarchy:b=true,tableColumns:y,allowColumnCustomization:C=true,allowColumnResize:g=true,enableContextMenu:v=true,showCreateTaskButton:h=false,onCreateTask:p}=t,k=ts(c,l),x=i==="dark",[D,T]=react.useState("startDate"),[w,A]=react.useState("asc"),[L,N]=react.useState(""),[H,$]=react.useState("all"),[j,ce]=react.useState(false),[J,re]=react.useState(y||mv),[ue,Ce]=react.useState(false),[Se,F]=react.useState(false),[R,S]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[B,_]=react.useState(null),[te,ne]=react.useState(0),[de,Fe]=react.useState(0),Q=react.useRef(null);react.useEffect(()=>{y&&re(y);},[y]);let Ye=react.useMemo(()=>{let G=new Set;function Y(He){for(let Re of He)Re.subtasks?.length&&(Re.isExpanded!==false&&G.add(Re.id),Y(Re.subtasks));}return Y(e),G},[e]),Te=react.useMemo(()=>J.filter(G=>G.visible),[J]),Ke=react.useCallback(G=>{a.onTaskToggleExpand?.(G);},[a]),Tt=react.useCallback(G=>{D===G?A(Y=>Y==="asc"?"desc":"asc"):(T(G),A("asc")),a.onSortChange?.({column:G,direction:w==="asc"?"desc":"asc"});},[D,w,a]),Et=react.useCallback(G=>{re(G),a.onColumnsChange?.(G);},[a]),Ze=react.useCallback(G=>{let Y=J.map(He=>He.id===G?{...He,visible:false}:He);Et(Y);},[J,Et]),vt=react.useCallback((G,Y)=>{T(G),A(Y);},[]),bt=react.useCallback((G,Y,He)=>{v&&(G.preventDefault(),S({isOpen:true,x:G.clientX,y:G.clientY,type:Y?"task":"header",task:Y,columnId:He}));},[v]),Gt=react.useCallback(()=>{S(G=>({...G,isOpen:false}));},[]),me=react.useCallback((G,Y)=>{if(!g)return;G.preventDefault(),G.stopPropagation();let He=J.find(Re=>Re.id===Y);He&&(_(Y),ne(G.clientX),Fe(He.width));},[J,g]);react.useEffect(()=>{if(!B)return;let G=He=>{let Re=He.clientX-te,je=Math.max(50,de+Re),We=J.map(le=>le.id===B?{...le,width:je}:le);re(We);},Y=()=>{B&&a.onColumnsChange?.(J),_(null);};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",Y),()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",Y);}},[B,te,de,J,a]);let I=react.useCallback(async G=>{if(a.onCreateCustomField){let Y={...G,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Y);}F(false);},[a]),se=react.useCallback(G=>G.progress===100||G.status==="completed"?"completed":G.progress&&G.progress>0||G.status==="in-progress"?"in-progress":"todo",[]),pe=react.useMemo(()=>{let G=op(e);if(L.trim()){let Y=L.toLowerCase();G=G.filter(He=>He.name.toLowerCase().includes(Y));}return H!=="all"&&(G=G.filter(Y=>se(Y)===H)),j&&(G=G.filter(Y=>se(Y)!=="completed")),G.sort((Y,He)=>{let Re,je;switch(D){case "name":Re=Y.name.toLowerCase(),je=He.name.toLowerCase();break;case "startDate":Re=Y.startDate?.getTime()||0,je=He.startDate?.getTime()||0;break;case "endDate":Re=Y.endDate?.getTime()||0,je=He.endDate?.getTime()||0;break;case "progress":Re=Y.progress||0,je=He.progress||0;break;case "status":Re=Y.status||"todo",je=He.status||"todo";break;case "priority":let We={urgent:0,high:1,medium:2,low:3,none:4};Re=We[Y.priority]??4,je=We[He.priority]??4;break;default:return 0}return Re<je?w==="asc"?-1:1:Re>je?w==="asc"?1:-1:0}),G},[e,L,H,j,D,w,se]),ze=react.useCallback((G,Y)=>{let He=We=>{a.onTaskUpdate?.({...G,...We});},Re=We=>We?G.customFields?.find(Ie=>Ie.fieldId===We)?.value:void 0,je=(We,le)=>{if(!We)return;let ee=[...G.customFields||[]],_e=ee.findIndex(Na=>Na.fieldId===We);_e>=0?ee[_e]={fieldId:We,value:le}:ee.push({fieldId:We,value:le}),He({customFields:ee});};switch(Y.type){case "name":return null;case "status":return jsxRuntime.jsx(hm,{value:G.status||(G.progress===100?"completed":G.progress&&G.progress>0?"in-progress":"todo"),onChange:le=>{He({status:le,progress:le==="completed"?100:le==="in-progress"?50:0});},isDark:x,locale:c,translations:k.status});case "priority":return jsxRuntime.jsx(vm,{value:G.priority,onChange:le=>He({priority:le}),isDark:x,locale:c});case "assignees":return jsxRuntime.jsx(km,{value:G.assignees||[],availableUsers:d,onChange:le=>He({assignees:le}),isDark:x,locale:c});case "startDate":return jsxRuntime.jsx(ss,{value:G.startDate,onChange:le=>He({startDate:le}),isDark:x,locale:c});case "endDate":return jsxRuntime.jsx(ss,{value:G.endDate,onChange:le=>He({endDate:le}),isDark:x,locale:c});case "progress":return jsxRuntime.jsx(Nm,{value:G.progress||0,onChange:le=>{let Ie=le===100?"completed":le>0?"in-progress":"todo";He({progress:le,status:Ie});},isDark:x});case "tags":return jsxRuntime.jsx(Om,{value:G.tags||[],isDark:x});case "text":return jsxRuntime.jsx(Em,{value:Re(Y.customFieldId)||"",onChange:le=>je(Y.customFieldId,le),isDark:x});case "number":return jsxRuntime.jsx(Fm,{value:Re(Y.customFieldId)||0,onChange:le=>je(Y.customFieldId,le),isDark:x});case "date":let We=Re(Y.customFieldId);return jsxRuntime.jsx(ss,{value:We?new Date(We):void 0,onChange:le=>je(Y.customFieldId,le),isDark:x,locale:c});case "dropdown":return jsxRuntime.jsx(Am,{value:Re(Y.customFieldId)||"",options:Y.options||[],onChange:le=>je(Y.customFieldId,le),isDark:x});case "checkbox":return jsxRuntime.jsx(Lm,{value:Re(Y.customFieldId)||false,onChange:le=>je(Y.customFieldId,le),isDark:x});default:return jsxRuntime.jsx("span",{className:f("text-sm",x?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,x,c,d,k]),X=react.useCallback(G=>({name:k.columns.name,status:k.columns.status,priority:k.columns.priority,assignees:k.columns.assignees,startDate:k.columns.startDate,endDate:k.columns.endDate,progress:k.columns.progress})[G.type]||G.label,[k]),Be=react.useMemo(()=>Te.reduce((G,Y)=>G+Y.width,0)+(C?48:0),[Te,C]);return r?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[k.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",x?"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",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:k.empty.noTasks}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:k.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Q,className:f("flex-1 flex flex-col w-full h-full overflow-hidden",x?"bg-[#0F1117]":"bg-white",B&&"select-none",s),style:n,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(Qm,{value:H,hideCompleted:j,onChange:$,onHideCompletedChange:ce,isDark:x,locale:c}),jsxRuntime.jsxs("div",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[pe.length," ",k.pagination.tasks]}),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",x?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:L,onChange:G=>N(G.target.value),placeholder:k.toolbar.searchPlaceholder,className:f("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",x?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),h&&p&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:k.toolbar.newTask})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsxs("div",{style:{minWidth:Be},children:[jsxRuntime.jsxs("div",{className:f("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",x?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[Te.map(G=>jsxRuntime.jsxs("div",{className:f("relative flex items-center gap-2 px-4 py-3",x?"text-[#9CA3AF]":"text-gray-500"),style:{width:G.width,minWidth:G.minWidth},onContextMenu:Y=>bt(Y,void 0,G.id),children:[G.sortable?jsxRuntime.jsxs("button",{onClick:()=>Tt(G.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[X(G),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:f("w-3 h-3",D===G.id&&"text-[#3B82F6]")})]}):jsxRuntime.jsx("span",{children:X(G)}),g&&G.resizable&&jsxRuntime.jsx("div",{className:f("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",B===G.id&&"bg-[#3B82F6]"),onMouseDown:Y=>me(Y,G.id)})]},G.id)),C&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsxRuntime.jsx("button",{onClick:G=>{G.stopPropagation(),Ce(Y=>!Y);},className:f("p-1.5 rounded-lg transition-colors",x?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ue&&(x?"bg-white/10":"bg-gray-200")),title:c==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(jm,{isOpen:ue,onClose:()=>Ce(false),columns:J,customFields:m,onColumnsChange:Et,onCreateCustomField:()=>{Ce(false),F(true);},isDark:x,locale:c})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:pe.map((G,Y)=>{let He=Ye.has(G.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:Y*.02},className:f("flex items-center border-b transition-colors",x?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(G),onDoubleClick:()=>a.onTaskDoubleClick?.(G),onContextMenu:Re=>bt(Re,G),children:[Te.map(Re=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Re.width,minWidth:Re.minWidth},children:Re.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&G.level>0&&jsxRuntime.jsx("div",{style:{width:`${G.level*24}px`},className:"flex-shrink-0"}),b&&G.hasChildren&&jsxRuntime.jsx("button",{onClick:je=>{je.stopPropagation(),Ke(G.id);},className:f("p-0.5 rounded flex-shrink-0",x?"hover:bg-white/10":"hover:bg-gray-200"),children:He?jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")})}),b&&!G.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsx("button",{onClick:je=>{je.stopPropagation(),a.onTaskUpdate?.({...G,progress:G.progress===100?0:100,status:G.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(pv,{status:G.status,progress:G.progress})}),jsxRuntime.jsx("span",{className:f("truncate font-medium",x?"text-white":"text-gray-900",G.progress===100&&(x?"line-through text-[#6B7280]":"line-through text-gray-400")),children:G.name})]}):ze(G,Re)},Re.id)),C&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},G.id)})}),pe.length===0&&L&&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",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f(x?"text-[#9CA3AF]":"text-gray-600"),children:k.empty.noResults})]})})]})}),jsxRuntime.jsx(Hm,{state:R,onClose:Gt,isDark:x,locale:c,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Ze,onColumnSort:vt,availableUsers:d}),jsxRuntime.jsx(qm,{isOpen:Se,onClose:()=>F(false),onSave:I,isDark:x,locale:c})]})}var sp=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true}],ip=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"}],lp=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var il={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"},ll={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"},dl={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"},ds={dark:il,light:ll,neutral:dl};function dp(e){return ds[e]||ds.dark}var cl={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"}},ml={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"}},cs={en:cl,es:ml};function tn(e){return cs[e]||cs.en}function ms(e,t){let a=tn(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 cp(e){let t=tn(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 mp(e,t=0,a=true){let r=tn(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 bp(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 ul(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 hp({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 vp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:d,availableTags:m=[],onCreateTag:i,attachmentsByTask:c,comments:l,onAddComment:u,currentUser:b,mentionableUsers:y,onUploadCommentAttachments:C,onTaskOpen:g}){let{theme:v="dark",locale:h="en",customTranslations:p}=t,k=ms(h,p),x=v==="dark",[D,T]=react.useState(r||new Date),[w,A]=react.useState(null),[L,N]=react.useState(null),[H,$]=react.useState({}),j=4,ce=3,[J,re]=react.useState(null),[ue,Ce]=react.useState(""),[Se,F]=react.useState(void 0),[R,S]=react.useState(null),[B,_]=react.useState(false),[te,ne]=react.useState(false),[de,Fe]=react.useState(null),[Q,Ye]=react.useState(false),[Te,Ke]=react.useState(new Date),Tt=react.useCallback(()=>{T(new Date(D.getFullYear(),D.getMonth()-1,1));},[D]),Et=react.useCallback(()=>{T(new Date(D.getFullYear(),D.getMonth()+1,1));},[D]),Ze=react.useCallback(()=>{T(new Date);},[]),vt=react.useMemo(()=>{let me=D.getFullYear(),I=D.getMonth(),se=new Date(me,I,1),pe=new Date(me,I+1,0),ze=se.getDay(),X=pe.getDate(),Be=bp(e),G=new Date;G.setHours(0,0,0,0);let Y=[],He=ze,Re=new Date(me,I,0).getDate();for(let We=He-1;We>=0;We--){let le=new Date(me,I-1,Re-We);Y.push({date:le,isCurrentMonth:false,isToday:false,isWeekend:le.getDay()===0||le.getDay()===6,events:Be.filter(Ie=>ul(le,Ie)).map(Ie=>({id:Ie.id,title:Ie.name,start:Ie.startDate,end:Ie.endDate,task:Ie}))});}for(let We=1;We<=X;We++){let le=new Date(me,I,We),Ie=le.getTime()===G.getTime();Y.push({date:le,isCurrentMonth:true,isToday:Ie,isWeekend:le.getDay()===0||le.getDay()===6,events:Be.filter(ee=>ul(le,ee)).map(ee=>({id:ee.id,title:ee.name,start:ee.startDate,end:ee.endDate,task:ee}))});}let je=42-Y.length;for(let We=1;We<=je;We++){let le=new Date(me,I+1,We);Y.push({date:le,isCurrentMonth:false,isToday:false,isWeekend:le.getDay()===0||le.getDay()===6,events:Be.filter(Ie=>ul(le,Ie)).map(Ie=>({id:Ie.id,title:Ie.name,start:Ie.startDate,end:Ie.endDate,task:Ie}))});}return Y},[D,e]),bt=h==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Gt=D.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:d,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",x?"text-[#9CA3AF]":"text-gray-600"),children:[k.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:d,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",x?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",x?"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",x?"bg-[#0F1117]":"bg-white",n),style:d,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",x?"text-white":"text-gray-900"),children:k.labels.noEvents}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:k.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-auto",x?"bg-[#0F1117]":"bg-white",n),style:d,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",x?"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",x?"text-white":"text-gray-900"),children:Gt}),jsxRuntime.jsx("button",{onClick:Ze,className:f("px-3 py-1.5 text-sm rounded-lg transition-colors",x?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:k.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Tt,className:f("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:f("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:Et,className:f("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-5 h-5",x?"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:bt.map(me=>jsxRuntime.jsx("div",{className:f("py-2 text-center text-xs font-medium uppercase",x?"text-[#9CA3AF]":"text-gray-500"),children:me},me))}),jsxRuntime.jsx("div",{className:f("grid grid-cols-7 auto-rows-min gap-px rounded-lg",x?"bg-[#2D2D2D]":"bg-gray-300"),children:vt.map((me,I)=>{let se=me.date.getDay()===0||me.date.getDay()===6;return jsxRuntime.jsxs("div",{className:f("min-h-[120px] p-2 transition-colors flex flex-col relative group",x?se?"bg-[#1C1F26]":me.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":se?"bg-gray-100":me.isCurrentMonth?"bg-white":"bg-gray-50",me.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let pe=H[I]||j,ze=me.events.slice(0,pe),X=me.events.length-pe;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[ze.map(Be=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{A(Be.task),a.onEventClick?.(Be),g?.(Be.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",Be.task.progress===100?x?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":x?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(hp,{task:Be.task}),jsxRuntime.jsx("span",{className:"truncate",children:Be.title})]})},Be.id)),X>0&&jsxRuntime.jsxs("button",{onClick:Be=>{Be.stopPropagation(),$(G=>({...G,[I]:pe+ce}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",X," ",h==="es"?"M\xC1S":"MORE"]}),pe>j&&me.events.length>j&&jsxRuntime.jsx("button",{onClick:Be=>{Be.stopPropagation(),$(G=>({...G,[I]:j}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:h==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let pe=I>=28,ze=I%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),J===I?re(null):(re(I),Ce(""),F(void 0),S(null),Fe(null),_(false),ne(false),Ye(false),Ke(me.date));},className:f("w-5 h-5 rounded flex items-center justify-center transition-all",J===I?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",x?"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",J===I&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:J===I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{re(null),Ce(""),F(void 0),S(null),Fe(null),_(false),ne(false),Ye(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:pe?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:pe?-5:5,scale:.95},transition:{duration:.12},className:f("absolute w-[320px] rounded-lg shadow-2xl z-50",pe?"bottom-full mb-1":"top-full mt-1",ze?"right-0":"left-0",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>{X.stopPropagation(),_(false),ne(false),Ye(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:ue,onChange:X=>Ce(X.target.value),placeholder:h==="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",x?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:X=>{if(X.key==="Enter"&&ue.trim()){let Be=t.availableUsers?.find(Y=>Y.id===R),G=de||me.date;a.onTaskCreate?.({name:ue.trim(),startDate:G,endDate:G,priority:Se,assignees:Be?[Be]:void 0}),Ce(""),F(void 0),S(null),Fe(null),re(null);}X.key==="Escape"&&(re(null),Ce(""),F(void 0),S(null),Fe(null));}})}),jsxRuntime.jsxs("div",{className:f("px-2.5 py-2 flex items-center justify-between border-t",x?"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:X=>{X.stopPropagation(),_(!B),ne(false);},className:f("p-1 rounded transition-colors",Se?Se==="urgent"||Se==="high"?"text-red-400 bg-red-500/20":Se==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":x?"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:B&&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]",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:h==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:h==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:h==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:h==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:h==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxRuntime.jsxs("button",{onClick:()=>{F(X.id),_(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",Se===X.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",X.color)}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:X=>{X.stopPropagation(),Ye(!Q),_(false),ne(false),Ke(de||me.date);},className:f("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",de?"bg-[#7C3AED]/20 text-[#7C3AED]":x?"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"}),(de||me.date).toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Q&&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",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsx("div",{className:f("w-40 py-2 border-r",x?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,Be=new Date(X);Be.setDate(X.getDate()+1);let G=new Date(X);G.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let Y=new Date(X);Y.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let He=new Date(X);He.setDate(X.getDate()+14);let Re=new Date(X);return Re.setDate(X.getDate()+28),[{label:h==="es"?"Hoy":"Today",date:X,display:X.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Ma\xF1ana":"Tomorrow",date:Be,display:Be.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Este fin de semana":"This weekend",date:G,display:h==="es"?"s\xE1b.":"sat."},{label:h==="es"?"Pr\xF3xima semana":"Next week",date:Y,display:h==="es"?"lun.":"mon."},{label:h==="es"?"2 semanas":"2 weeks",date:He,display:He.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:h==="es"?"4 semanas":"4 weeks",date:Re,display:Re.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((We,le)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",x?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Fe(We.date),Ye(false);},children:[jsxRuntime.jsx("span",{children:We.label}),jsxRuntime.jsx("span",{className:f("text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:We.display})]},le))})()}),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",x?"text-white":"text-gray-900"),children:Te.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Ke(new Date),className:f("px-1.5 py-0.5 rounded text-[10px] transition-colors",x?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:h==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Ke(new Date(Te.getFullYear(),Te.getMonth()-1)),className:f("p-0.5 rounded",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Ke(new Date(Te.getFullYear(),Te.getMonth()+1)),className:f("p-0.5 rounded",x?"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:(h==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsxRuntime.jsx("div",{className:f("w-6 h-6 flex items-center justify-center text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:X},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=Te.getFullYear(),Be=Te.getMonth(),G=new Date(X,Be,1).getDay(),Y=new Date(X,Be+1,0).getDate(),He=new Date(X,Be,0).getDate(),Re=new Date,je=[];for(let le=G-1;le>=0;le--)je.push({dayNum:He-le,isCurrentMonth:false,date:new Date(X,Be-1,He-le)});for(let le=1;le<=Y;le++)je.push({dayNum:le,isCurrentMonth:true,date:new Date(X,Be,le)});let We=42-je.length;for(let le=1;le<=We;le++)je.push({dayNum:le,isCurrentMonth:false,date:new Date(X,Be+1,le)});return je.map((le,Ie)=>{let ee=le.date.toDateString()===Re.toDateString(),_e=(de||me.date).toDateString()===le.date.toDateString();return jsxRuntime.jsx("button",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!le.isCurrentMonth&&(x?"text-[#4B5563]":"text-gray-300"),le.isCurrentMonth&&(x?"text-white":"text-gray-900"),ee&&"ring-1 ring-[#3B82F6]",_e&&"bg-[#7C3AED] text-white",!_e&&(x?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Fe(le.date),Ye(false);},children:le.dayNum},Ie)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),ne(!te),_(false);},className:f("p-1 rounded transition-colors",R?"text-[#7C3AED] bg-[#7C3AED]/20":x?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:R?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(X=>X.id===R)?.color||"#7C3AED"},children:t.availableUsers?.find(X=>X.id===R)?.initials||t.availableUsers?.find(X=>X.id===R)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:te&&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",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{S(null),ne(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",!R&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded-full flex items-center justify-center",x?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:x?"text-[#9CA3AF]":"text-gray-500",children:h==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(X=>jsxRuntime.jsxs("button",{onClick:()=>{S(X.id),ne(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",R===X.id&&(x?"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:X.color||"#7C3AED"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:X.name})]},X.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:f("px-3 py-2 text-xs",x?"text-[#6B7280]":"text-gray-400"),children:h==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(ue.trim()){let X=t.availableUsers?.find(G=>G.id===R),Be=de||me.date;a.onTaskCreate?.({name:ue.trim(),startDate:Be,endDate:Be,priority:Se,assignees:X?[X]:void 0}),Ce(""),F(void 0),S(null),Fe(null),re(null);}},disabled:!ue.trim(),className:f("px-2.5 py-1 rounded text-xs font-medium transition-colors",ue.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":x?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:h==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:f("text-sm font-medium",me.isToday?"text-[#3B82F6]":me.isCurrentMonth?x?"text-white":"text-gray-900":x?"text-[#6B7280]":"text-gray-400"),children:me.date.getDate()})]})]},I)})})]})}),jsxRuntime.jsx(mr,{task:w,isOpen:!!w,onClose:()=>A(null),onTaskUpdate:me=>{a.onTaskUpdate?.(me),A(me);},theme:v==="dark"?"dark":"light",locale:h,availableUsers:t.availableUsers?.map(me=>({id:me.id,name:me.name,avatar:me.avatar,initials:me.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:m,onCreateTag:i,attachments:w?c?.get(w.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:bp(e).filter(me=>me.id!==w?.id),comments:l?.filter(me=>me.taskId===w?.id).map(me=>({...me,createdAt:me.createdAt instanceof Date?me.createdAt:new Date(me.createdAt),updatedAt:me.updatedAt instanceof Date?me.updatedAt:me.updatedAt?new Date(me.updatedAt):void 0})),onAddComment:u,currentUser:b,mentionableUsers:y,onUploadCommentAttachments:C}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>N(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className: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",x?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:f("px-4 py-3 border-b flex items-center justify-between",x?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:f("font-medium",x?"text-white":"text-gray-900"),children:L.date.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>N(null),className:f("p-1 rounded",x?"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:L.events.map(me=>jsxRuntime.jsxs("button",{onClick:()=>{N(null),A(me.task),g?.(me.task.id);},className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",x?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(hp,{task:me.task}),jsxRuntime.jsx("span",{className:f("text-sm truncate flex-1",x?"text-white":"text-gray-900"),children:me.title}),me.task.priority==="high"||me.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},me.id))})]})]})})]})}var gl={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"},fl={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"},bl={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"},ps={dark:gl,light:fl,neutral:bl};function xp(e){return ps[e]||ps.dark}function wv({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:d}){let[m,i]=react.useState(false),c=react.useMemo(()=>t.filter(b=>e.cardIds.includes(b.id)),[t,e.cardIds]),l=react.useMemo(()=>{let b=c.length,y=new Set(c.flatMap(v=>v.assignedUserIds||[])).size,C=c.map(v=>v.priority).filter(Boolean),g=new Set(c.flatMap(v=>v.labels||[])).size;return {totalCards:b,uniqueAssignees:y,priorities:C,labels:g}},[c]),u=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:f("card-stack",!e.isExpanded&&"card-stack-collapsed",d),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:u,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:l.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:b=>{b.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:c.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:c.map(b=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(b),children:a(b)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(b),children:[jsxRuntime.jsx("h4",{children:b.title}),b.description&&jsxRuntime.jsxs("p",{children:[b.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,b.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"})]})})]},b.id))})})]})}var wp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function rn(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 on(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 Cp(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 Tp({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:d}){let m=react.useMemo(()=>({...wp,...n}),[n]),[i,c]=react.useState(new Set),l=react.useRef(null),u=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(p=>{let k=p.timestamp.toISOString().split("T")[0],x=h.get(k);x?x.push(p):h.set(k,[p]);}),Array.from(h.entries()).sort((p,k)=>k[0].localeCompare(p[0])).map(([p,k])=>({date:new Date(p),events:k.sort((x,D)=>D.timestamp.getTime()-x.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:b,uniqueTypes:y}=react.useMemo(()=>{let h=new Set,p=new Set;return e.forEach(k=>{h.add(k.userId),p.add(k.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(p)}},[e]),C=h=>{c(p=>{let k=new Set(p);return k.has(h)?k.delete(h):k.add(h),k});},g=h=>{let k=new Date().getTime()-h.getTime(),x=Math.floor(k/6e4),D=Math.floor(k/36e5),T=Math.floor(k/864e5);return x<1?"just now":x<60?`${x}m ago`:D<24?`${D}h ago`:T<7?`${T}d ago`:h.toLocaleDateString()},v=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&l.current){let h=l.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:f("history-timeline-empty",d),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",d),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:h=>{let p=h.target.value;a({...t,types:p?[p]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(h=>jsxRuntime.jsxs("option",{value:h,children:[on(h)," ",h.replace("_"," ")]},h))]}),b.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let p=h.target.value;a({...t,users:p?[p]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),b.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),v>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",v,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:l,children:u.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((p,k)=>{let x=i.has(p.id),D=s===p.id,T=Cp(p.type);return jsxRuntime.jsxs("div",{"data-event-id":p.id,className:f("history-timeline-event",x&&"expanded",D&&"selected"),onClick:()=>o?.(p),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:T},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:on(p.type)})}),k<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:T}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&p.userAvatar&&jsxRuntime.jsx("img",{src:p.userAvatar,alt:p.userName||p.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:p.userName||p.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:rn(p)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?g(p.timestamp):p.timestamp.toLocaleString()})]}),Object.keys(p.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),C(p.id);},children:[x?"\u25BC":"\u25B6"," Show changes"]}),x&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(p.changes).map(([w,A])=>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(A.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(A.to)})]})]},w)),p.metadata&&Object.keys(p.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(p.metadata).map(([w,A])=>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(A)})]},w))]})]})]})]},p.id)})})]},h.date?.toISOString()||"all"))})]})}function Dp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:d,onSpeedChange:m,className:i}){let c=[.5,1,1.5,2,3],l=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),u=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:l&&on(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&rn(l)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:b=>d(parseInt(b.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${u}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((b,y)=>jsxRuntime.jsx("div",{className:f("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>d(y),title:rn(b)},b.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:c.map(b=>jsxRuntime.jsxs("button",{className:f("history-replay-speed-btn",e.speed===b&&"active"),onClick:()=>m(b),children:[b,"x"]},b))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(b=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:b},b))})]})]})]})]}):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 hl(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 yl(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 Sp(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 Ep(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Ev(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})),d=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(c=>{let l=a/2,u=r/2;c.vx+=(l-c.x)*o.centerForce*i,c.vy+=(u-c.y)*o.centerForce*i,n.forEach(b=>{if(c.id===b.id)return;let y=c.x-b.x,C=c.y-b.y,g=Math.sqrt(y*y+C*C)||1,v=o.chargeStrength*i/(g*g);c.vx+=y/g*v,c.vy+=C/g*v;});}),t.forEach(c=>{let l=d.get(typeof c.source=="string"?c.source:c.source.id),u=d.get(typeof c.target=="string"?c.target:c.target.id);if(!l||!u)return;let b=u.x-l.x,y=u.y-l.y,C=Math.sqrt(b*b+y*y)||1,g=(C-o.linkDistance)/C*o.forceStrength*i;l.vx+=b*g,l.vy+=y*g,u.vx-=b*g,u.vy-=y*g;}),n.forEach(c=>{c.fx!==null&&c.fx!==void 0?(c.x=c.fx,c.vx=0):c.x+=c.vx,c.fy!==null&&c.fy!==void 0?(c.y=c.fy,c.vy=0):c.y+=c.vy,c.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,c.x)),c.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,c.y)),c.vx*=.9,c.vy*=.9;});}return n}function Pp({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:d,className:m}){let i=react.useRef(null),[c,l]=react.useState([]),[u,b]=react.useState(null),[y,C]=react.useState(null),[g,v]=react.useState(null),[h,p]=react.useState(1),[k,x]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let $=Ev(e,t,a.width,a.height,a,150);l($);},[e,t,a]);let D=react.useCallback(($,j)=>{a.enableDragging&&(j.stopPropagation(),b($));},[a.enableDragging]),T=react.useCallback($=>{if(!u||!i.current)return;let ce=i.current.getBoundingClientRect(),J=($.clientX-ce.left-k.x)/h,re=($.clientY-ce.top-k.y)/h;l(ue=>ue.map(Ce=>Ce.id===u?{...Ce,x:J,y:re,fx:J,fy:re}:Ce));},[u,h,k]),w=react.useCallback(()=>{b(null);},[]),A=react.useCallback(($,j)=>{j.stopPropagation(),d?.({type:"node-click",node:$,position:{x:j.clientX,y:j.clientY}});},[d]),L=react.useCallback(($,j)=>{j.stopPropagation(),d?.({type:"edge-click",edge:$,position:{x:j.clientX,y:j.clientY}});},[d]),N=react.useCallback($=>{let j=c.find(ce=>ce.id===$);return j?{x:j.x,y:j.y}:{x:0,y:0}},[c]),H=react.useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let j=$.card.priority;return j==="URGENT"?"#ef4444":j==="HIGH"?"#f59e0b":j==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className: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:()=>p($=>Math.min($+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>p($=>Math.max($-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{p(1),x({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:hl($)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Sp($)," ",yl($)]})]},$))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:T,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${k.x}, ${k.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let j=N(typeof $.source=="string"?$.source:$.source.id),ce=N(typeof $.target=="string"?$.target:$.target.id),J=Ep($.type),re=g===$.id,ue=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-edge",re&&"hovered",ue&&"critical"),onMouseEnter:()=>v($.id),onMouseLeave:()=>v(null),onClick:Ce=>L($,Ce),children:[jsxRuntime.jsx("line",{x1:j.x,y1:j.y,x2:ce.x,y2:ce.y,stroke:hl($.type),strokeWidth:ue?a.edgeWidth*2:a.edgeWidth,strokeOpacity:re?1:.6,markerEnd:J?"url(#arrowhead)":void 0}),a.showEdgeLabels&&re&&jsxRuntime.jsx("text",{x:(j.x+ce.x)/2,y:(j.y+ce.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:yl($.type)})]},$.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:c.map($=>{let j=y===$.id,ce=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-node",j&&"hovered",ce&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:J=>D($.id,J),onMouseEnter:()=>C($.id),onMouseLeave:()=>C(null),onClick:J=>A($,J),children:[jsxRuntime.jsx("circle",{r:ce?a.nodeSize*1.2:a.nodeSize,fill:H($),stroke:ce?"#fbbf24":"#ffffff",strokeWidth:ce?3:2,opacity:j?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:$.card.title.length>20?$.card.title.substring(0,20)+"...":$.card.title})]},$.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Ap({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[d,m]=react.useState(false),[i,c]=react.useState(null),[l,u]=react.useState(null),b=react.useRef(null),y=d||o;react.useEffect(()=>{e&&b.current&&b.current.focus();},[e]),react.useEffect(()=>{let h=p=>{p.key==="Escape"&&!y&&C();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,y]);let C=()=>{y||(n(""),c(null),u(null),t());},g=async()=>{if(!(!s.trim()||y)){m(true),c(null),u(null);try{let h=await r(s.trim());u(h);}catch(h){c(h instanceof Error?h.message:"Failed to generate plan");}finally{m(false);}}},v=()=>{l&&(a(l),C());};return e?jsxRuntime.jsxs(it,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:C,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((h,p)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},p))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((h,p)=>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:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},p)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:b,value:s,onChange:h=>n(h.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:y}),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((h,p)=>jsxRuntime.jsx("button",{onClick:()=>n(h),disabled:y,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:h},p))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:C,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),l?jsxRuntime.jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:g,disabled:!s.trim()||y,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:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var vl={"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 Mv={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Fv={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 Av(e,t,a){let r=vl[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function nn(e){return `$${e.toFixed(4)}`}var xl=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Av(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,u)=>l+u.cost,0),s=a.reduce((l,u)=>l+u.inputTokens,0),n=a.reduce((l,u)=>l+u.outputTokens,0),d=a.filter(l=>l.success),m=a.reduce((l,u)=>l+u.duration,0),i={},c={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,c[l.feature]=(c[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?m/r:0,successRate:r>0?d.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 d=this.operations.filter(c=>c.timestamp>=n).length,m=Math.max(0,o-d),i=d/o*100;return {used:d,limit:o,remaining:m,percentUsed:i,isExceeded:d>=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)}},no=new xl;function Bp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(no.getStats()),[s,n]=react.useState(no.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(no.getStats()),n(no.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 d=no.getRecentOperations(5);return jsxRuntime.jsxs(it,{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:nn(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 c=r.costsByFeature[m]||0,l=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children: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:nn(c)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),d.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:d.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:nn(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 zp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,d]=react.useState(""),[m,i]=react.useState(""),[c,l]=react.useState(""),[u,b]=react.useState(false),[y,C]=react.useState(null),[g,v]=react.useState(null),[h,p]=react.useState(null),k=react.useRef(null),x=u||o;react.useEffect(()=>{e&&k.current&&k.current.focus();},[e]),react.useEffect(()=>{let L=N=>{N.key==="Escape"&&!x&&D();};if(e)return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[e,x]);let D=()=>{x||(d(""),i(""),l(""),C(null),v(null),p(null),t());},T=async()=>{if(!(!n.trim()||x)){b(true),C(null),v(null),p(null);try{let L=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:c||void 0});v(L.tasks.tasks),p({from_cache:L.from_cache,tokens_used:L.tokens_used,mock_mode:L.mock_mode,similarity:L.similarity,tokens_saved:L.tokens_saved});}catch(L){C(L instanceof Error?L.message:"Failed to generate tasks");}finally{b(false);}}},w=()=>{g&&(a(g),D());};if(!e)return null;let A=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(it,{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:L=>L.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:x,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:g?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.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"}),h?.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 (",A,"% 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:[h?.tokens_used||0," tokens"]}),h?.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:[h.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[g.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((L,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:L.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"})]}),L.start," \u2192 ",L.end]}),jsxRuntime.jsxs("span",{children:[L.duration," days"]}),L.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",L.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${L.priority==="high"?"bg-red-500/20 text-red-400":L.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:L.priority})]})},L.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:k,value:n,onChange:L=>d(L.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:x}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),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:L=>i(L.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:x})]}),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:c,onChange:L=>l(L.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:x})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),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((L,N)=>jsxRuntime.jsx("button",{onClick:()=>d(L),disabled:x,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:L},N))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:D,disabled:x,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?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:T,disabled:!n.trim()||x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Tasks"})]})]})]})})]})}function fs({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(g=>{t&&bn(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(v,h,p)=>{console.warn(`Retry attempt ${h} after ${p}ms: ${v.message}`);}}).then(v=>{v.success||console.error(`Failed to persist board after ${v.attempts} attempts:`,v.error);});},[t]),s=react.useCallback(async(g,v,h)=>{r(p=>{let k=p.cards.find(L=>L.id===g);if(!k)return p;let x=k.columnId,D={...k,columnId:v,position:h},T=p.cards.map(L=>L.id===g?D:L),w=p.columns.map(L=>{if(L.id===x)return {...L,cardIds:L.cardIds.filter(N=>N!==g)};if(L.id===v){let N=T.filter(H=>H.columnId===v).sort((H,$)=>H.position-$.position);return {...L,cardIds:N.map(H=>H.id)}}return L}),A={...p,cards:T,columns:w};return o(A),A});},[o]),n=react.useCallback(async(g,v)=>{r(h=>{let p=h.cards.map(x=>x.id===g?{...x,...v}:x),k={...h,cards:p};return o(k),k});},[o]),d=react.useCallback(async g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let p={...g,id:v},k=h.columns.map(D=>D.id===g.columnId?{...D,cardIds:[...D.cardIds,v]}:D),x={...h,cards:[...h.cards,p],columns:k};return o(x),x});},[o]),m=react.useCallback(async g=>{r(v=>{let h=v.cards.find(D=>D.id===g);if(!h)return v;let p=v.cards.filter(D=>D.id!==g),k=v.columns.map(D=>D.id===h.columnId?{...D,cardIds:D.cardIds.filter(T=>T!==g)}:D),x={...v,cards:p,columns:k};return o(x),x});},[o]),i=react.useCallback(async g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let p={...g,id:v,cardIds:[]},k={...h,columns:[...h.columns,p]};return o(k),k});},[o]),c=react.useCallback(async(g,v)=>{r(h=>{let p=h.columns.map(x=>x.id===g?{...x,...v}:x),k={...h,columns:p};return o(k),k});},[o]),l=react.useCallback(async g=>{r(v=>{let h=v.cards.filter(x=>x.columnId!==g),p=v.columns.filter(x=>x.id!==g),k={...v,cards:h,columns:p};return o(k),k});},[o]),u=react.useCallback(g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(g),v},[d]),b=react.useCallback(g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),v},[i]),y=react.useCallback(()=>{r(g=>{let v={...g,cards:[],columns:[]};return o(v),v});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:d,onCardDelete:m,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:l},setBoard:r,helpers:{addCard:u,addColumn:b,deleteCard:m,deleteColumn:l,clearBoard:y}}}function $p({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=fs({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(m,i,c={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(l=>l.columnId===m).length,...c});},addColumn:(m,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:m,position:i??c+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 sn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Wp={by:"none",order:"asc"};function Gp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...sn,...e}),[s,n]=react.useState({...Wp,...t}),d=react.useCallback(C=>{o(g=>({...g,...C}));},[]),m=react.useCallback(C=>{n(g=>({...g,...C}));},[]),i=react.useCallback(()=>{o(sn),n(Wp);},[]),c=react.useCallback(()=>{a&&o({...sn,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...sn,dateFilter:"overdue"});},[]),u=react.useCallback(()=>{o({...sn,priorities:["HIGH","URGENT"]});},[]),b=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]),y=react.useCallback(C=>{let g=[...C];if(r.search){let v=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(v)||h.description?.toLowerCase().includes(v));}if(r.dateFilter!=="all"){let v=new Date,h=v.getFullYear(),p=String(v.getMonth()+1).padStart(2,"0"),k=String(v.getDate()).padStart(2,"0"),x=`${h}-${p}-${k}`;g=g.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let T=D.endDate||D.dueDate;if(!T)return false;let w;if(typeof T=="string")w=T.split("T")[0]||T;else {let A=T.getUTCFullYear(),L=String(T.getUTCMonth()+1).padStart(2,"0"),N=String(T.getUTCDate()).padStart(2,"0");w=`${A}-${L}-${N}`;}switch(r.dateFilter){case "overdue":return w<x;case "today":return w===x;case "this-week":let A=new Date(x+"T00:00:00"),L=new Date(w+"T00:00:00"),N=new Date(A);return N.setDate(N.getDate()+7),L>=A&&L<=N;case "custom":if(r.dateRange){let H=typeof T=="string"?new Date(T):T;return H>=r.dateRange.start&&H<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(v=>v.priority&&r.priorities.includes(v.priority))),r.assignees.length>0&&(g=g.filter(v=>(v.assignedUserIds||(v.assigneeId?[v.assigneeId]:[])).some(p=>r.assignees.includes(p)))),r.labels.length>0&&(g=g.filter(v=>v.labels&&v.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(v=>r.columns.includes(v.columnId))),s.by!=="none"&&g.sort((v,h)=>{let p=0;switch(s.by){case "created":let k=v.createdAt?new Date(v.createdAt).getTime():0,x=h.createdAt?new Date(h.createdAt).getTime():0;p=k-x;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},T=D[v.priority||"LOW"],w=D[h.priority||"LOW"];p=T-w;break;case "dueDate":let A=v.endDate||v.dueDate,L=h.endDate||h.dueDate;if(!A)return 1;if(!L)return -1;let N=typeof A=="string"?new Date(A).getTime():A.getTime(),H=typeof L=="string"?new Date(L).getTime():L.getTime();p=N-H;break;case "title":p=v.title.localeCompare(h.title);break;case "estimate":let $=v.estimatedTime||0,j=h.estimatedTime||0;p=$-j;break;default:p=0;}return s.order==="asc"?p:-p}),g},[r,s]);return {filters:r,sort:s,setFilters:d,setSort:m,resetFilters:i,filterMyTasks:c,filterOverdue:l,filterHighPriority:u,applyFilters:y,hasActiveFilters:b}}var Vp,jp;if(typeof window<"u")try{let e=un("ai");Vp=e.generateObject,jp=e.generateText;}catch{}function Kp(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Vp&&jp&&e.apiKey),n=react.useCallback(async l=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",l),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(u){let b=u instanceof Error?u:new Error("Failed to generate plan");throw o(b),b}finally{a(false);}},[s]),d=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(u){let b=u instanceof Error?u:new Error("Failed to suggest assignee");throw o(b),b}finally{a(false);}},[s]),m=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("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(u){let b=u instanceof Error?u:new Error("Failed to predict risks");throw o(b),b}finally{a(false);}},[s]),i=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(u){let b=u instanceof Error?u:new Error("Failed to generate subtasks");throw o(b),b}finally{a(false);}},[s]),c=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(u){let b=u instanceof Error?u:new Error("Failed to estimate effort");throw o(b),b}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:d,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function wl(){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 Yp(e){let{cards:t}=e,[a,r]=wl(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,u)=>{if(!u){r({selectedCardIds:[l],lastSelectedCardId:l});return}let b=u.ctrlKey||u.metaKey,y=u.shiftKey;if(b)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(C=>C!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(y&&a.lastSelectedCardId){let C=t.find(v=>v.id===l),g=t.find(v=>v.id===a.lastSelectedCardId);if(C&&g&&C.columnId===g.columnId){let v=t.filter(w=>w.columnId===C.columnId).sort((w,A)=>w.position-A.position),h=v.findIndex(w=>w.id===a.lastSelectedCardId),p=v.findIndex(w=>w.id===l),[k,x]=h<p?[h,p]:[p,h],D=v.slice(k,x+1).map(w=>w.id),T=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:T,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(u=>u!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),d=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),c=react.useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:d,selectAll:m,toggleCard:i,getSelectedCards:c}}var qp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Xp(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...qp,...a}),[a]),[s,n]=react.useState([]),d=react.useCallback((C,g,v,h,p)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let k={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:C,cardIds:g,columnId:v,strategy:h,color:p,isExpanded:true,position:s.filter(x=>x.columnId===v).length,createdAt:new Date};n(x=>[...x,k]);},[o.minCardsPerStack,s]),m=react.useCallback(C=>{n(g=>g.filter(v=>v.id!==C));},[]),i=react.useCallback(C=>{n(g=>g.map(v=>v.id===C?{...v,isExpanded:!v.isExpanded}:v));},[]),c=react.useCallback((C,g)=>{n(v=>v.map(h=>h.id===C&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),l=react.useCallback((C,g)=>{n(v=>v.map(h=>{if(h.id===C){let p=h.cardIds.filter(k=>k!==g);return p.length<o.minCardsPerStack?null:{...h,cardIds:p}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),u=react.useCallback(C=>s.filter(g=>g.columnId===C).sort((g,v)=>g.position-v.position),[s]),b=react.useCallback(async C=>{let g=t.filter(x=>x.columnId===C);if(g.length<o.minCardsPerStack*2)return [];let v=[],h=new Map;g.forEach(x=>{x.labels&&x.labels.length>0&&x.labels.forEach(D=>{h.has(D)||h.set(D,[]),h.get(D).push(x);});}),h.forEach((x,D)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:x.map(T=>T.id),columnId:C,strategy:"labels",color:"#3b82f6"},reason:`${x.length} cards with label "${D}"`,confidence:.85});});let p=new Map;g.forEach(x=>{x.assignedUserIds&&x.assignedUserIds.length>0&&x.assignedUserIds.forEach(D=>{p.has(D)||p.set(D,[]),p.get(D).push(x);});}),p.forEach((x,D)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:x.map(T=>T.id),columnId:C,strategy:"assignee",color:"#8b5cf6"},reason:`${x.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(g.forEach(x=>{x.priority&&(k.has(x.priority)||k.set(x.priority,[]),k.get(x.priority).push(x));}),k.forEach((x,D)=>{if(x.length>=o.minCardsPerStack){let T={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";v.push({stack:{title:`${T} ${D} Priority`,cardIds:x.map(w=>w.id),columnId:C,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${x.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let x of g){let T=(await r.findSimilar(x,g)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(T.length>=o.minCardsPerStack-1){let w=[x.id,...T.map(L=>L.card.id)],A=T.reduce((L,N)=>L+N.similarity,0)/T.length;v.push({stack:{title:`\u2728 Similar to "${x.title.substring(0,30)}${x.title.length>30?"...":""}"`,cardIds:w,columnId:C,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${T.length+1} similar tasks`,confidence:A});}}return v.filter(x=>x.confidence>=o.autoStackConfidenceThreshold).sort((x,D)=>D.confidence-x.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(C=>{d(C.stack.title,C.stack.cardIds,C.stack.columnId,C.stack.strategy,C.stack.color);},[d]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let v=await b(g),h=v[0];v.length>0&&h&&h.confidence>=.9&&y(h);});},[]),{stacks:s,createStack:d,deleteStack:m,toggleStack:i,addToStack:c,removeFromStack:l,getStacksForColumn:u,getSuggestions:b,applySuggestion:y,config:o}}var Jp=react.createContext(null);function Zp({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}=un("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=un("@libxai/core");n.set(m.id,new i(m));});let d=null;if(t?.board){let{Board:m}=un("@libxai/core");d=new m(t.board);}r.current=new core.BoardStore({board:d,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Jp.Provider,{value:{store:o},children:e})}function bs(){let e=react.useContext(Jp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function dn(){let e=bs(),[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 d=react.useCallback(h=>{e.updateBoard(h);},[e]),m=react.useCallback(h=>{e.addColumn(h);},[e]),i=react.useCallback((h,p)=>{e.updateColumn(h,p);},[e]),c=react.useCallback(h=>{e.deleteColumn(h);},[e]),l=react.useCallback(h=>e.getColumn(h),[e]),u=react.useCallback(h=>{e.addCard(h);},[e]),b=react.useCallback((h,p)=>{e.updateCard(h,p);},[e]),y=react.useCallback(h=>{e.deleteCard(h);},[e]),C=react.useCallback((h,p,k)=>{e.moveCard(h,p,k);},[e]),g=react.useCallback(h=>e.getCard(h),[e]),v=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:d,addColumn:m,updateColumn:i,deleteColumn:c,getColumn:l,addCard:u,updateCard:b,deleteCard:y,moveCard:C,getCard:g,getCardsByColumn:v}}function eu(e){let{cards:t}=dn();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 tu(e="position",t="asc"){let{cards:a}=dn();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let d={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?d[o.priority]:0,i=s.priority?d[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 hs=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=td.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 d=await Promise.resolve(n.apply(s,a));d!==void 0&&(o=d,a[0]=d);}catch(d){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,d,{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);}},qv=new hs;function ru({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:d=0,getItemKey:m}){let i=react.useRef(null),c=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:d}),l=c.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},b=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:u,className:o,children:jsxRuntime.jsx("div",{style:b,children:l.map(y=>{let C=e[y.index];if(!C)return null;let g=m?m(C,y.index):y.index,v={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsxRuntime.jsx("div",{style:v,"data-index":y.index,children:r(C,y.index)},g)})})})}function ou(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 su({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:d=16,getItemKey:m,horizontal:i=true}){let c=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:d}),u=l.getVirtualItems(),b={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:c,style:b,className:s,children:jsxRuntime.jsx("div",{style:y,children:u.map(C=>{let g=e[C.index];if(!g)return null;let v=m?m(g,C.index):C.index,h={position:"absolute",top:0,left:C.start,width:C.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":C.index,children:o(g,C.index)},v)})})})}function iu(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 lu(e,t=10){return e>t}var Dl={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Sl={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},Pl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ml={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Fl={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Al={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Il={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)"},Ll={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)"},Bl={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Rl={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}},Ol={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}},ys={spacing:Dl,borderRadius:Sl,fontSize:El,fontWeight:Pl,lineHeight:Ml,zIndex:Fl,duration:Al,easing:Il,shadows:Ll,opacity:Bl,kanban:Rl,gantt:Ol};function du(e,t,a){return e[t]??a}function zl(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)?zl(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Zv(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Ul(e="asakaa"){let t=zl(ys),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Zv(o);a.push(` ${s}: ${n};`);}return `:root {
389
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function mm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function br(e,t){let a=mm(e),r=t.toLowerCase().trim(),o=a.find(d=>d.name.toLowerCase()===r);if(o)return o;let s=a.find(d=>d.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(d=>{let m=d.name.toLowerCase();return n.every(i=>m.includes(i))})}function Yi(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 p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}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 b={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(b!==void 0){let y=new Date(r),w=y.getDay(),g=b-w;return g<=0&&(g+=7),y.setDate(y.getDate()+g),y}}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 p=parseInt(s[1],10),b=s[2].toLowerCase(),y=new Date(r);return b==="day"||b==="d\xEDa"||b==="dias"?y.setDate(y.getDate()+p):b==="week"||b==="semana"||b==="semanas"?y.setDate(y.getDate()+p*7):(b==="month"||b==="mes"||b==="meses")&&y.setMonth(y.getMonth()+p),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let d=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(d&&d[1]&&d[2]&&d[3]){let p=parseInt(d[1],10),b=parseInt(d[2],10)-1,y=parseInt(d[3],10);return new Date(y,b,p)}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 p=parseInt(i[1],10),b=m[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(b!==void 0)return new Date(y,b,p)}let c={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let p=c[l[1].toLowerCase()],b=parseInt(l[2],10),y=l[3]?parseInt(l[3],10):r.getFullYear();if(p!==void 0)return new Date(y,p,b)}return null}function qi(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 Xi(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 pm(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 um(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(),c=r[2].trim(),l=br(t,i),p=Yi(c);if(!l)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let b=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(p);return y.setDate(y.getDate()+b),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:p,endDate:y},message:`Moved "${l.name}" to ${p.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(),c=o[2].trim(),l=br(t,i),p=qi(c);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let b=new Date(l.endDate);return b.setDate(b.getDate()+p),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:b},message:`Extended "${l.name}" by ${p} days. New end date: ${b.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(),c=s[2].trim(),l=br(t,i),p=Xi(c);return l?p===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:p},message:`Set "${l.name}" progress to ${p}%.`,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(),c=n[2].trim(),l=br(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:c},message:`Renamed "${l.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let d=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let i=d[1].trim(),c=d[2].trim(),l=br(t,i),p=br(t,c);return l?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:l.id,dependencyTo:p.id,message:`Linked "${l.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,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(),c=br(t,i);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.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 gm(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 S0(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 E0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Qn(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let l=a.find(p=>p.id===c);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>Qn(c,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(c=>c.type==="finish-to-start").map(c=>c.taskId));let n=c=>{if(c)return typeof c=="string"?new Date(c):c},d=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||d&&m&&Math.abs(m.getTime()-d.getTime())<=864e5;return {id:e.id,name:e.title,startDate:d,endDate:m,progress:e.progress||0,status:S0(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 fm(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:E0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function bm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Qn(r,e,t))}var Ji={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"}},Zi={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"}},es={en:Ji,es:Zi};function Qi(e){return es[e]||es.en}function ts(e,t){let a=Qi(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var el=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-blue-500"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-green-500"}];function hm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let p=b=>{d.current&&!d.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let m=el[0],i=el.find(p=>p.value===e)??m,c=i.icon,l=p=>{switch(p){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(c,{className:f("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(c,{className:f("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:el.map(p=>{let b=p.icon;return jsxRuntime.jsxs("button",{onClick:y=>{y.stopPropagation(),t(p.value),n(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===p.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(b,{className:f("w-4 h-4",p.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:l(p.value)})]},p.value)})})]})}var tl=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function vm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let c=l=>{d.current&&!d.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let m=tl.find(c=>c.value===e)??tl[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:tl.map(c=>jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),t(c.value),n(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===c.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-2 h-2 rounded-full",c.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},c.value))})]})}function os(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ns(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function km({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,d]=react.useState(false),[m,i]=react.useState(""),c=react.useRef(null);react.useEffect(()=>{let y=w=>{c.current&&!c.current.contains(w.target)&&(d(false),i(""));};return n&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]);let l=t.filter(y=>y.name.toLowerCase().includes(m.toLowerCase())||y.email?.toLowerCase().includes(m.toLowerCase())),p=y=>e.some(w=>w.name===y),b=y=>{if(a)if(p(y.name))a(e.filter(w=>w.name!==y.name));else {let w={name:y.name,initials:os(y.name),color:y.color||ns(y.name).replace("bg-","").replace("-500",""),avatar:y.avatarUrl};a([...e,w]);}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:f("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((y,w)=>jsxRuntime.jsx("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!y.avatar&&ns(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,title:y.name,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||os(y.name)},`${y.name}-${w}`)),e.length>3&&jsxRuntime.jsxs("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),d(!n);},className:f("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:f("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:f("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((y,w)=>jsxRuntime.jsx("div",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!y.avatar&&ns(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||os(y.name)},`${y.name}-${w}`)),e.length>2&&jsxRuntime.jsxs("span",{className:f("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:f("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-64",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsxRuntime.jsx("input",{type:"text",value:m,onChange:y=>i(y.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:f("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:y=>y.stopPropagation()})}),jsxRuntime.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:l.length===0?jsxRuntime.jsx("p",{className:f("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):l.map(y=>jsxRuntime.jsxs("button",{onClick:w=>{w.stopPropagation(),b(y);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!y.avatarUrl&&ns(y.name)),children:y.avatarUrl?jsxRuntime.jsx("img",{src:y.avatarUrl,alt:y.name,className:"w-full h-full rounded-full object-cover"}):os(y.name)}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:r?"text-white":"text-gray-900",children:y.name}),y.email&&jsxRuntime.jsx("div",{className:f("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:y.email})]}),p(y.name)&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},y.id))}),e.length>0&&jsxRuntime.jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((y,w)=>jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[y.name,jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),a(e.filter(v=>v.name!==y.name));},className:"hover:text-red-500",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},`${y.name}-${w}`))})]})]})}var Z0={en:["January","February","March","April","May","June","July","August","September","October","November","December"],es:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},Q0={en:["Su","Mo","Tu","We","Th","Fr","Sa"],es:["Do","Lu","Ma","Mi","Ju","Vi","S\xE1"]};function ss({value:e,onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),[d,m]=react.useState(()=>{if(e){let g=e instanceof Date?e:new Date(e);return new Date(g.getFullYear(),g.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),i=react.useRef(null),c=e?e instanceof Date?e:new Date(e):null,l=r==="es"?"es":"en";react.useEffect(()=>{let g=v=>{i.current&&!i.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let p=g=>g?g.toLocaleDateString(r==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-",b=(g,v)=>new Date(g,v+1,0).getDate(),y=(g,v)=>new Date(g,v,1).getDay(),w=()=>{let g=d.getFullYear(),v=d.getMonth(),h=b(g,v),u=y(g,v),k=new Date,x=[];for(let D=0;D<u;D++)x.push(jsxRuntime.jsx("div",{className:"w-8 h-8"},`empty-${D}`));for(let D=1;D<=h;D++){let T=new Date(g,v,D),C=c&&c.getDate()===D&&c.getMonth()===v&&c.getFullYear()===g,I=k.getDate()===D&&k.getMonth()===v&&k.getFullYear()===g;x.push(jsxRuntime.jsx("button",{onClick:L=>{L.stopPropagation(),t?.(T),n(false);},className:f("w-8 h-8 rounded-full text-sm transition-colors",C?"bg-[#3B82F6] text-white":I?a?"bg-white/10 text-white":"bg-gray-100 text-gray-900":a?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-900"),children:D},D));}return x};return o||!t?jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:p(c)}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:f("w-4 h-4",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:p(c)})]}),s&&jsxRuntime.jsxs("div",{className:f("absolute z-50 top-full left-0 mt-1 p-3 rounded-lg shadow-lg border",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(d.getFullYear(),d.getMonth()-1,1));},className:f("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:f("w-4 h-4",a?"text-white":"text-gray-600")})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium",a?"text-white":"text-gray-900"),children:[Z0[l][d.getMonth()]," ",d.getFullYear()]}),jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(d.getFullYear(),d.getMonth()+1,1));},className:f("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",a?"text-white":"text-gray-600")})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:Q0[l].map(g=>jsxRuntime.jsx("div",{className:f("w-8 h-6 text-xs flex items-center justify-center",a?"text-[#6B7280]":"text-gray-400"),children:g},g))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:w()}),jsxRuntime.jsxs("div",{className:"mt-3 pt-3 border-t flex gap-2",style:{borderColor:a?"rgba(255,255,255,0.1)":"#E5E7EB"},children:[jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),t?.(new Date),n(false);},className:f("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation();let v=new Date;v.setDate(v.getDate()+1),t?.(v),n(false);},className:f("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Ma\xF1ana":"Tomorrow"})]})]})]})}function Nm({value:e=0,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{onClick:s=>{if(r||!t)return;s.stopPropagation();let n=s.currentTarget.getBoundingClientRect(),d=s.clientX-n.left,m=Math.round(d/n.width*100),i=Math.max(0,Math.min(100,m));t(i);},className:f("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxRuntime.jsxs("span",{className:f("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function Em({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[d,m]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{m(e);},[e]);let c=()=>{d!==e&&t?.(d),n(false);},l=p=>{p.key==="Enter"?c():p.key==="Escape"&&(m(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:f("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:d,onChange:p=>m(p.target.value),onBlur:c,onKeyDown:l,onClick:p=>p.stopPropagation(),className:f("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:f("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Fm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false}){let[d,m]=react.useState(false),[i,c]=react.useState(e?.toString()||""),l=react.useRef(null);react.useEffect(()=>{d&&l.current&&(l.current.focus(),l.current.select());},[d]),react.useEffect(()=>{c(e?.toString()||"");},[e]);let p=()=>{let y=parseFloat(i);if(!isNaN(y)){let w=y;o!==void 0&&(w=Math.max(o,w)),s!==void 0&&(w=Math.min(s,w)),w!==e&&t?.(w);}m(false);},b=y=>{y.key==="Enter"?p():y.key==="Escape"&&(c(e?.toString()||""),m(false));};return n||!t?jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:e!==void 0?e:r}):d?jsxRuntime.jsx("input",{ref:l,type:"number",value:i,onChange:y=>c(y.target.value),onBlur:p,onKeyDown:b,onClick:y=>y.stopPropagation(),min:o,max:s,className:f("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),m(true);},className:f("text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",e===void 0&&(a?"text-[#6B7280]":"text-gray-400")),children:e!==void 0?e:r})}function Am({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,d]=react.useState(false),m=react.useRef(null);return react.useEffect(()=>{let i=c=>{m.current&&!m.current.contains(c.target)&&d(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:f("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),d(!n);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:f("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:f("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),d(false);},className:f("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function Lm({value:e=false,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsx("button",{onClick:s=>{s.stopPropagation(),!r&&t&&t(!e);},disabled:r||!t,className:f("w-5 h-5 rounded border-2 flex items-center justify-center transition-colors",e?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed"),children:e&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})})}function Om({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:f("text-sm",t?"text-[#6B7280]":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:f("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function ky(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function wy(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function Hm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:d,onColumnHide:m,onColumnSort:i,availableUsers:c=[]}){let l=react.useRef(null),p=r==="es"?Um.es:Um.en;if(react.useEffect(()=>{let v=u=>{l.current&&!l.current.contains(u.target)&&t();},h=u=>{u.key==="Escape"&&t();};return document.addEventListener("mousedown",v),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let b=()=>{if(!e.task)return [];let v=[];return o&&v.push({id:"edit",label:p.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),v.push({id:"sep1",label:"",icon:null,separator:true}),d&&(v.push({id:"status",label:p.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:p.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{d({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:p.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{d({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:p.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{d({...e.task,status:"completed",progress:100}),t();}}]}),v.push({id:"priority",label:p.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:p.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{d({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:p.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{d({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:p.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{d({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:p.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{d({...e.task,priority:"low"}),t();}}]}),c.length>0&&v.push({id:"assign",label:p.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:h.name.charAt(0).toUpperCase()}),onClick:()=>{let u=e.task.assignees||[],x=u.some(D=>D.name===h.name)?u.filter(D=>D.name!==h.name):[...u,{name:h.name,initials:ky(h.name),color:h.color||wy(h.name),avatar:h.avatarUrl}];d({...e.task,assignees:x}),t();}}))})),v.push({id:"sep2",label:"",icon:null,separator:true}),s&&v.push({id:"duplicate",label:p.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&v.push({id:"delete",label:p.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),v},y=()=>{if(!e.columnId)return [];let v=[];return i&&(v.push({id:"sort-asc",label:p.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),v.push({id:"sort-desc",label:p.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),m&&e.columnId!=="name"&&(v.push({id:"sep-hide",label:"",icon:null,separator:true}),v.push({id:"hide",label:p.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{m(e.columnId),t();}})),v},w=e.type==="task"?b():y(),g={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:l,style:g,className:f("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:w.map(v=>v.separator?jsxRuntime.jsx("div",{className:f("my-1 h-px",a?"bg-white/10":"bg-gray-200")},v.id):v.submenu?jsxRuntime.jsx(Cy,{item:v,isDark:a},v.id):jsxRuntime.jsxs("button",{onClick:v.onClick,className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",v.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:f(v.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:v.icon}),v.label]},v.id))})}function Cy({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:f("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(d=>jsxRuntime.jsxs("button",{onClick:d.onClick,className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:d.icon}),d.label]},d.id))})]})}var Um={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna"}};var _m={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"})},Uy=["name","status","priority","assignees","startDate","endDate","progress","tags"];function jm({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:d}){let[m,i]=react.useState(""),c=react.useRef(null),l=d==="es"?Vm.es:Vm.en;if(react.useEffect(()=>{if(!e)return;let v=setTimeout(()=>{let h=k=>{c.current&&!c.current.contains(k.target)&&t();},u=k=>{k.key==="Escape"&&t();};document.addEventListener("mousedown",h),document.addEventListener("keydown",u),c._cleanup=()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",u);};},100);return ()=>{clearTimeout(v),c._cleanup&&c._cleanup();}},[e,t]),!e)return null;let p=v=>l.columns[v]||v,b=v=>{if(v==="name")return;let h=a.map(u=>u.id===v?{...u,visible:!u.visible}:u);o(h);},y=(v,h)=>{let u=a.find(x=>x.type===v&&(!h||x.customFieldId===h));if(u){b(u.id);return}let k={id:h||v,type:v,label:h?r.find(x=>x.id===h)?.name||v:p(v),width:120,visible:true,sortable:true,resizable:true,customFieldId:h};o([...a,k]);},w=Uy.filter(v=>p(v).toLowerCase().includes(m.toLowerCase())),g=r.filter(v=>v.name.toLowerCase().includes(m.toLowerCase()));return jsxRuntime.jsxs("div",{ref:c,className:f("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:f("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("font-medium",n?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:f("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:f("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:f("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:m,onChange:v=>i(v.target.value),placeholder:l.searchPlaceholder,className:f("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:f("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.standardFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:w.map(v=>{let h=a.find(x=>x.type===v&&!x.customFieldId),u=h?.visible??false,k=v==="name";return jsxRuntime.jsxs("button",{onClick:()=>{k||(h?b(h.id):y(v));},disabled:k,className:f("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",k&&"opacity-50 cursor-not-allowed"),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded border flex items-center justify-center",u?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:u&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:_m[v]}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:p(v)})]},v)})})]}),g.length>0&&jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:f("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.customFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:g.map(v=>{let u=a.find(k=>k.customFieldId===v.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>y(v.type,v.id),className:f("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded border flex items-center justify-center",u?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:u&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:_m[v.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:v.name})]},v.id)})})]}),s&&jsxRuntime.jsx("div",{className:f("p-3 border-t",n?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:s,className:f("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-colors",n?"bg-[#3B82F6]/20 text-[#3B82F6] hover:bg-[#3B82F6]/30":"bg-blue-50 text-blue-600 hover:bg-blue-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.createField]})})]})}var Vm={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",createField:"Create custom field",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",createField:"Crear campo personalizado",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Yy=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function qm({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[d,m]=react.useState("text"),[i,c]=react.useState([""]),l=o==="es"?Ym.es:Ym.en;react.useEffect(()=>{e&&(n(""),m("text"),c([""]));},[e]),react.useEffect(()=>{let g=v=>{v.key==="Escape"&&t();};return e&&document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]);let p=()=>{if(!s.trim())return;let g={name:s.trim(),type:d};d==="dropdown"&&(g.options=i.filter(v=>v.trim())),a(g),t();},b=()=>{c([...i,""]);},y=(g,v)=>{let h=[...i];h[g]=v,c(h);},w=g=>{i.length>1&&c(i.filter((v,h)=>h!==g));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:f("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:f("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:f("text-lg font-semibold",r?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:f("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:f("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:g=>n(g.target.value),placeholder:l.fieldNamePlaceholder,className:f("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:Yy.map(g=>jsxRuntime.jsxs("button",{onClick:()=>m(g.type),className:f("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",d===g.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:d===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:g.icon}),jsxRuntime.jsx("span",{className:f("text-xs",d===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:l.types[g.type]})]},g.type))})]}),d==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((g,v)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:g,onChange:h=>y(v,h.target.value),placeholder:`${l.option} ${v+1}`,className:f("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>w(v),className:f("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},v)),jsxRuntime.jsxs("button",{onClick:b,className:f("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:f("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:f("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:l.cancel}),jsxRuntime.jsx("button",{onClick:p,disabled:!s.trim(),className:f("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:l.create})]})]})]}):null}var Ym={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Zm={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function Qm({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,d]=react.useState(false),m=react.useRef(null),i=react.useRef(0),c=s==="es"?Zm.es:Zm.en;react.useEffect(()=>{if(!n)return;let b=w=>{Date.now()-i.current<100||m.current&&!m.current.contains(w.target)&&d(false);},y=w=>{w.key==="Escape"&&d(false);};return document.addEventListener("mousedown",b),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",y);}},[n]);let l=[{value:"all",label:c.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),n||(i.current=Date.now()),d(y=>!y);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),c.filters,p&&jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:f("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:f("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:c.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:l.map(b=>{let y=e===b.value&&!t,w=()=>b.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):b.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(b.value),r(false),d(false);},className:f("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",y&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f(y?b.color:"text-gray-400","flex-shrink-0"),children:w()}),jsxRuntime.jsx("span",{className:f("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:b.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:f("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},b.value)})}),jsxRuntime.jsx("div",{className:f("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let b=!t;r(b),b&&a("all"),d(false);},className:f("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:f("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:f("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var mv=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function op(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(...op(r.subtasks,t+1));return a}function pv({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 np({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:d=[],customFields:m=[]}){let{theme:i="dark",locale:c="en",customTranslations:l,showSearch:p=true,showHierarchy:b=true,tableColumns:y,allowColumnCustomization:w=true,allowColumnResize:g=true,enableContextMenu:v=true,showCreateTaskButton:h=false,onCreateTask:u}=t,k=ts(c,l),x=i==="dark",[D,T]=react.useState("startDate"),[C,I]=react.useState("asc"),[L,N]=react.useState(""),[_,O]=react.useState("all"),[W,le]=react.useState(false),[de,pe]=react.useState(y||mv),[ke,Te]=react.useState(false),[xe,F]=react.useState(false),[R,S]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[B,G]=react.useState(null),[Z,ae]=react.useState(0),[ie,Fe]=react.useState(0),Q=react.useRef(null);react.useEffect(()=>{y&&pe(y);},[y]);let Ye=react.useMemo(()=>{let V=new Set;function Y(He){for(let Re of He)Re.subtasks?.length&&(Re.isExpanded!==false&&V.add(Re.id),Y(Re.subtasks));}return Y(e),V},[e]),Ne=react.useMemo(()=>de.filter(V=>V.visible),[de]),Ke=react.useCallback(V=>{a.onTaskToggleExpand?.(V);},[a]),Tt=react.useCallback(V=>{D===V?I(Y=>Y==="asc"?"desc":"asc"):(T(V),I("asc")),a.onSortChange?.({column:V,direction:C==="asc"?"desc":"asc"});},[D,C,a]),Et=react.useCallback(V=>{pe(V),a.onColumnsChange?.(V);},[a]),Ze=react.useCallback(V=>{let Y=de.map(He=>He.id===V?{...He,visible:false}:He);Et(Y);},[de,Et]),vt=react.useCallback((V,Y)=>{T(V),I(Y);},[]),bt=react.useCallback((V,Y,He)=>{v&&(V.preventDefault(),S({isOpen:true,x:V.clientX,y:V.clientY,type:Y?"task":"header",task:Y,columnId:He}));},[v]),Gt=react.useCallback(()=>{S(V=>({...V,isOpen:false}));},[]),ce=react.useCallback((V,Y)=>{if(!g)return;V.preventDefault(),V.stopPropagation();let He=de.find(Re=>Re.id===Y);He&&(G(Y),ae(V.clientX),Fe(He.width));},[de,g]);react.useEffect(()=>{if(!B)return;let V=He=>{let Re=He.clientX-Z,je=Math.max(50,ie+Re),We=de.map(se=>se.id===B?{...se,width:je}:se);pe(We);},Y=()=>{B&&a.onColumnsChange?.(de),G(null);};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",Y),()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",Y);}},[B,Z,ie,de,a]);let A=react.useCallback(async V=>{if(a.onCreateCustomField){let Y={...V,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Y);}F(false);},[a]),oe=react.useCallback(V=>V.progress===100||V.status==="completed"?"completed":V.progress&&V.progress>0||V.status==="in-progress"?"in-progress":"todo",[]),me=react.useMemo(()=>{let V=op(e);if(L.trim()){let Y=L.toLowerCase();V=V.filter(He=>He.name.toLowerCase().includes(Y));}return _!=="all"&&(V=V.filter(Y=>oe(Y)===_)),W&&(V=V.filter(Y=>oe(Y)!=="completed")),V.sort((Y,He)=>{let Re,je;switch(D){case "name":Re=Y.name.toLowerCase(),je=He.name.toLowerCase();break;case "startDate":Re=Y.startDate?.getTime()||0,je=He.startDate?.getTime()||0;break;case "endDate":Re=Y.endDate?.getTime()||0,je=He.endDate?.getTime()||0;break;case "progress":Re=Y.progress||0,je=He.progress||0;break;case "status":Re=Y.status||"todo",je=He.status||"todo";break;case "priority":let We={urgent:0,high:1,medium:2,low:3,none:4};Re=We[Y.priority]??4,je=We[He.priority]??4;break;default:return 0}return Re<je?C==="asc"?-1:1:Re>je?C==="asc"?1:-1:0}),V},[e,L,_,W,D,C,oe]),ze=react.useCallback((V,Y)=>{let He=We=>{a.onTaskUpdate?.({...V,...We});},Re=We=>We?V.customFields?.find(Ie=>Ie.fieldId===We)?.value:void 0,je=(We,se)=>{if(!We)return;let ee=[...V.customFields||[]],_e=ee.findIndex(Na=>Na.fieldId===We);_e>=0?ee[_e]={fieldId:We,value:se}:ee.push({fieldId:We,value:se}),He({customFields:ee});};switch(Y.type){case "name":return null;case "status":return jsxRuntime.jsx(hm,{value:V.status||(V.progress===100?"completed":V.progress&&V.progress>0?"in-progress":"todo"),onChange:se=>{He({status:se,progress:se==="completed"?100:se==="in-progress"?50:0});},isDark:x,locale:c,translations:k.status});case "priority":return jsxRuntime.jsx(vm,{value:V.priority,onChange:se=>He({priority:se}),isDark:x,locale:c});case "assignees":return jsxRuntime.jsx(km,{value:V.assignees||[],availableUsers:d,onChange:se=>He({assignees:se}),isDark:x,locale:c});case "startDate":return jsxRuntime.jsx(ss,{value:V.startDate,onChange:se=>He({startDate:se}),isDark:x,locale:c});case "endDate":return jsxRuntime.jsx(ss,{value:V.endDate,onChange:se=>He({endDate:se}),isDark:x,locale:c});case "progress":return jsxRuntime.jsx(Nm,{value:V.progress||0,onChange:se=>{let Ie=se===100?"completed":se>0?"in-progress":"todo";He({progress:se,status:Ie});},isDark:x});case "tags":return jsxRuntime.jsx(Om,{value:V.tags||[],isDark:x});case "text":return jsxRuntime.jsx(Em,{value:Re(Y.customFieldId)||"",onChange:se=>je(Y.customFieldId,se),isDark:x});case "number":return jsxRuntime.jsx(Fm,{value:Re(Y.customFieldId)||0,onChange:se=>je(Y.customFieldId,se),isDark:x});case "date":let We=Re(Y.customFieldId);return jsxRuntime.jsx(ss,{value:We?new Date(We):void 0,onChange:se=>je(Y.customFieldId,se),isDark:x,locale:c});case "dropdown":return jsxRuntime.jsx(Am,{value:Re(Y.customFieldId)||"",options:Y.options||[],onChange:se=>je(Y.customFieldId,se),isDark:x});case "checkbox":return jsxRuntime.jsx(Lm,{value:Re(Y.customFieldId)||false,onChange:se=>je(Y.customFieldId,se),isDark:x});default:return jsxRuntime.jsx("span",{className:f("text-sm",x?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,x,c,d,k]),X=react.useCallback(V=>({name:k.columns.name,status:k.columns.status,priority:k.columns.priority,assignees:k.columns.assignees,startDate:k.columns.startDate,endDate:k.columns.endDate,progress:k.columns.progress})[V.type]||V.label,[k]),Be=react.useMemo(()=>Ne.reduce((V,Y)=>V+Y.width,0)+(w?48:0),[Ne,w]);return r?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[k.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",x?"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",x?"bg-[#0F1117]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:k.empty.noTasks}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:k.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Q,className:f("flex-1 flex flex-col w-full h-full overflow-hidden",x?"bg-[#0F1117]":"bg-white",B&&"select-none",s),style:n,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(Qm,{value:_,hideCompleted:W,onChange:O,onHideCompletedChange:le,isDark:x,locale:c}),jsxRuntime.jsxs("div",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[me.length," ",k.pagination.tasks]}),p&&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",x?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:L,onChange:V=>N(V.target.value),placeholder:k.toolbar.searchPlaceholder,className:f("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",x?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),h&&u&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:k.toolbar.newTask})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsxs("div",{style:{minWidth:Be},children:[jsxRuntime.jsxs("div",{className:f("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",x?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[Ne.map(V=>jsxRuntime.jsxs("div",{className:f("relative flex items-center gap-2 px-4 py-3",x?"text-[#9CA3AF]":"text-gray-500"),style:{width:V.width,minWidth:V.minWidth},onContextMenu:Y=>bt(Y,void 0,V.id),children:[V.sortable?jsxRuntime.jsxs("button",{onClick:()=>Tt(V.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[X(V),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:f("w-3 h-3",D===V.id&&"text-[#3B82F6]")})]}):jsxRuntime.jsx("span",{children:X(V)}),g&&V.resizable&&jsxRuntime.jsx("div",{className:f("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",B===V.id&&"bg-[#3B82F6]"),onMouseDown:Y=>ce(Y,V.id)})]},V.id)),w&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsxRuntime.jsx("button",{onClick:V=>{V.stopPropagation(),Te(Y=>!Y);},className:f("p-1.5 rounded-lg transition-colors",x?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ke&&(x?"bg-white/10":"bg-gray-200")),title:c==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(jm,{isOpen:ke,onClose:()=>Te(false),columns:de,customFields:m,onColumnsChange:Et,onCreateCustomField:()=>{Te(false),F(true);},isDark:x,locale:c})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:me.map((V,Y)=>{let He=Ye.has(V.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:Y*.02},className:f("flex items-center border-b transition-colors",x?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(V),onDoubleClick:()=>a.onTaskDoubleClick?.(V),onContextMenu:Re=>bt(Re,V),children:[Ne.map(Re=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Re.width,minWidth:Re.minWidth},children:Re.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&V.level>0&&jsxRuntime.jsx("div",{style:{width:`${V.level*24}px`},className:"flex-shrink-0"}),b&&V.hasChildren&&jsxRuntime.jsx("button",{onClick:je=>{je.stopPropagation(),Ke(V.id);},className:f("p-0.5 rounded flex-shrink-0",x?"hover:bg-white/10":"hover:bg-gray-200"),children:He?jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")})}),b&&!V.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsx("button",{onClick:je=>{je.stopPropagation(),a.onTaskUpdate?.({...V,progress:V.progress===100?0:100,status:V.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(pv,{status:V.status,progress:V.progress})}),jsxRuntime.jsx("span",{className:f("truncate font-medium",x?"text-white":"text-gray-900",V.progress===100&&(x?"line-through text-[#6B7280]":"line-through text-gray-400")),children:V.name})]}):ze(V,Re)},Re.id)),w&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},V.id)})}),me.length===0&&L&&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",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f(x?"text-[#9CA3AF]":"text-gray-600"),children:k.empty.noResults})]})})]})}),jsxRuntime.jsx(Hm,{state:R,onClose:Gt,isDark:x,locale:c,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Ze,onColumnSort:vt,availableUsers:d}),jsxRuntime.jsx(qm,{isOpen:xe,onClose:()=>F(false),onSave:A,isDark:x,locale:c})]})}var sp=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true}],ip=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"}],lp=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var il={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"},ll={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"},dl={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"},ds={dark:il,light:ll,neutral:dl};function dp(e){return ds[e]||ds.dark}var cl={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"}},ml={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"}},cs={en:cl,es:ml};function tn(e){return cs[e]||cs.en}function ms(e,t){let a=tn(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 cp(e){let t=tn(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 mp(e,t=0,a=true){let r=tn(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 bp(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 ul(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 hp({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 vp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:d,availableTags:m=[],onCreateTag:i,attachmentsByTask:c,comments:l,onAddComment:p,currentUser:b,mentionableUsers:y,onUploadCommentAttachments:w,onTaskOpen:g}){let{theme:v="dark",locale:h="en",customTranslations:u}=t,k=ms(h,u),x=v==="dark",[D,T]=react.useState(r||new Date),[C,I]=react.useState(null),[L,N]=react.useState(null),[_,O]=react.useState({}),W=4,le=3,[de,pe]=react.useState(null),[ke,Te]=react.useState(""),[xe,F]=react.useState(void 0),[R,S]=react.useState(null),[B,G]=react.useState(false),[Z,ae]=react.useState(false),[ie,Fe]=react.useState(null),[Q,Ye]=react.useState(false),[Ne,Ke]=react.useState(new Date),Tt=react.useCallback(()=>{T(new Date(D.getFullYear(),D.getMonth()-1,1));},[D]),Et=react.useCallback(()=>{T(new Date(D.getFullYear(),D.getMonth()+1,1));},[D]),Ze=react.useCallback(()=>{T(new Date);},[]),vt=react.useMemo(()=>{let ce=D.getFullYear(),A=D.getMonth(),oe=new Date(ce,A,1),me=new Date(ce,A+1,0),ze=oe.getDay(),X=me.getDate(),Be=bp(e),V=new Date;V.setHours(0,0,0,0);let Y=[],He=ze,Re=new Date(ce,A,0).getDate();for(let We=He-1;We>=0;We--){let se=new Date(ce,A-1,Re-We);Y.push({date:se,isCurrentMonth:false,isToday:false,isWeekend:se.getDay()===0||se.getDay()===6,events:Be.filter(Ie=>ul(se,Ie)).map(Ie=>({id:Ie.id,title:Ie.name,start:Ie.startDate,end:Ie.endDate,task:Ie}))});}for(let We=1;We<=X;We++){let se=new Date(ce,A,We),Ie=se.getTime()===V.getTime();Y.push({date:se,isCurrentMonth:true,isToday:Ie,isWeekend:se.getDay()===0||se.getDay()===6,events:Be.filter(ee=>ul(se,ee)).map(ee=>({id:ee.id,title:ee.name,start:ee.startDate,end:ee.endDate,task:ee}))});}let je=42-Y.length;for(let We=1;We<=je;We++){let se=new Date(ce,A+1,We);Y.push({date:se,isCurrentMonth:false,isToday:false,isWeekend:se.getDay()===0||se.getDay()===6,events:Be.filter(Ie=>ul(se,Ie)).map(Ie=>({id:Ie.id,title:Ie.name,start:Ie.startDate,end:Ie.endDate,task:Ie}))});}return Y},[D,e]),bt=h==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Gt=D.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:d,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",x?"text-[#9CA3AF]":"text-gray-600"),children:[k.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:d,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",x?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",x?"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",x?"bg-[#0F1117]":"bg-white",n),style:d,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",x?"text-white":"text-gray-900"),children:k.labels.noEvents}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:k.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-auto",x?"bg-[#0F1117]":"bg-white",n),style:d,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",x?"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",x?"text-white":"text-gray-900"),children:Gt}),jsxRuntime.jsx("button",{onClick:Ze,className:f("px-3 py-1.5 text-sm rounded-lg transition-colors",x?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:k.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Tt,className:f("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:f("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:Et,className:f("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-5 h-5",x?"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:bt.map(ce=>jsxRuntime.jsx("div",{className:f("py-2 text-center text-xs font-medium uppercase",x?"text-[#9CA3AF]":"text-gray-500"),children:ce},ce))}),jsxRuntime.jsx("div",{className:f("grid grid-cols-7 auto-rows-min gap-px rounded-lg",x?"bg-[#2D2D2D]":"bg-gray-300"),children:vt.map((ce,A)=>{let oe=ce.date.getDay()===0||ce.date.getDay()===6;return jsxRuntime.jsxs("div",{className:f("min-h-[120px] p-2 transition-colors flex flex-col relative group",x?oe?"bg-[#1C1F26]":ce.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":oe?"bg-gray-100":ce.isCurrentMonth?"bg-white":"bg-gray-50",ce.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let me=_[A]||W,ze=ce.events.slice(0,me),X=ce.events.length-me;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[ze.map(Be=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{I(Be.task),a.onEventClick?.(Be),g?.(Be.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",Be.task.progress===100?x?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":x?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(hp,{task:Be.task}),jsxRuntime.jsx("span",{className:"truncate",children:Be.title})]})},Be.id)),X>0&&jsxRuntime.jsxs("button",{onClick:Be=>{Be.stopPropagation(),O(V=>({...V,[A]:me+le}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",X," ",h==="es"?"M\xC1S":"MORE"]}),me>W&&ce.events.length>W&&jsxRuntime.jsx("button",{onClick:Be=>{Be.stopPropagation(),O(V=>({...V,[A]:W}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:h==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let me=A>=28,ze=A%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),de===A?pe(null):(pe(A),Te(""),F(void 0),S(null),Fe(null),G(false),ae(false),Ye(false),Ke(ce.date));},className:f("w-5 h-5 rounded flex items-center justify-center transition-all",de===A?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",x?"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",de===A&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:de===A&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{pe(null),Te(""),F(void 0),S(null),Fe(null),G(false),ae(false),Ye(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:me?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:me?-5:5,scale:.95},transition:{duration:.12},className:f("absolute w-[320px] rounded-lg shadow-2xl z-50",me?"bottom-full mb-1":"top-full mt-1",ze?"right-0":"left-0",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>{X.stopPropagation(),G(false),ae(false),Ye(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:ke,onChange:X=>Te(X.target.value),placeholder:h==="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",x?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:X=>{if(X.key==="Enter"&&ke.trim()){let Be=t.availableUsers?.find(Y=>Y.id===R),V=ie||ce.date;a.onTaskCreate?.({name:ke.trim(),startDate:V,endDate:V,priority:xe,assignees:Be?[Be]:void 0}),Te(""),F(void 0),S(null),Fe(null),pe(null);}X.key==="Escape"&&(pe(null),Te(""),F(void 0),S(null),Fe(null));}})}),jsxRuntime.jsxs("div",{className:f("px-2.5 py-2 flex items-center justify-between border-t",x?"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:X=>{X.stopPropagation(),G(!B),ae(false);},className:f("p-1 rounded transition-colors",xe?xe==="urgent"||xe==="high"?"text-red-400 bg-red-500/20":xe==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":x?"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:B&&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]",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:h==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:h==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:h==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:h==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:h==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxRuntime.jsxs("button",{onClick:()=>{F(X.id),G(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",xe===X.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",X.color)}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:X=>{X.stopPropagation(),Ye(!Q),G(false),ae(false),Ke(ie||ce.date);},className:f("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",ie?"bg-[#7C3AED]/20 text-[#7C3AED]":x?"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"}),(ie||ce.date).toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Q&&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",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsx("div",{className:f("w-40 py-2 border-r",x?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,Be=new Date(X);Be.setDate(X.getDate()+1);let V=new Date(X);V.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let Y=new Date(X);Y.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let He=new Date(X);He.setDate(X.getDate()+14);let Re=new Date(X);return Re.setDate(X.getDate()+28),[{label:h==="es"?"Hoy":"Today",date:X,display:X.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Ma\xF1ana":"Tomorrow",date:Be,display:Be.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Este fin de semana":"This weekend",date:V,display:h==="es"?"s\xE1b.":"sat."},{label:h==="es"?"Pr\xF3xima semana":"Next week",date:Y,display:h==="es"?"lun.":"mon."},{label:h==="es"?"2 semanas":"2 weeks",date:He,display:He.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:h==="es"?"4 semanas":"4 weeks",date:Re,display:Re.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((We,se)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",x?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Fe(We.date),Ye(false);},children:[jsxRuntime.jsx("span",{children:We.label}),jsxRuntime.jsx("span",{className:f("text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:We.display})]},se))})()}),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",x?"text-white":"text-gray-900"),children:Ne.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Ke(new Date),className:f("px-1.5 py-0.5 rounded text-[10px] transition-colors",x?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:h==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Ke(new Date(Ne.getFullYear(),Ne.getMonth()-1)),className:f("p-0.5 rounded",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Ke(new Date(Ne.getFullYear(),Ne.getMonth()+1)),className:f("p-0.5 rounded",x?"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:(h==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsxRuntime.jsx("div",{className:f("w-6 h-6 flex items-center justify-center text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:X},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=Ne.getFullYear(),Be=Ne.getMonth(),V=new Date(X,Be,1).getDay(),Y=new Date(X,Be+1,0).getDate(),He=new Date(X,Be,0).getDate(),Re=new Date,je=[];for(let se=V-1;se>=0;se--)je.push({dayNum:He-se,isCurrentMonth:false,date:new Date(X,Be-1,He-se)});for(let se=1;se<=Y;se++)je.push({dayNum:se,isCurrentMonth:true,date:new Date(X,Be,se)});let We=42-je.length;for(let se=1;se<=We;se++)je.push({dayNum:se,isCurrentMonth:false,date:new Date(X,Be+1,se)});return je.map((se,Ie)=>{let ee=se.date.toDateString()===Re.toDateString(),_e=(ie||ce.date).toDateString()===se.date.toDateString();return jsxRuntime.jsx("button",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!se.isCurrentMonth&&(x?"text-[#4B5563]":"text-gray-300"),se.isCurrentMonth&&(x?"text-white":"text-gray-900"),ee&&"ring-1 ring-[#3B82F6]",_e&&"bg-[#7C3AED] text-white",!_e&&(x?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Fe(se.date),Ye(false);},children:se.dayNum},Ie)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),ae(!Z),G(false);},className:f("p-1 rounded transition-colors",R?"text-[#7C3AED] bg-[#7C3AED]/20":x?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:R?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(X=>X.id===R)?.color||"#7C3AED"},children:t.availableUsers?.find(X=>X.id===R)?.initials||t.availableUsers?.find(X=>X.id===R)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Z&&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",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{S(null),ae(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",!R&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded-full flex items-center justify-center",x?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:x?"text-[#9CA3AF]":"text-gray-500",children:h==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(X=>jsxRuntime.jsxs("button",{onClick:()=>{S(X.id),ae(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",R===X.id&&(x?"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:X.color||"#7C3AED"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:X.name})]},X.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:f("px-3 py-2 text-xs",x?"text-[#6B7280]":"text-gray-400"),children:h==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(ke.trim()){let X=t.availableUsers?.find(V=>V.id===R),Be=ie||ce.date;a.onTaskCreate?.({name:ke.trim(),startDate:Be,endDate:Be,priority:xe,assignees:X?[X]:void 0}),Te(""),F(void 0),S(null),Fe(null),pe(null);}},disabled:!ke.trim(),className:f("px-2.5 py-1 rounded text-xs font-medium transition-colors",ke.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":x?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:h==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:f("text-sm font-medium",ce.isToday?"text-[#3B82F6]":ce.isCurrentMonth?x?"text-white":"text-gray-900":x?"text-[#6B7280]":"text-gray-400"),children:ce.date.getDate()})]})]},A)})})]})}),jsxRuntime.jsx(mr,{task:C,isOpen:!!C,onClose:()=>I(null),onTaskUpdate:ce=>{a.onTaskUpdate?.(ce),I(ce);},theme:v==="dark"?"dark":"light",locale:h,availableUsers:t.availableUsers?.map(ce=>({id:ce.id,name:ce.name,avatar:ce.avatar,initials:ce.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:m,onCreateTag:i,attachments:C?c?.get(C.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:bp(e).filter(ce=>ce.id!==C?.id),comments:l?.filter(ce=>ce.taskId===C?.id).map(ce=>({...ce,createdAt:ce.createdAt instanceof Date?ce.createdAt:new Date(ce.createdAt),updatedAt:ce.updatedAt instanceof Date?ce.updatedAt:ce.updatedAt?new Date(ce.updatedAt):void 0})),onAddComment:p,currentUser:b,mentionableUsers:y,onUploadCommentAttachments:w}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>N(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className: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",x?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:f("px-4 py-3 border-b flex items-center justify-between",x?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:f("font-medium",x?"text-white":"text-gray-900"),children:L.date.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>N(null),className:f("p-1 rounded",x?"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:L.events.map(ce=>jsxRuntime.jsxs("button",{onClick:()=>{N(null),I(ce.task),g?.(ce.task.id);},className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",x?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(hp,{task:ce.task}),jsxRuntime.jsx("span",{className:f("text-sm truncate flex-1",x?"text-white":"text-gray-900"),children:ce.title}),ce.task.priority==="high"||ce.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},ce.id))})]})]})})]})}var gl={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"},fl={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"},bl={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"},ps={dark:gl,light:fl,neutral:bl};function xp(e){return ps[e]||ps.dark}function wv({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:d}){let[m,i]=react.useState(false),c=react.useMemo(()=>t.filter(b=>e.cardIds.includes(b.id)),[t,e.cardIds]),l=react.useMemo(()=>{let b=c.length,y=new Set(c.flatMap(v=>v.assignedUserIds||[])).size,w=c.map(v=>v.priority).filter(Boolean),g=new Set(c.flatMap(v=>v.labels||[])).size;return {totalCards:b,uniqueAssignees:y,priorities:w,labels:g}},[c]),p=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:f("card-stack",!e.isExpanded&&"card-stack-collapsed",d),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:p,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:l.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:b=>{b.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:c.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:c.map(b=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(b),children:a(b)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(b),children:[jsxRuntime.jsx("h4",{children:b.title}),b.description&&jsxRuntime.jsxs("p",{children:[b.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,b.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"})]})})]},b.id))})})]})}var wp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function rn(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 on(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 Cp(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 Tp({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:d}){let m=react.useMemo(()=>({...wp,...n}),[n]),[i,c]=react.useState(new Set),l=react.useRef(null),p=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(u=>{let k=u.timestamp.toISOString().split("T")[0],x=h.get(k);x?x.push(u):h.set(k,[u]);}),Array.from(h.entries()).sort((u,k)=>k[0].localeCompare(u[0])).map(([u,k])=>({date:new Date(u),events:k.sort((x,D)=>D.timestamp.getTime()-x.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:b,uniqueTypes:y}=react.useMemo(()=>{let h=new Set,u=new Set;return e.forEach(k=>{h.add(k.userId),u.add(k.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(u)}},[e]),w=h=>{c(u=>{let k=new Set(u);return k.has(h)?k.delete(h):k.add(h),k});},g=h=>{let k=new Date().getTime()-h.getTime(),x=Math.floor(k/6e4),D=Math.floor(k/36e5),T=Math.floor(k/864e5);return x<1?"just now":x<60?`${x}m ago`:D<24?`${D}h ago`:T<7?`${T}d ago`:h.toLocaleDateString()},v=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&l.current){let h=l.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:f("history-timeline-empty",d),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",d),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:h=>{let u=h.target.value;a({...t,types:u?[u]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(h=>jsxRuntime.jsxs("option",{value:h,children:[on(h)," ",h.replace("_"," ")]},h))]}),b.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let u=h.target.value;a({...t,users:u?[u]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),b.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),v>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",v,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:l,children:p.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((u,k)=>{let x=i.has(u.id),D=s===u.id,T=Cp(u.type);return jsxRuntime.jsxs("div",{"data-event-id":u.id,className:f("history-timeline-event",x&&"expanded",D&&"selected"),onClick:()=>o?.(u),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:T},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:on(u.type)})}),k<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:T}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&u.userAvatar&&jsxRuntime.jsx("img",{src:u.userAvatar,alt:u.userName||u.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:u.userName||u.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:rn(u)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?g(u.timestamp):u.timestamp.toLocaleString()})]}),Object.keys(u.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),w(u.id);},children:[x?"\u25BC":"\u25B6"," Show changes"]}),x&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(u.changes).map(([C,I])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(I.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(I.to)})]})]},C)),u.metadata&&Object.keys(u.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(u.metadata).map(([C,I])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(I)})]},C))]})]})]})]},u.id)})})]},h.date?.toISOString()||"all"))})]})}function Dp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:d,onSpeedChange:m,className:i}){let c=[.5,1,1.5,2,3],l=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=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:l&&on(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&rn(l)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:b=>d(parseInt(b.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((b,y)=>jsxRuntime.jsx("div",{className:f("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>d(y),title:rn(b)},b.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:c.map(b=>jsxRuntime.jsxs("button",{className:f("history-replay-speed-btn",e.speed===b&&"active"),onClick:()=>m(b),children:[b,"x"]},b))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(b=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:b},b))})]})]})]})]}):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 hl(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 yl(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 Sp(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 Ep(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Ev(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})),d=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(c=>{let l=a/2,p=r/2;c.vx+=(l-c.x)*o.centerForce*i,c.vy+=(p-c.y)*o.centerForce*i,n.forEach(b=>{if(c.id===b.id)return;let y=c.x-b.x,w=c.y-b.y,g=Math.sqrt(y*y+w*w)||1,v=o.chargeStrength*i/(g*g);c.vx+=y/g*v,c.vy+=w/g*v;});}),t.forEach(c=>{let l=d.get(typeof c.source=="string"?c.source:c.source.id),p=d.get(typeof c.target=="string"?c.target:c.target.id);if(!l||!p)return;let b=p.x-l.x,y=p.y-l.y,w=Math.sqrt(b*b+y*y)||1,g=(w-o.linkDistance)/w*o.forceStrength*i;l.vx+=b*g,l.vy+=y*g,p.vx-=b*g,p.vy-=y*g;}),n.forEach(c=>{c.fx!==null&&c.fx!==void 0?(c.x=c.fx,c.vx=0):c.x+=c.vx,c.fy!==null&&c.fy!==void 0?(c.y=c.fy,c.vy=0):c.y+=c.vy,c.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,c.x)),c.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,c.y)),c.vx*=.9,c.vy*=.9;});}return n}function Pp({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:d,className:m}){let i=react.useRef(null),[c,l]=react.useState([]),[p,b]=react.useState(null),[y,w]=react.useState(null),[g,v]=react.useState(null),[h,u]=react.useState(1),[k,x]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let O=Ev(e,t,a.width,a.height,a,150);l(O);},[e,t,a]);let D=react.useCallback((O,W)=>{a.enableDragging&&(W.stopPropagation(),b(O));},[a.enableDragging]),T=react.useCallback(O=>{if(!p||!i.current)return;let le=i.current.getBoundingClientRect(),de=(O.clientX-le.left-k.x)/h,pe=(O.clientY-le.top-k.y)/h;l(ke=>ke.map(Te=>Te.id===p?{...Te,x:de,y:pe,fx:de,fy:pe}:Te));},[p,h,k]),C=react.useCallback(()=>{b(null);},[]),I=react.useCallback((O,W)=>{W.stopPropagation(),d?.({type:"node-click",node:O,position:{x:W.clientX,y:W.clientY}});},[d]),L=react.useCallback((O,W)=>{W.stopPropagation(),d?.({type:"edge-click",edge:O,position:{x:W.clientX,y:W.clientY}});},[d]),N=react.useCallback(O=>{let W=c.find(le=>le.id===O);return W?{x:W.x,y:W.y}:{x:0,y:0}},[c]),_=react.useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let W=O.card.priority;return W==="URGENT"?"#ef4444":W==="HIGH"?"#f59e0b":W==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return O.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:()=>u(O=>Math.min(O+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>u(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{u(1),x({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:hl(O)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Sp(O)," ",yl(O)]})]},O))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:T,onMouseUp:C,onMouseLeave:C,children:[jsxRuntime.jsxs("g",{transform:`translate(${k.x}, ${k.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let W=N(typeof O.source=="string"?O.source:O.source.id),le=N(typeof O.target=="string"?O.target:O.target.id),de=Ep(O.type),pe=g===O.id,ke=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-edge",pe&&"hovered",ke&&"critical"),onMouseEnter:()=>v(O.id),onMouseLeave:()=>v(null),onClick:Te=>L(O,Te),children:[jsxRuntime.jsx("line",{x1:W.x,y1:W.y,x2:le.x,y2:le.y,stroke:hl(O.type),strokeWidth:ke?a.edgeWidth*2:a.edgeWidth,strokeOpacity:pe?1:.6,markerEnd:de?"url(#arrowhead)":void 0}),a.showEdgeLabels&&pe&&jsxRuntime.jsx("text",{x:(W.x+le.x)/2,y:(W.y+le.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:yl(O.type)})]},O.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:c.map(O=>{let W=y===O.id,le=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-node",W&&"hovered",le&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:de=>D(O.id,de),onMouseEnter:()=>w(O.id),onMouseLeave:()=>w(null),onClick:de=>I(O,de),children:[jsxRuntime.jsx("circle",{r:le?a.nodeSize*1.2:a.nodeSize,fill:_(O),stroke:le?"#fbbf24":"#ffffff",strokeWidth:le?3:2,opacity:W?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Ap({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[d,m]=react.useState(false),[i,c]=react.useState(null),[l,p]=react.useState(null),b=react.useRef(null),y=d||o;react.useEffect(()=>{e&&b.current&&b.current.focus();},[e]),react.useEffect(()=>{let h=u=>{u.key==="Escape"&&!y&&w();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,y]);let w=()=>{y||(n(""),c(null),p(null),t());},g=async()=>{if(!(!s.trim()||y)){m(true),c(null),p(null);try{let h=await r(s.trim());p(h);}catch(h){c(h instanceof Error?h.message:"Failed to generate plan");}finally{m(false);}}},v=()=>{l&&(a(l),w());};return e?jsxRuntime.jsxs(it,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:w}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:w,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((h,u)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},u))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((h,u)=>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:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},u)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:b,value:s,onChange:h=>n(h.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:y}),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((h,u)=>jsxRuntime.jsx("button",{onClick:()=>n(h),disabled:y,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:h},u))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:w,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),l?jsxRuntime.jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:g,disabled:!s.trim()||y,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:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var vl={"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 Mv={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Fv={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 Av(e,t,a){let r=vl[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function nn(e){return `$${e.toFixed(4)}`}var xl=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Av(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,p)=>l+p.cost,0),s=a.reduce((l,p)=>l+p.inputTokens,0),n=a.reduce((l,p)=>l+p.outputTokens,0),d=a.filter(l=>l.success),m=a.reduce((l,p)=>l+p.duration,0),i={},c={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,c[l.feature]=(c[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?m/r:0,successRate:r>0?d.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 d=this.operations.filter(c=>c.timestamp>=n).length,m=Math.max(0,o-d),i=d/o*100;return {used:d,limit:o,remaining:m,percentUsed:i,isExceeded:d>=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)}},no=new xl;function Bp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(no.getStats()),[s,n]=react.useState(no.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(no.getStats()),n(no.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 d=no.getRecentOperations(5);return jsxRuntime.jsxs(it,{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:nn(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 c=r.costsByFeature[m]||0,l=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children: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:nn(c)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),d.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:d.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:nn(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 zp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,d]=react.useState(""),[m,i]=react.useState(""),[c,l]=react.useState(""),[p,b]=react.useState(false),[y,w]=react.useState(null),[g,v]=react.useState(null),[h,u]=react.useState(null),k=react.useRef(null),x=p||o;react.useEffect(()=>{e&&k.current&&k.current.focus();},[e]),react.useEffect(()=>{let L=N=>{N.key==="Escape"&&!x&&D();};if(e)return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[e,x]);let D=()=>{x||(d(""),i(""),l(""),w(null),v(null),u(null),t());},T=async()=>{if(!(!n.trim()||x)){b(true),w(null),v(null),u(null);try{let L=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:c||void 0});v(L.tasks.tasks),u({from_cache:L.from_cache,tokens_used:L.tokens_used,mock_mode:L.mock_mode,similarity:L.similarity,tokens_saved:L.tokens_saved});}catch(L){w(L instanceof Error?L.message:"Failed to generate tasks");}finally{b(false);}}},C=()=>{g&&(a(g),D());};if(!e)return null;let I=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(it,{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:L=>L.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:x,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:g?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.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"}),h?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",I,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.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:[h.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[g.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((L,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:L.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"})]}),L.start," \u2192 ",L.end]}),jsxRuntime.jsxs("span",{children:[L.duration," days"]}),L.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",L.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${L.priority==="high"?"bg-red-500/20 text-red-400":L.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:L.priority})]})},L.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:k,value:n,onChange:L=>d(L.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:x}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),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:L=>i(L.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:x})]}),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:c,onChange:L=>l(L.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:x})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),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((L,N)=>jsxRuntime.jsx("button",{onClick:()=>d(L),disabled:x,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:L},N))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:D,disabled:x,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?jsxRuntime.jsx("button",{onClick:C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:T,disabled:!n.trim()||x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Tasks"})]})]})]})})]})}function fs({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(g=>{t&&bn(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(v,h,u)=>{console.warn(`Retry attempt ${h} after ${u}ms: ${v.message}`);}}).then(v=>{v.success||console.error(`Failed to persist board after ${v.attempts} attempts:`,v.error);});},[t]),s=react.useCallback(async(g,v,h)=>{r(u=>{let k=u.cards.find(L=>L.id===g);if(!k)return u;let x=k.columnId,D={...k,columnId:v,position:h},T=u.cards.map(L=>L.id===g?D:L),C=u.columns.map(L=>{if(L.id===x)return {...L,cardIds:L.cardIds.filter(N=>N!==g)};if(L.id===v){let N=T.filter(_=>_.columnId===v).sort((_,O)=>_.position-O.position);return {...L,cardIds:N.map(_=>_.id)}}return L}),I={...u,cards:T,columns:C};return o(I),I});},[o]),n=react.useCallback(async(g,v)=>{r(h=>{let u=h.cards.map(x=>x.id===g?{...x,...v}:x),k={...h,cards:u};return o(k),k});},[o]),d=react.useCallback(async g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let u={...g,id:v},k=h.columns.map(D=>D.id===g.columnId?{...D,cardIds:[...D.cardIds,v]}:D),x={...h,cards:[...h.cards,u],columns:k};return o(x),x});},[o]),m=react.useCallback(async g=>{r(v=>{let h=v.cards.find(D=>D.id===g);if(!h)return v;let u=v.cards.filter(D=>D.id!==g),k=v.columns.map(D=>D.id===h.columnId?{...D,cardIds:D.cardIds.filter(T=>T!==g)}:D),x={...v,cards:u,columns:k};return o(x),x});},[o]),i=react.useCallback(async g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let u={...g,id:v,cardIds:[]},k={...h,columns:[...h.columns,u]};return o(k),k});},[o]),c=react.useCallback(async(g,v)=>{r(h=>{let u=h.columns.map(x=>x.id===g?{...x,...v}:x),k={...h,columns:u};return o(k),k});},[o]),l=react.useCallback(async g=>{r(v=>{let h=v.cards.filter(x=>x.columnId!==g),u=v.columns.filter(x=>x.id!==g),k={...v,cards:h,columns:u};return o(k),k});},[o]),p=react.useCallback(g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(g),v},[d]),b=react.useCallback(g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),v},[i]),y=react.useCallback(()=>{r(g=>{let v={...g,cards:[],columns:[]};return o(v),v});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:d,onCardDelete:m,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:l},setBoard:r,helpers:{addCard:p,addColumn:b,deleteCard:m,deleteColumn:l,clearBoard:y}}}function $p({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=fs({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(m,i,c={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(l=>l.columnId===m).length,...c});},addColumn:(m,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:m,position:i??c+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 sn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Wp={by:"none",order:"asc"};function Gp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...sn,...e}),[s,n]=react.useState({...Wp,...t}),d=react.useCallback(w=>{o(g=>({...g,...w}));},[]),m=react.useCallback(w=>{n(g=>({...g,...w}));},[]),i=react.useCallback(()=>{o(sn),n(Wp);},[]),c=react.useCallback(()=>{a&&o({...sn,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...sn,dateFilter:"overdue"});},[]),p=react.useCallback(()=>{o({...sn,priorities:["HIGH","URGENT"]});},[]),b=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]),y=react.useCallback(w=>{let g=[...w];if(r.search){let v=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(v)||h.description?.toLowerCase().includes(v));}if(r.dateFilter!=="all"){let v=new Date,h=v.getFullYear(),u=String(v.getMonth()+1).padStart(2,"0"),k=String(v.getDate()).padStart(2,"0"),x=`${h}-${u}-${k}`;g=g.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let T=D.endDate||D.dueDate;if(!T)return false;let C;if(typeof T=="string")C=T.split("T")[0]||T;else {let I=T.getUTCFullYear(),L=String(T.getUTCMonth()+1).padStart(2,"0"),N=String(T.getUTCDate()).padStart(2,"0");C=`${I}-${L}-${N}`;}switch(r.dateFilter){case "overdue":return C<x;case "today":return C===x;case "this-week":let I=new Date(x+"T00:00:00"),L=new Date(C+"T00:00:00"),N=new Date(I);return N.setDate(N.getDate()+7),L>=I&&L<=N;case "custom":if(r.dateRange){let _=typeof T=="string"?new Date(T):T;return _>=r.dateRange.start&&_<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(v=>v.priority&&r.priorities.includes(v.priority))),r.assignees.length>0&&(g=g.filter(v=>(v.assignedUserIds||(v.assigneeId?[v.assigneeId]:[])).some(u=>r.assignees.includes(u)))),r.labels.length>0&&(g=g.filter(v=>v.labels&&v.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(v=>r.columns.includes(v.columnId))),s.by!=="none"&&g.sort((v,h)=>{let u=0;switch(s.by){case "created":let k=v.createdAt?new Date(v.createdAt).getTime():0,x=h.createdAt?new Date(h.createdAt).getTime():0;u=k-x;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},T=D[v.priority||"LOW"],C=D[h.priority||"LOW"];u=T-C;break;case "dueDate":let I=v.endDate||v.dueDate,L=h.endDate||h.dueDate;if(!I)return 1;if(!L)return -1;let N=typeof I=="string"?new Date(I).getTime():I.getTime(),_=typeof L=="string"?new Date(L).getTime():L.getTime();u=N-_;break;case "title":u=v.title.localeCompare(h.title);break;case "estimate":let O=v.estimatedTime||0,W=h.estimatedTime||0;u=O-W;break;default:u=0;}return s.order==="asc"?u:-u}),g},[r,s]);return {filters:r,sort:s,setFilters:d,setSort:m,resetFilters:i,filterMyTasks:c,filterOverdue:l,filterHighPriority:p,applyFilters:y,hasActiveFilters:b}}var Vp,jp;if(typeof window<"u")try{let e=un("ai");Vp=e.generateObject,jp=e.generateText;}catch{}function Kp(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Vp&&jp&&e.apiKey),n=react.useCallback(async l=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",l),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let b=p instanceof Error?p:new Error("Failed to generate plan");throw o(b),b}finally{a(false);}},[s]),d=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let b=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(b),b}finally{a(false);}},[s]),m=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("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(p){let b=p instanceof Error?p:new Error("Failed to predict risks");throw o(b),b}finally{a(false);}},[s]),i=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(p){let b=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(b),b}finally{a(false);}},[s]),c=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(p){let b=p instanceof Error?p:new Error("Failed to estimate effort");throw o(b),b}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:d,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function wl(){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 Yp(e){let{cards:t}=e,[a,r]=wl(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,p)=>{if(!p){r({selectedCardIds:[l],lastSelectedCardId:l});return}let b=p.ctrlKey||p.metaKey,y=p.shiftKey;if(b)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(w=>w!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(y&&a.lastSelectedCardId){let w=t.find(v=>v.id===l),g=t.find(v=>v.id===a.lastSelectedCardId);if(w&&g&&w.columnId===g.columnId){let v=t.filter(C=>C.columnId===w.columnId).sort((C,I)=>C.position-I.position),h=v.findIndex(C=>C.id===a.lastSelectedCardId),u=v.findIndex(C=>C.id===l),[k,x]=h<u?[h,u]:[u,h],D=v.slice(k,x+1).map(C=>C.id),T=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:T,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),d=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),c=react.useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:d,selectAll:m,toggleCard:i,getSelectedCards:c}}var qp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Xp(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...qp,...a}),[a]),[s,n]=react.useState([]),d=react.useCallback((w,g,v,h,u)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let k={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:w,cardIds:g,columnId:v,strategy:h,color:u,isExpanded:true,position:s.filter(x=>x.columnId===v).length,createdAt:new Date};n(x=>[...x,k]);},[o.minCardsPerStack,s]),m=react.useCallback(w=>{n(g=>g.filter(v=>v.id!==w));},[]),i=react.useCallback(w=>{n(g=>g.map(v=>v.id===w?{...v,isExpanded:!v.isExpanded}:v));},[]),c=react.useCallback((w,g)=>{n(v=>v.map(h=>h.id===w&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),l=react.useCallback((w,g)=>{n(v=>v.map(h=>{if(h.id===w){let u=h.cardIds.filter(k=>k!==g);return u.length<o.minCardsPerStack?null:{...h,cardIds:u}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),p=react.useCallback(w=>s.filter(g=>g.columnId===w).sort((g,v)=>g.position-v.position),[s]),b=react.useCallback(async w=>{let g=t.filter(x=>x.columnId===w);if(g.length<o.minCardsPerStack*2)return [];let v=[],h=new Map;g.forEach(x=>{x.labels&&x.labels.length>0&&x.labels.forEach(D=>{h.has(D)||h.set(D,[]),h.get(D).push(x);});}),h.forEach((x,D)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:x.map(T=>T.id),columnId:w,strategy:"labels",color:"#3b82f6"},reason:`${x.length} cards with label "${D}"`,confidence:.85});});let u=new Map;g.forEach(x=>{x.assignedUserIds&&x.assignedUserIds.length>0&&x.assignedUserIds.forEach(D=>{u.has(D)||u.set(D,[]),u.get(D).push(x);});}),u.forEach((x,D)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:x.map(T=>T.id),columnId:w,strategy:"assignee",color:"#8b5cf6"},reason:`${x.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(g.forEach(x=>{x.priority&&(k.has(x.priority)||k.set(x.priority,[]),k.get(x.priority).push(x));}),k.forEach((x,D)=>{if(x.length>=o.minCardsPerStack){let T={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";v.push({stack:{title:`${T} ${D} Priority`,cardIds:x.map(C=>C.id),columnId:w,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${x.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let x of g){let T=(await r.findSimilar(x,g)).filter(C=>C.similarity>=o.autoStackConfidenceThreshold);if(T.length>=o.minCardsPerStack-1){let C=[x.id,...T.map(L=>L.card.id)],I=T.reduce((L,N)=>L+N.similarity,0)/T.length;v.push({stack:{title:`\u2728 Similar to "${x.title.substring(0,30)}${x.title.length>30?"...":""}"`,cardIds:C,columnId:w,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${T.length+1} similar tasks`,confidence:I});}}return v.filter(x=>x.confidence>=o.autoStackConfidenceThreshold).sort((x,D)=>D.confidence-x.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(w=>{d(w.stack.title,w.stack.cardIds,w.stack.columnId,w.stack.strategy,w.stack.color);},[d]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let v=await b(g),h=v[0];v.length>0&&h&&h.confidence>=.9&&y(h);});},[]),{stacks:s,createStack:d,deleteStack:m,toggleStack:i,addToStack:c,removeFromStack:l,getStacksForColumn:p,getSuggestions:b,applySuggestion:y,config:o}}var Jp=react.createContext(null);function Zp({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}=un("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=un("@libxai/core");n.set(m.id,new i(m));});let d=null;if(t?.board){let{Board:m}=un("@libxai/core");d=new m(t.board);}r.current=new core.BoardStore({board:d,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Jp.Provider,{value:{store:o},children:e})}function bs(){let e=react.useContext(Jp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function dn(){let e=bs(),[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 d=react.useCallback(h=>{e.updateBoard(h);},[e]),m=react.useCallback(h=>{e.addColumn(h);},[e]),i=react.useCallback((h,u)=>{e.updateColumn(h,u);},[e]),c=react.useCallback(h=>{e.deleteColumn(h);},[e]),l=react.useCallback(h=>e.getColumn(h),[e]),p=react.useCallback(h=>{e.addCard(h);},[e]),b=react.useCallback((h,u)=>{e.updateCard(h,u);},[e]),y=react.useCallback(h=>{e.deleteCard(h);},[e]),w=react.useCallback((h,u,k)=>{e.moveCard(h,u,k);},[e]),g=react.useCallback(h=>e.getCard(h),[e]),v=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:d,addColumn:m,updateColumn:i,deleteColumn:c,getColumn:l,addCard:p,updateCard:b,deleteCard:y,moveCard:w,getCard:g,getCardsByColumn:v}}function eu(e){let{cards:t}=dn();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 tu(e="position",t="asc"){let{cards:a}=dn();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let d={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?d[o.priority]:0,i=s.priority?d[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 hs=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=td.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 d=await Promise.resolve(n.apply(s,a));d!==void 0&&(o=d,a[0]=d);}catch(d){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,d,{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);}},qv=new hs;function ru({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:d=0,getItemKey:m}){let i=react.useRef(null),c=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:d}),l=c.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},b=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:p,className:o,children:jsxRuntime.jsx("div",{style:b,children:l.map(y=>{let w=e[y.index];if(!w)return null;let g=m?m(w,y.index):y.index,v={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsxRuntime.jsx("div",{style:v,"data-index":y.index,children:r(w,y.index)},g)})})})}function ou(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 su({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:d=16,getItemKey:m,horizontal:i=true}){let c=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:d}),p=l.getVirtualItems(),b={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:c,style:b,className:s,children:jsxRuntime.jsx("div",{style:y,children:p.map(w=>{let g=e[w.index];if(!g)return null;let v=m?m(g,w.index):w.index,h={position:"absolute",top:0,left:w.start,width:w.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":w.index,children:o(g,w.index)},v)})})})}function iu(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 lu(e,t=10){return e>t}var Dl={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Sl={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},Pl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ml={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Fl={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Al={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Il={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)"},Ll={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)"},Bl={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Rl={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}},Ol={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}},ys={spacing:Dl,borderRadius:Sl,fontSize:El,fontWeight:Pl,lineHeight:Ml,zIndex:Fl,duration:Al,easing:Il,shadows:Ll,opacity:Bl,kanban:Rl,gantt:Ol};function du(e,t,a){return e[t]??a}function zl(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)?zl(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Zv(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Ul(e="asakaa"){let t=zl(ys),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Zv(o);a.push(` ${s}: ${n};`);}return `:root {
390
390
  ${a.join(`
391
391
  `)}
392
392
  }`}function cn(e,t="asakaa"){let a=[],r=zl(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
@@ -416,5 +416,5 @@ ${cn(Hl,"asakaa").split(`
416
416
  `)}
417
417
  }
418
418
  `}var Qv=({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 mu({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=wo();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,d])=>{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 ${d.displayName} theme`,"aria-pressed":i,title:d.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Qv,{theme:m})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:d.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=Bp;exports.AI_FEATURES=Fv;exports.AI_MODELS=vl;exports.AddCardButton=Js;exports.AddColumnButton=Xs;exports.AttachmentUploader=nr;exports.BoardProvider=Zp;exports.BulkOperationsToolbar=Mn;exports.BurnDownChart=di;exports.CUSTOM_FIELD_TYPES=lp;exports.CalendarBoard=vp;exports.Card=cr;exports.CardDetailModal=ri;exports.CardDetailModalV2=si;exports.CardHistoryReplay=Dp;exports.CardHistoryTimeline=Tp;exports.CardRelationshipsGraph=Pp;exports.CardStack=wv;exports.CardTemplateSelector=bi;exports.CircuitBreaker=Fs;exports.Column=bo;exports.ColumnManager=On;exports.CommandPalette=ei;exports.ConfigMenu=xi;exports.ContextMenu=No;exports.DEFAULT_SHORTCUTS=Ko;exports.DEFAULT_TABLE_COLUMNS=sp;exports.DEFAULT_TEMPLATES=fi;exports.DateRangePicker=Ro;exports.DependenciesSelector=zo;exports.DependencyLine=Vn;exports.DistributionCharts=ci;exports.EditableColumnTitle=Us;exports.ErrorBoundary=yo;exports.ExportImportModal=yi;exports.FilterBar=vi;exports.GANTT_AI_SYSTEM_PROMPT=dm;exports.GanttAIAssistant=Xn;exports.GanttBoard=om;exports.GanttI18nContext=To;exports.GanttMilestone=Kn;exports.GanttToolbar=Rn;exports.GenerateGanttTasksDialog=zp;exports.GeneratePlanModal=Ap;exports.GroupBySelector=ui;exports.KanbanBoard=Er;exports.KanbanToolbar=Ys;exports.KanbanViewAdapter=_o;exports.KeyboardShortcutsHelp=gi;exports.ListView=np;exports.MenuIcons=It;exports.PluginManager=hs;exports.PrioritySelector=jr;exports.RATE_LIMITS=Mv;exports.STANDARD_FIELDS=ip;exports.SwimlaneBoardView=mi;exports.TagBadge=Hs;exports.TagList=Od;exports.TagPicker=Nr;exports.TaskBar=Wn;exports.TaskDetailModal=mr;exports.TaskFormModal=lm;exports.TaskGrid=$n;exports.ThemeModal=Ti;exports.ThemeProvider=Cc;exports.ThemeSwitcher=mu;exports.Timeline=qn;exports.UserAssignmentSelector=Yr;exports.VelocityChart=li;exports.VirtualGrid=su;exports.VirtualList=ru;exports.aiUsageTracker=no;exports.borderRadius=Sl;exports.calculatePosition=fn;exports.calendarDarkTheme=gl;exports.calendarEnTranslations=cl;exports.calendarEsTranslations=ml;exports.calendarLightTheme=fl;exports.calendarNeutralTheme=bl;exports.calendarThemes=ps;exports.calendarTranslations=cs;exports.cardToGanttTask=Qn;exports.cardsToGanttTasks=bm;exports.cn=f;exports.createKanbanView=ac;exports.createRetryWrapper=zu;exports.darkTheme=ki;exports.darkTokenTheme=vs;exports.defaultTheme=An;exports.designTokens=ys;exports.duration=Al;exports.easing=Il;exports.exportTokensToCSS=cu;exports.findTaskByName=br;exports.fontSize=El;exports.fontWeight=Pl;exports.formatCost=nn;exports.ganttEnTranslations=Ln;exports.ganttEsTranslations=Nc;exports.ganttTaskToCardUpdate=fm;exports.ganttThemes=qe;exports.ganttTokens=Ol;exports.ganttTranslations=Ni;exports.ganttUtils=xe;exports.generateCSSVariables=Ul;exports.generateCompleteCSS=Wl;exports.generateInitialPositions=Lu;exports.generateTasksContext=cm;exports.generateThemeVariables=cn;exports.getCalendarTheme=xp;exports.getCalendarTranslations=tn;exports.getListViewTheme=dp;exports.getListViewTranslations=Qi;exports.getMonthNames=cp;exports.getToken=du;exports.getTranslations=Dc;exports.getWeekdayNames=mp;exports.kanbanTokens=Rl;exports.lightTheme=wi;exports.lightTokenTheme=$l;exports.lineHeight=Ml;exports.listViewDarkTheme=il;exports.listViewEnTranslations=Ji;exports.listViewEsTranslations=Zi;exports.listViewLightTheme=ll;exports.listViewNeutralTheme=dl;exports.listViewThemes=ds;exports.listViewTranslations=es;exports.mergeCalendarTranslations=ms;exports.mergeListViewTranslations=ts;exports.mergeTranslations=Di;exports.neutralTheme=Ci;exports.neutralTokenTheme=Hl;exports.opacity=Bl;exports.parseLocalCommand=um;exports.parseNaturalDate=Yi;exports.parseNaturalDuration=qi;exports.parseProgress=Xi;exports.parseStatus=pm;exports.pluginManager=qv;exports.retrySyncOperation=Ou;exports.retryWithBackoff=bn;exports.shadows=Ll;exports.shouldVirtualizeGrid=lu;exports.spacing=Dl;exports.themes=eo;exports.useAI=Kp;exports.useBoard=$p;exports.useBoardCore=dn;exports.useBoardStore=bs;exports.useCardStacking=Xp;exports.useDragState=js;exports.useFilteredCards=eu;exports.useFilters=Gp;exports.useGanttI18n=Ir;exports.useKanbanState=fs;exports.useKeyboardShortcuts=xc;exports.useMultiSelect=Yp;exports.useSelectionState=wl;exports.useSortedCards=tu;exports.useTheme=wo;exports.useVirtualGrid=iu;exports.useVirtualList=ou;exports.validateAIResponse=gm;exports.withErrorBoundary=Zs;exports.wouldCreateCircularDependency=yn;exports.zIndex=Fl;//# 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=Bp;exports.AI_FEATURES=Fv;exports.AI_MODELS=vl;exports.AddCardButton=Js;exports.AddColumnButton=Xs;exports.AttachmentUploader=nr;exports.BoardProvider=Zp;exports.BulkOperationsToolbar=Mn;exports.BurnDownChart=di;exports.CUSTOM_FIELD_TYPES=lp;exports.CalendarBoard=vp;exports.Card=cr;exports.CardDetailModal=ri;exports.CardDetailModalV2=si;exports.CardHistoryReplay=Dp;exports.CardHistoryTimeline=Tp;exports.CardRelationshipsGraph=Pp;exports.CardStack=wv;exports.CardTemplateSelector=bi;exports.CircuitBreaker=Fs;exports.Column=bo;exports.ColumnManager=On;exports.CommandPalette=ei;exports.ConfigMenu=xi;exports.ContextMenu=No;exports.DEFAULT_SHORTCUTS=Ko;exports.DEFAULT_TABLE_COLUMNS=sp;exports.DEFAULT_TEMPLATES=fi;exports.DateRangePicker=Ro;exports.DependenciesSelector=zo;exports.DependencyLine=Vn;exports.DistributionCharts=ci;exports.EditableColumnTitle=Us;exports.ErrorBoundary=yo;exports.ExportImportModal=yi;exports.FilterBar=vi;exports.GANTT_AI_SYSTEM_PROMPT=dm;exports.GanttAIAssistant=Xn;exports.GanttBoard=om;exports.GanttI18nContext=To;exports.GanttMilestone=Kn;exports.GanttToolbar=Rn;exports.GenerateGanttTasksDialog=zp;exports.GeneratePlanModal=Ap;exports.GroupBySelector=ui;exports.KanbanBoard=Er;exports.KanbanToolbar=Ys;exports.KanbanViewAdapter=_o;exports.KeyboardShortcutsHelp=gi;exports.ListView=np;exports.MenuIcons=It;exports.PluginManager=hs;exports.PrioritySelector=jr;exports.RATE_LIMITS=Mv;exports.STANDARD_FIELDS=ip;exports.SwimlaneBoardView=mi;exports.TagBadge=Hs;exports.TagList=Od;exports.TagPicker=Nr;exports.TaskBar=Wn;exports.TaskDetailModal=mr;exports.TaskFormModal=lm;exports.TaskGrid=$n;exports.ThemeModal=Ti;exports.ThemeProvider=Cc;exports.ThemeSwitcher=mu;exports.Timeline=qn;exports.UserAssignmentSelector=Yr;exports.VelocityChart=li;exports.VirtualGrid=su;exports.VirtualList=ru;exports.aiUsageTracker=no;exports.borderRadius=Sl;exports.calculatePosition=fn;exports.calendarDarkTheme=gl;exports.calendarEnTranslations=cl;exports.calendarEsTranslations=ml;exports.calendarLightTheme=fl;exports.calendarNeutralTheme=bl;exports.calendarThemes=ps;exports.calendarTranslations=cs;exports.cardToGanttTask=Qn;exports.cardsToGanttTasks=bm;exports.cn=f;exports.createKanbanView=ac;exports.createRetryWrapper=zu;exports.darkTheme=ki;exports.darkTokenTheme=vs;exports.defaultTheme=An;exports.designTokens=ys;exports.duration=Al;exports.easing=Il;exports.exportTokensToCSS=cu;exports.findTaskByName=br;exports.fontSize=El;exports.fontWeight=Pl;exports.formatCost=nn;exports.ganttEnTranslations=Ln;exports.ganttEsTranslations=Nc;exports.ganttTaskToCardUpdate=fm;exports.ganttThemes=qe;exports.ganttTokens=Ol;exports.ganttTranslations=Ni;exports.ganttUtils=ve;exports.generateCSSVariables=Ul;exports.generateCompleteCSS=Wl;exports.generateInitialPositions=Lu;exports.generateTasksContext=cm;exports.generateThemeVariables=cn;exports.getCalendarTheme=xp;exports.getCalendarTranslations=tn;exports.getListViewTheme=dp;exports.getListViewTranslations=Qi;exports.getMonthNames=cp;exports.getToken=du;exports.getTranslations=Dc;exports.getWeekdayNames=mp;exports.kanbanTokens=Rl;exports.lightTheme=wi;exports.lightTokenTheme=$l;exports.lineHeight=Ml;exports.listViewDarkTheme=il;exports.listViewEnTranslations=Ji;exports.listViewEsTranslations=Zi;exports.listViewLightTheme=ll;exports.listViewNeutralTheme=dl;exports.listViewThemes=ds;exports.listViewTranslations=es;exports.mergeCalendarTranslations=ms;exports.mergeListViewTranslations=ts;exports.mergeTranslations=Di;exports.neutralTheme=Ci;exports.neutralTokenTheme=Hl;exports.opacity=Bl;exports.parseLocalCommand=um;exports.parseNaturalDate=Yi;exports.parseNaturalDuration=qi;exports.parseProgress=Xi;exports.parseStatus=pm;exports.pluginManager=qv;exports.retrySyncOperation=Ou;exports.retryWithBackoff=bn;exports.shadows=Ll;exports.shouldVirtualizeGrid=lu;exports.spacing=Dl;exports.themes=eo;exports.useAI=Kp;exports.useBoard=$p;exports.useBoardCore=dn;exports.useBoardStore=bs;exports.useCardStacking=Xp;exports.useDragState=js;exports.useFilteredCards=eu;exports.useFilters=Gp;exports.useGanttI18n=Ir;exports.useKanbanState=fs;exports.useKeyboardShortcuts=xc;exports.useMultiSelect=Yp;exports.useSelectionState=wl;exports.useSortedCards=tu;exports.useTheme=wo;exports.useVirtualGrid=iu;exports.useVirtualList=ou;exports.validateAIResponse=gm;exports.withErrorBoundary=Zs;exports.wouldCreateCircularDependency=yn;exports.zIndex=Fl;//# sourceMappingURL=index.cjs.map
420
420
  //# sourceMappingURL=index.cjs.map