@libxai/board 0.17.167 → 0.17.169

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
- 'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),Ad=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion'),cmdk=require('cmdk'),Dm=require('react-markdown'),Nm=require('remark-gfm'),Sm=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Ad__default=/*#__PURE__*/_interopDefault(Ad);var Dm__default=/*#__PURE__*/_interopDefault(Dm);var Nm__default=/*#__PURE__*/_interopDefault(Nm);var Sm__default=/*#__PURE__*/_interopDefault(Sm);var Po=(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 Mo=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 [Mo.Translate.toString(e),Mo.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function w(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Ao(e,t){return e===null&&t===null?1e3:e===null&&t!==null?t/2:e!==null&&t===null?e+1e3:e!==null&&t!==null?(e+t)/2:1e3}function op(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Fn(e,t){return e.length===0?1e3:t===0?Ao(null,e[0].position):t>=e.length?Ao(e[e.length-1].position,null):Ao(e[t-1].position,e[t].position)}function zi(e,t=100){return e>t}var np=e=>{if(e.message.includes("network")||e.message.includes("fetch"))return true;if("status"in e){let t=e.status;return t>=500||t===429}return false};function sp(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function Io(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:l=np,onRetry:c}=t,p,n=0;for(let m=1;m<=a;m++){n=m;try{return {data:await e(),attempts:n,success:!0}}catch(d){if(p=d,m===a||!l(p,m))return {error:p,attempts:n,success:false};let u=sp(m,r,o,s);if(c)try{c(p,m,u);}catch(v){console.error("Error in retry callback:",v);}await new Promise(v=>setTimeout(v,u));}}return {error:p||new Error("Unknown error"),attempts:n,success:false}}function ip(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(o){if(a=o,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function lp(e,t={}){return async(...a)=>Io(()=>e(...a),t)}var Bn=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 $i=(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))($i||{}),dr=class dr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...l}=t,c=`[${a}] [${r}] [${s}]`,p=Object.keys(l).length>0;switch(r){case "DEBUG":console.debug(c,o,p?l:"");break;case "INFO":console.info(c,o,p?l:"");break;case "WARN":console.warn(c,o,p?l:"");break;case "ERROR":console.error(c,o,p?l:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...dr.globalOptions};}static configure(t){dr.globalOptions={...dr.globalOptions,...t};}child(t){return new dr({...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 Lo((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Lo(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:$i[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};dr.globalOptions={};var Rn=dr,Lo=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}},Ui=new Rn;function cp(e,t){let a={board:{id:e.id,title:e.title,metadata:e.metadata,exportedAt:new Date().toISOString()},columns:e.columns,cards:e.cards,options:t};return JSON.stringify(a,null,2)}function pp(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let l=e.columns.find(c=>c.id===s.columnId);return [s.id,On(s.title),On(s.description||""),On(l?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
2
- `)}async function mp(e,t,a){let r=t;if(!r){let l=document.querySelector(".asakaa-board");l&&(r=l.parentElement||l);}if(r)try{let l=await Ad__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),c=l.toDataURL("image/png"),p=297,n=210,m=l.width/l.height,d=p-20,i=d/m;i>n-20&&(i=n-20,d=i*m);let u=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});u.setFontSize(16),u.setTextColor(255,255,255),u.setFillColor(10,10,10),u.rect(0,0,p,15,"F"),u.text(e.title||"Kanban Board",10,10);let v=(p-d)/2;return u.addImage(c,"PNG",v,20,d,i),u}catch(l){console.error("Error capturing board:",l);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(l=>{let c=e.cards.filter(p=>p.columnId===l.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(l.title,20,s),s+=8,c.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):c.forEach(p=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(p.title,25,s),s+=6,p.description){o.setFontSize(9),o.setFont("helvetica","normal");let m=o.splitTextToSize(p.description,160);o.text(m,25,s),s+=m.length*5;}let n=[];if(p.priority&&n.push(`Priority: ${p.priority}`),p.labels&&p.labels.length>0&&n.push(`Labels: ${p.labels.join(", ")}`),p.assignedUserIds&&p.assignedUserIds.length>0&&n.push(`Assigned: ${p.assignedUserIds.length} user(s)`),p.startDate||p.endDate){let m=[];p.startDate&&m.push(`Start: ${p.startDate}`),p.endDate&&m.push(`End: ${p.endDate}`),n.push(m.join(" \u2192 "));}n.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(n.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function On(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function Hi(e,t,a,r){switch(t){case "json":return cp(e,r);case "csv":return pp(e);case "pdf":return await mp(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Gi(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let m=`${r}.pdf`;e.save(m);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,l={json:"application/json",csv:"text/csv",pdf:"application/pdf"},c=new Blob([e],{type:l[t]}),p=URL.createObjectURL(c),n=document.createElement("a");n.href=p,n.download=s,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(p);}function up(e){try{let t=JSON.parse(e);if(!t.board||!t.columns||!t.cards)return {success:!1,errors:["Invalid JSON format: missing required fields (board, columns, cards)"]};let a={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:a.cards.length,columnsImported:a.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function gp(e){try{let t=e.trim().split(`
4
- `);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=_i(t[0]),r=[],o=new Map,s=[];for(let l=1;l<t.length;l++)try{let c=_i(t[l]||"");if(c.length>a.length){s.push(`Line ${l+1}: Too many columns`);continue}if(a.length-c.length>3){s.push(`Line ${l+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let n={};a.forEach((u,v)=>{n[u]=c[v]||"";});let m=n.Column||"Unnamed";o.has(m)||o.set(m,{id:`col-${o.size+1}`,title:m,position:o.size+1,cardIds:[]});let d=o.get(m),i={id:n["Card ID"]||`card-${l}`,title:n.Title||"Untitled",description:n.Description?n.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:n.Priority||void 0,labels:n.Labels?n.Labels.split(";").filter(Boolean):void 0,assignedUserIds:n["Assigned Users"]?n["Assigned Users"].split(";").filter(Boolean):void 0,startDate:n["Start Date"]?n["Start Date"]:void 0,endDate:n["End Date"]?n["End Date"]:void 0,createdAt:n["Created At"]?n["Created At"]:void 0,updatedAt:n["Updated At"]?n["Updated At"]:void 0};r.push(i),d.cardIds.push(i.id);}catch(c){s.push(`Line ${l+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function _i(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],l=e[o+1];s==='"'&&r&&l==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Vi(e,t){switch(t){case "json":return up(e);case "csv":return gp(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function ji(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 zn=react.createContext(null);function Ki(){return react.useContext(zn)}var Yi=react.createContext(null);function qi({children:e,themeName:t}){return jsxRuntime.jsx(Yi.Provider,{value:{themeName:t},children:e})}function Mr(){return react.useContext(Yi)}function at({children:e,container:t}){let[a,r]=react.useState(false),o=Ki(),s=Mr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let l=t||(typeof document<"u"?document.body:null);if(!l)return null;if(o){let{theme:c,themeName:p}=o,n={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":p,"data-gantt-portal":"true",style:n,children:e}),l)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),l):reactDom.createPortal(e,l)}var el={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},wp="#BDC3C7",Cp=({color:e})=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function cr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,l]=react.useState({top:0,left:0}),c=react.useRef(null),p=react.useRef(null),n=()=>{if(!p.current)return;let u=p.current.getBoundingClientRect(),v=window.innerHeight,b=window.innerWidth,g=160,x=220,h=4,f=u.right-g;f<10&&(f=u.left),f+g>b-10&&(f=b-g-10);let k=v-u.bottom,T=u.top,N;k>=x+h?N=u.bottom+h:T>=x+h?N=u.top-x-h:N=k>=T?u.bottom+h:Math.max(10,u.top-x-h),l({top:N,left:f}),o(true);};react.useEffect(()=>{let u=v=>{c.current&&!c.current.contains(v.target)&&!p.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),react.useEffect(()=>{let u=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let m=u=>{t(u),o(false);},d=e?el[e]:null,i=d?.color||wp;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>r?o(false):n(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${i}10`:"transparent",boxShadow:e?`0 0 0 2px ${i}30 inset`:"none"},title:d?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:i,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(at,{children:jsxRuntime.jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(el).map(([u,v])=>jsxRuntime.jsxs("button",{onClick:()=>m(u),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:v.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Cp,{color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:v.label}),e===u&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},u)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>m(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:u=>{u.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:u=>{u.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Tp=[{label:"Today",days:0},{label:"Tomorrow",days:1},{label:"Next Week",days:7},{label:"2 Weeks",days:14},{label:"4 Weeks",days:28},{label:"8 Weeks",days:56}];function Zr({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[l,c]=react.useState({top:0,left:0}),p=react.useRef(null),n=react.useRef(null),i=(Mr()?.themeName||"dark")==="dark",u=()=>{if(!n.current)return;let f=n.current.getBoundingClientRect(),k=window.innerHeight,T=window.innerWidth,N=320,A=380,C=4,W=f.left;W+N>T-10&&(W=T-N-10),W<10&&(W=10);let D=k-f.bottom,y=f.top,M;D>=A+C?M=f.bottom+C:y>=A+C?M=f.top-A-C:M=D>=y?f.bottom+C:Math.max(10,f.top-A-C),c({top:M,left:W}),s(true);};react.useEffect(()=>{let f=k=>{p.current&&!p.current.contains(k.target)&&!n.current?.contains(k.target)&&s(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),react.useEffect(()=>{let f=k=>{k.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let v=f=>{let k=new Date,T=W=>{let D=W.getFullYear(),y=String(W.getMonth()+1).padStart(2,"0"),M=String(W.getDate()).padStart(2,"0");return `${D}-${y}-${M}`},N=T(k),A=new Date(k);A.setDate(A.getDate()+f);let C=T(A);a(N,C),s(false);},b=()=>{if(!e||!t)return "Set date";let f=A=>{if(A instanceof Date)return A;if(typeof A!="string"||!A.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=A.split("-").map(Number);if(C.length!==3||C.some(M=>isNaN(M)))return null;let W=C[0],D=C[1],y=C[2];return W===void 0||D===void 0||y===void 0?null:new Date(W,D-1,y)},k=f(e),T=f(t);if(!k||!T||isNaN(k.getTime())||isNaN(T.getTime()))return "Set date";let N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${N[k.getMonth()]} ${k.getDate()} \u2013 ${N[T.getMonth()]} ${T.getDate()}`},g=e&&t,h=(()=>{if(!t)return false;let f=typeof t=="string"?new Date(t):t,k=new Date;return k.setHours(0,0,0,0),f<k})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o?s(false):u(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:g?`${b()}`:"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:b()})]}),o&&jsxRuntime.jsx(at,{children:jsxRuntime.jsxs("div",{ref:p,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,background:i?"#1A1D25":"#FFFFFF",border:`1px solid ${i?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:i?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:i?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:Tp.map(f=>jsxRuntime.jsx("button",{onClick:()=>v(f.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",k.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:k=>{k.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",k.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:f.label},f.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:f=>a(f.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:f=>a(e,f.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function mr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,l]=react.useState(false),[c,p]=react.useState(""),[n,m]=react.useState({top:0,left:0}),d=react.useRef(null),i=react.useRef(null),u=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),f=window.innerHeight,k=window.innerWidth,T=300,N=380,A=4,C=h.right-T;C<10&&(C=h.left),C+T>k-10&&(C=k-T-10);let W=f-h.bottom,D=h.top,y;W>=N+A?y=h.bottom+A:D>=N+A?y=h.top-N-A:y=W>=D?h.bottom+A:Math.max(10,h.top-N-A),m({top:y,left:C}),l(true);};react.useEffect(()=>{let h=f=>{d.current&&!d.current.contains(f.target)&&!i.current?.contains(f.target)&&(l(false),p(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&(l(false),p(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let v=h=>{let f=e.some(k=>k.id===h.id);a(f?e.filter(k=>k.id!==h.id):[...e,h]);},b=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),g=e.slice(0,o),x=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>s?l(false):u(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[g.map(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)),x>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",x]})]}):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(at,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:c,onChange:h=>p(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:b.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"}):b.map(h=>{let f=e.some(k=>k.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>v(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:f?"#3b82f6":"transparent"},children:f?"\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([]),l(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Fo(e,t,a){let r=new Map;e.forEach(p=>{if(p.dependencies&&Array.isArray(p.dependencies)){let n=p.dependencies.map(m=>{if(typeof m=="string")return m;let d=m;return d.taskId||d.targetId||""}).filter(Boolean);r.set(p.id,n);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,l=new Set,c=p=>{if(!s.has(p)){s.add(p),l.add(p);let n=r.get(p)||[];for(let m of n){if(!s.has(m)&&c(m))return true;if(l.has(m))return true}}return l.delete(p),false};return c(a)}function eo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:l}){let[c,p]=react.useState(false),[n,m]=react.useState(""),[d,i]=react.useState(t.length>0),[u,v]=react.useState({top:0,left:0}),[b,g]=react.useState(null),x=react.useRef(null),h=react.useRef(null),f=()=>{if(!h.current)return;let C=h.current.getBoundingClientRect(),W=window.innerHeight,D=window.innerWidth,y=300,M=d?380:120,S=4,H=C.right-y;H<10&&(H=C.left),H+y>D-10&&(H=D-y-10);let Y=W-C.bottom,de=C.top,he;Y>=M+S?he=C.bottom+S:de>=M+S?he=C.top-M-S:he=Y>=de?C.bottom+S:Math.max(10,C.top-M-S),v({top:he,left:H}),p(true);};react.useEffect(()=>{if(!c||!h.current)return;let C=h.current.getBoundingClientRect(),W=window.innerHeight,D=window.innerWidth,y=300,M=d?380:120,S=4,H=C.right-y;H<10&&(H=C.left),H+y>D-10&&(H=D-y-10);let Y=W-C.bottom,de=C.top,he;Y>=M+S?he=C.bottom+S:de>=M+S?he=C.top-M-S:he=Y>=de?C.bottom+S:Math.max(10,C.top-M-S),v({top:he,left:H});},[d,c]),react.useEffect(()=>{let C=W=>{x.current&&!x.current.contains(W.target)&&!h.current?.contains(W.target)&&(p(false),m(""));};if(c)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]),react.useEffect(()=>{let C=W=>{W.key==="Escape"&&(p(false),m(""));};if(c)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[c]);let k=C=>{let W=t.includes(C),D=a.find(y=>y.id===C);if(g(null),W){let y=t.filter(M=>M!==C);r(y),y.length===0&&i(false);}else {if(s&&Fo(a,C,e)){let M=`Cannot add "${D?.title||C}" as dependency - would create circular reference`;g(M),l?.(C,D?.title||C),setTimeout(()=>g(null),3e3);return}r([...t,C]),i(true);}},T=()=>{let C=!d;i(C),C||r([]);},N=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(n.toLowerCase())||C.id.toLowerCase().includes(n.toLowerCase())),A=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:h,onClick:()=>c?p(false):f(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:A,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:A},children:t.length})]}),c&&jsxRuntime.jsx(at,{children:jsxRuntime.jsxs("div",{ref:x,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${u.top}px`,left:`${u.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[b&&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:b})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:T,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:n,onChange:C=>m(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:N.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"}):N.map(C=>{let W=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:D=>{D.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:D=>{D.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:W?"#3b82f6":"transparent",borderColor:W?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:W&&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([]),i(false),p(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 Ga=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:l,availableUsers:c=[],allCards:p=[]})=>{let{attributes:n,listeners:m,setNodeRef:d,transform:i,transition:u,isDragging:v}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),b={transform:Mo.Transform.toString(i),transition:u};if(t)return jsxRuntime.jsx("div",{ref:d,style:b,...n,...m,onClick:()=>a?.(e),children:t(e)});let g=c.filter(f=>e.assignedUserIds?.includes(f.id)),x=e.progress===100,h={...b,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:h,className:w("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...n,...m,onClick:f=>{f.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:f=>{f.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:x?"line-through":"none",opacity:x?.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:f=>f.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(cr,{priority:e.priority,onChange:f=>l?.(e.id,{priority:f})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Zr,{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:(f,k)=>l?.(e.id,{startDate:f,endDate:k})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(mr,{assignedUsers:g,availableUsers:c,onChange:f=>l?.(e.id,{assignedUserIds:f.map(k=>k.id)})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(eo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(f=>typeof f=="string"?f:f.taskId):[],availableTasks:p,onChange:f=>l?.(e.id,{dependencies:f})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(f=>jsxRuntime.jsx("span",{className:"asakaa-label",children:f},f))}),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));Ga.displayName="Card";var Bo={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"}},cl=({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 pl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[l,c]=react.useState({top:0,left:0}),p=react.useRef(null),n=react.useRef(null),m=[...Object.entries(Bo).map(([g,x])=>({id:g,label:x.label,color:x.color,icon:x.icon})),...r.filter(g=>!Object.keys(Bo).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let g=Bo[e];if(g)return {...g,id:e};let x=r.find(h=>h.id===e);return x?{id:x.id,label:x.title,color:x.color||"#8B5CF6",icon:"circle-dot"}:{...Bo.todo,id:"todo"}},i=()=>{if(!n.current)return;let g=n.current.getBoundingClientRect(),x=window.innerHeight,h=window.innerWidth,f=180,k=280,T=4,N=g.right-f;N<10&&(N=g.left),N+f>h-10&&(N=h-f-10);let A=x-g.bottom,C=g.top,W;A>=k+T?W=g.bottom+T:C>=k+T?W=g.top-k-T:W=A>=C?g.bottom+T:Math.max(10,g.top-k-T),c({top:W,left:N}),s(true);};react.useEffect(()=>{let g=x=>{p.current&&!p.current.contains(x.target)&&!n.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let u=g=>{t(g),s(false);},v=d(),b=v.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:n,onClick:()=>o?s(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${b}10`,boxShadow:`0 0 0 2px ${b}30 inset`},title:v.label,children:jsxRuntime.jsx(cl,{icon:v.icon,color:b})}),o&&jsxRuntime.jsx(at,{children:jsxRuntime.jsxs("div",{ref:p,className:"status-selector-menu",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:m.map(g=>jsxRuntime.jsxs("button",{onClick:()=>u(g.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:g.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(cl,{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 ml({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,l]=react.useState(false),[c,p]=react.useState(false),[n,m]=react.useState(e),[d,i]=react.useState({top:0,left:0}),u=react.useRef(null),v=react.useRef(null),b=react.useRef(null);react.useEffect(()=>{if(s&&v.current){let f=v.current.getBoundingClientRect();i({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[s]),react.useEffect(()=>{let f=k=>{u.current&&!u.current.contains(k.target)&&!v.current?.contains(k.target)&&(l(false),p(false));};if(s)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),react.useEffect(()=>{let f=k=>{k.key==="Escape"&&(l(false),p(false),m(e));};if(s)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[s,e]),react.useEffect(()=>{c&&b.current&&(b.current.focus(),b.current.select());},[c]);let g=()=>{p(true),m(e);},x=()=>{let f=n.trim();f&&f!==e&&t(f),p(false),l(false),m(e);},h=f=>{f.key==="Enter"?x():f.key==="Escape"&&(p(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>l(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsxRuntime.jsx(at,{children:jsxRuntime.jsx("div",{ref:u,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:c?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:b,type:"text",value:n,onChange:f=>m(f.target.value),onKeyDown:h,onBlur:x,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:g,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),l(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var Lr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:l,onCardUpdate:c,availableUsers:p,allCards:n,enableVirtualization:m,cardHeight:d=120,isCollapsed:i,onToggleCollapse:u,onColumnRename:v,onColumnDelete:b,isDeletable:g=false,className:x})=>{let{setNodeRef:h,isOver:f}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),k=react.useRef(null),T=m??zi(t.length),N=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>d,enabled:T});if(a)return jsxRuntime.jsx("div",{ref:h,className:x,children:a(e,t)});let C=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let y=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:y}:y>=80?{state:"warning",percentage:y}:y>=60?{state:"approaching",percentage:y}:{state:"ok",percentage:y}})(),W=C.state==="exceeded",D=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:w("asakaa-column",f&&"ring-2 ring-asakaa-accent-blue",W&&"ring-2 ring-asakaa-accent-red",x),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:w(D()),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"})]})]}),(v||b)&&jsxRuntime.jsx(ml,{columnTitle:e.title,onRename:y=>v?.(e.id,y),onDelete:b?()=>b(e.id):void 0,isDeletable:g}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":i?"Expand column":"Collapse column",children:i?"\u25B6":"\u25BC"})]})]}),!i&&jsxRuntime.jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:T?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(y=>y.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):T?jsxRuntime.jsx("div",{style:{height:`${N.getTotalSize()}px`,position:"relative"},children:N.getVirtualItems().map(y=>{let M=t[y.index];return M?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${y.start}px)`},children:jsxRuntime.jsx(Ga,{card:M,render:r,onClick:l,onUpdate:c,availableUsers:p,allCards:n})},M.id):null})}):t.map(y=>jsxRuntime.jsx(Ga,{card:y,render:r,onClick:l,onUpdate:c,availableUsers:p,allCards:n},y.id))})})]})});Lr.displayName="Column";function Gn({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,l]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let p=()=>{let m=s.trim();m&&m!==e?t(m):l(e),o(false);},n=m=>{m.key==="Enter"?p():m.key==="Escape"&&(l(e),o(false));};return r?jsxRuntime.jsx("input",{ref:c,type:"text",value:s,onChange:m=>l(m.target.value),onBlur:p,onKeyDown:n,className:w("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:w("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Vn(){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 Qa({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:l,style:c,isLoading:p,error:n,children:m}){let[d,i]=Vn(),u=o?.theme||"dark",b=u==="dark"||u==="neutral"?"dark":"",g=react.useCallback((D,y)=>{t.onCardUpdate?.(D,y);},[t]),x=react.useCallback((D,y)=>{t.onColumnUpdate?.(D,{title:y});},[t]),h=react.useCallback(D=>{t.onColumnDelete?.(D);},[t]),f=["todo","in-progress","completed"],k=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),T=react.useMemo(()=>{let D=new Map;return e.columns.forEach(y=>{let M=y.cardIds.map(S=>e.cards.find(H=>H.id===S)).filter(S=>S!==void 0).sort((S,H)=>S.position-H.position);D.set(y.id,M);}),D},[e.cards,e.columns]),N=react.useCallback(D=>{let{active:y}=D,M=e.cards.find(S=>S.id===y.id);M&&i({isDragging:true,draggedCardId:M.id,sourceColumnId:M.columnId,targetColumnId:M.columnId});},[e.cards,i]),A=react.useCallback(D=>{let{active:y,over:M}=D;if(!M||!e.cards.find(Y=>Y.id===y.id))return;let H=null;M.data.current?.type==="column"?H=M.id:M.data.current?.type==="card"&&(H=e.cards.find(de=>de.id===M.id)?.columnId||null),H&&H!==d.targetColumnId&&i({...d,targetColumnId:H});},[e.cards,d,i]),C=react.useCallback(async D=>{let{active:y,over:M}=D;if(i({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!M)return;let S=e.cards.find(he=>he.id===y.id);if(!S)return;let H,Y;if(M.data.current?.type==="column"){H=M.id;let he=T.get(H)||[];Y=Fn(he,0);}else {let he=e.cards.find(R=>R.id===M.id);if(!he)return;H=he.columnId;let Ie=T.get(H)||[],Le=Ie.findIndex(R=>R.id===M.id);Y=Fn(Ie,Le);}let de=e.columns.find(he=>he.id===H);if(de&&de.wipLimit&&de.wipLimitType==="hard"){let he=T.get(H)||[];if(S.columnId!==H&&he.length>=de.wipLimit){t.onWipLimitExceeded?.(de,S);return}}(S.columnId!==H||S.position!==Y)&&await t.onCardMove?.(S.id,H,Y);},[e.cards,e.columns,T,t,i]),W=react.useCallback(D=>{a?.(D);},[a]);return p?jsxRuntime.jsx("div",{className:w("asakaa-board",b,l),style:c,children:jsxRuntime.jsx(Yp,{columnCount:3})}):n?jsxRuntime.jsx("div",{className:w("asakaa-board",b,l),style:c,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof n=="string"?n:n.message})]})})}):jsxRuntime.jsx(qi,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:k,collisionDetection:core$1.closestCorners,onDragStart:N,onDragOver:A,onDragEnd:C,children:[jsxRuntime.jsxs("div",{className:w("asakaa-board",b,l),style:c,"data-theme":u,children:[e.columns.sort((D,y)=>D.position-y.position).map(D=>{let y=T.get(D.id)||[],M=!f.includes(D.id);return jsxRuntime.jsx(Lr,{column:D,cards:y,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:W,onCardUpdate:g,onColumnRename:x,onColumnDelete:h,isDeletable:M,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},D.id)}),m]}),jsxRuntime.jsx(core$1.DragOverlay,{children:d.draggedCardId?jsxRuntime.jsx(Ga,{card:e.cards.find(D=>D.id===d.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function Yp({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 Qp={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)"},em={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)"},tm={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},am={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function rm({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,l]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let n=m=>{c.current&&!c.current.contains(m.target)&&l(false);};return s&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[s]);let p=n=>{t(n),l(false);};return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((n,m)=>n.position-m.position).map((n,m)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(n.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:m<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:n.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:n.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[n.cardIds.length," ",n.cardIds.length===1?"tarea":"tareas"]})]})]},n.id))]})})})]})}function om({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,l]=react.useState(false),[c,p]=react.useState(null),n=react.useRef(null);if(react.useEffect(()=>{let u=v=>{n.current&&!n.current.contains(v.target)&&l(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(u=>u.handler),i=async(u,v)=>{if(v){p(u);try{await v();}catch(b){console.error(`Export ${u} failed:`,b);}finally{p(null),l(false);}}};return jsxRuntime.jsxs("div",{ref:n,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((u,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(u.id,u.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<d.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:c===u.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):u.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:u.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:u.description})]})]},u.id))})})})]})}function nm({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 Kn({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:l,onExportJSON:c,onExportExcel:p,translations:n}){let m=r==="dark"?Qp:em,d={...o==="es"?tm:am,...n},i=l||c||p;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:m.bgGrid,borderColor:m.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(om,{theme:m,t:d,onExportCSV:l,onExportJSON:c,onExportExcel:p}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),t&&(s?jsxRuntime.jsx(rm,{columns:e,onSelect:t,theme:m,t:d,createTaskLabel:a}):jsxRuntime.jsx(nm,{onClick:()=>t(),label:a||d.newTask}))]})})}function qn({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,l]=react.useState(false),[c,p]=react.useState(""),n=react.useCallback(()=>{let i=c.trim();i&&(e(i),p(""),l(false));},[c,e]),m=react.useCallback(i=>{i.key==="Enter"?(i.preventDefault(),n()):i.key==="Escape"&&(p(""),l(false));},[n]),d=react.useCallback(()=>{setTimeout(()=>{c.trim()||l(false);},150);},[c]);return s?jsxRuntime.jsx("div",{className:w("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:c,onChange:i=>p(i.target.value),onKeyDown:m,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:n,disabled:!c.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{p(""),l(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:w("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>l(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Xn({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:l=false,theme:c="dark",locale:p="es"}){let[n,m]=react.useState(false),[d,i]=react.useState(false),[u,v]=react.useState(""),[b,g]=react.useState([]),[x,h]=react.useState(""),[f,k]=react.useState(""),[T,N]=react.useState(""),[A,C]=react.useState(false),[W,D]=react.useState(false),[y,M]=react.useState(false),S=react.useRef(null),H=react.useRef(null),Y={placeholder:o||(p==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(p==="es"?"Agregar Tarea":"Add Task"),save:p==="es"?"Guardar":"Save",addAssignee:p==="es"?"Agregar asignado":"Add assignee",addDates:p==="es"?"Agregar fechas":"Add dates",addPriority:p==="es"?"Agregar prioridad":"Add priority",startDate:p==="es"?"Inicio":"Start",endDate:p==="es"?"Fin":"End",low:p==="es"?"Baja":"Low",medium:p==="es"?"Media":"Medium",high:p==="es"?"Alta":"High",urgent:p==="es"?"Urgente":"Urgent"},de=react.useCallback(()=>{v(""),g([]),h(""),k(""),N(""),C(false),D(false),M(false),m(false);},[]);react.useEffect(()=>{n&&S.current&&S.current.focus();},[n]),react.useEffect(()=>{if(!n)return;let F=U=>{H.current&&!H.current.contains(U.target)&&(u.trim()||de());};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[n,u,de]);let he=react.useCallback(async()=>{let F=u.trim();if(!(!F||d)){i(true);try{await t({name:F,columnId:e,assigneeIds:b.length>0?b:void 0,startDate:x?new Date(x):void 0,endDate:f?new Date(f):void 0,priority:T||void 0}),v(""),g([]),h(""),k(""),N(""),C(!1),D(!1),M(!1),S.current?.focus();}catch(U){console.error("Error creating card:",U);}finally{i(false);}}},[u,e,b,x,f,T,t,d]),Ie=react.useCallback(F=>{F.key==="Enter"&&!F.shiftKey?(F.preventDefault(),he()):F.key==="Escape"&&de();},[he,de]),Le=react.useCallback(F=>{g(U=>U.includes(F)?U.filter(E=>E!==F):[...U,F]);},[]),R=c==="dark";return n?jsxRuntime.jsxs("div",{ref:H,className:w("rounded-lg overflow-hidden shadow-lg",R?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:S,type:"text",value:u,onChange:F=>v(F.target.value),onKeyDown:Ie,placeholder:Y.placeholder,disabled:d,className:w("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",R?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>C(!A),className:w("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",A||b.length>0?"bg-emerald-500/20 text-emerald-400":R?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:Y.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"})]}),b.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:b.length})]}),jsxRuntime.jsx("button",{onClick:()=>D(!W),className:w("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",W||x||f?"bg-blue-500/20 text-blue-400":R?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:Y.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:()=>M(!y),className:w("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",y||T?T==="urgent"?"bg-red-500/20 text-red-400":T==="high"?"bg-orange-500/20 text-orange-400":T==="medium"?"bg-yellow-500/20 text-yellow-400":T==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":R?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:Y.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:he,disabled:!u.trim()||d,className:w("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):Y.save})]})]}),A&&a.length>0&&jsxRuntime.jsx("div",{className:w("px-3 pb-3 pt-0","border-t",R?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(F=>jsxRuntime.jsxs("button",{onClick:()=>Le(F.id),className:w("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",b.includes(F.id)?"bg-emerald-500 text-white":R?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[F.avatar?jsxRuntime.jsx("img",{src:F.avatar,alt:F.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:w("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",b.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))})}),W&&jsxRuntime.jsx("div",{className:w("px-3 pb-3 pt-0","border-t",R?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:w("block text-[10px] uppercase tracking-wide mb-1",R?"text-gray-500":"text-gray-400"),children:Y.startDate}),jsxRuntime.jsx("input",{type:"date",value:x,onChange:F=>h(F.target.value),className:w("w-full px-2 py-1.5 rounded text-xs border",R?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:w("block text-[10px] uppercase tracking-wide mb-1",R?"text-gray-500":"text-gray-400"),children:Y.endDate}),jsxRuntime.jsx("input",{type:"date",value:f,onChange:F=>k(F.target.value),className:w("w-full px-2 py-1.5 rounded text-xs border",R?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),y&&jsxRuntime.jsx("div",{className:w("px-3 pb-3 pt-0","border-t",R?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(F=>jsxRuntime.jsx("button",{onClick:()=>N(T===F?"":F),className:w("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",T===F?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[F]} text-white`:R?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:Y[F]},F))})})]}):jsxRuntime.jsxs("button",{onClick:()=>m(true),disabled:l,className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",R?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",l&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:Y.buttonLabel})]})}var no=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(Qa,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
5
- `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(l=>{l?o(l):s(new Error("Failed to create PNG blob"));},"image/png");})}};function Dl(e={}){return new no(e)}var Fr=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(l){console.error("Error in error handler:",l);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:l}=this.props;return a&&r?s?s(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:l?`Error in ${l}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function Jn(e,t){let a=r=>jsxRuntime.jsx(Fr,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Qn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:l,onPredictRisks:c,onOpenAIUsage:p,shortcut:n="k",className:m=""}){let[d,i]=react.useState(false),[u,v]=react.useState(""),[b,g]=react.useState("home"),[x,h]=react.useState(""),[f,k]=react.useState("");react.useEffect(()=>{let C=W=>{(W.metaKey||W.ctrlKey)&&W.key===n&&(W.preventDefault(),i(D=>!D)),W.key==="Escape"&&(i(false),g("home"),v(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[n]),react.useEffect(()=>{d||(g("home"),v(""),h(""),k(""));},[d]);let T=react.useCallback(()=>{i(false);},[]),N=react.useCallback(C=>{let[W,D]=C.split(":");switch(W){case "create-card":g("create-card");break;case "create-card-in":h(D||"");break;case "navigate":D?(a?.(D),T()):g("navigate");break;case "search":r?.(u),T();break;case "priority":g("priority");break;case "set-priority":f&&D&&(o?.(f,D),T());break;case "assign":g("assign");break;case "assign-user":f&&D&&(s?.(f,D),T());break;case "ai":g("ai");break;case "ai-generate-plan":l?.(),T();break;case "ai-predict-risks":c?.(),T();break;case "ai-usage":p?.(),T();break;case "back":g("home");break;}},[u,f,t,a,r,o,s,l,c,p,T]),A=react.useCallback(()=>{x&&u.trim()&&(t?.(x,u.trim()),T());},[x,u,t,T]);return d?jsxRuntime.jsx(at,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:T,children:jsxRuntime.jsx("div",{className:`command-palette ${m}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,onValueChange:v,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:b==="create-card"&&x?"Type card title and press Enter...":b==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&b==="create-card"&&x&&A();}}),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."}),b==="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:N,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:N,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:N,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:N,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:N,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(W=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:W},W))})]},C.id))})]}),b==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,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:N,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))})]}),b==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,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 W=e.columns.find(D=>D.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:N,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:W?.title})]}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(D=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:D},D))})]},C.id)})})]}),b==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,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:N,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:N,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:N,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 Sl(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 um(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 Ho(e){return e.startsWith("image/")}function za({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[l,c]=react.useState(false),[p,n]=react.useState(false),[m,d]=react.useState(null),[i,u]=react.useState(null),v=react.useRef(null);react.useEffect(()=>{let y=M=>{if(i){if(M.key==="Escape")u(null);else if(M.key==="ArrowLeft"||M.key==="ArrowRight"){let S=e.filter(he=>Ho(he.type)),H=S.findIndex(he=>he.id===i.id);if(H===-1)return;let Y;M.key==="ArrowLeft"?Y=H>0?H-1:S.length-1:Y=H<S.length-1?H+1:0;let de=S[Y];de&&u(de);}}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[i,e]);let b=react.useCallback((y,M)=>{M.preventDefault(),M.stopPropagation(),u(y);},[]),g=react.useCallback(()=>{u(null);},[]),x=react.useCallback((y,M)=>{M.stopPropagation();let S=e.filter(he=>Ho(he.type)),H=S.findIndex(he=>he.id===i?.id);if(H===-1)return;let Y;y==="prev"?Y=H>0?H-1:S.length-1:Y=H<S.length-1?H+1:0;let de=S[Y];de&&u(de);},[e,i]),h=react.useCallback(y=>{let M=[],S=[];return e.length+y.length>s?(S.push(`Maximum ${s} files allowed`),{valid:M,errors:S}):(y.forEach(H=>{if(H.size/1048576>r){S.push(`${H.name} is too large (max ${r}MB)`);return}if(o&&!o.some(de=>H.type.match(de))){S.push(`${H.name} has invalid file type`);return}M.push(H);}),{valid:M,errors:S})},[e.length,s,r,o]),f=react.useCallback(async y=>{let{valid:M,errors:S}=h(y);if(S.length>0){d(S.join(", ")),setTimeout(()=>d(null),5e3);return}if(M.length!==0){n(true),d(null);try{await t?.(M);}catch(H){d(H instanceof Error?H.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{n(false);}}},[h,t]),k=react.useCallback(y=>{y.preventDefault(),y.stopPropagation(),c(true);},[]),T=react.useCallback(y=>{y.preventDefault(),y.stopPropagation(),c(false);},[]),N=react.useCallback(y=>{y.preventDefault(),y.stopPropagation();},[]),A=react.useCallback(y=>{y.preventDefault(),y.stopPropagation(),c(false);let M=Array.from(y.dataTransfer.files);f(M);},[f]),C=react.useCallback(y=>{let M=y.target.files?Array.from(y.target.files):[];f(M),v.current&&(v.current.value="");},[f]),W=react.useCallback(()=>{v.current?.click();},[]),D=react.useCallback(y=>{confirm("Are you sure you want to delete this attachment?")&&a?.(y);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${l?"dragging":""} ${p?"uploading":""}`,onDragEnter:k,onDragLeave:T,onDragOver:N,onDrop:A,onClick:W,children:[jsxRuntime.jsx("input",{ref:v,type:"file",multiple:true,onChange:C,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:l?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),m&&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:m})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(y=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Ho(y.type)&&y.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:M=>b(y,M),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:y.thumbnailUrl||y.url,alt:y.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:um(y.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:y.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:y.name,children:y.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Sl(y.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(y.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>D(y.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"})})})]},y.id))}),i&&jsxRuntime.jsxs("div",{className:"attachment-lightbox",onClick:g,children:[jsxRuntime.jsx("div",{className:"attachment-lightbox-backdrop"}),jsxRuntime.jsx("button",{type:"button",className:"attachment-lightbox-close",onClick:g,title:"Close (Esc)",children:jsxRuntime.jsx("svg",{width:"24",height:"24",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"})})}),e.filter(y=>Ho(y.type)).length>1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",className:"attachment-lightbox-nav attachment-lightbox-prev",onClick:y=>x("prev",y),title:"Previous image (Left arrow)",children:jsxRuntime.jsx("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M15 18L9 12L15 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("button",{type:"button",className:"attachment-lightbox-nav attachment-lightbox-next",onClick:y=>x("next",y),title:"Next image (Right arrow)",children:jsxRuntime.jsx("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M9 18L15 12L9 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),jsxRuntime.jsxs("div",{className:"attachment-lightbox-content",onClick:y=>y.stopPropagation(),children:[jsxRuntime.jsx("img",{src:i.url,alt:i.name,className:"attachment-lightbox-image"}),jsxRuntime.jsxs("div",{className:"attachment-lightbox-info",children:[jsxRuntime.jsx("span",{className:"attachment-lightbox-name",children:i.name}),jsxRuntime.jsx("span",{className:"attachment-lightbox-size",children:Sl(i.size)})]})]})]})]})}function ts({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:c=[],aiInsights:p=[],attachments:n=[],onAddComment:m,onDeleteComment:d,onUploadAttachments:i,onDeleteAttachment:u,onSuggestAssignee:v,onGenerateSubtasks:b,onEstimateEffort:g,currentUserId:x="user-1"}){let[h,f]=react.useState("details"),[k,T]=react.useState(false),[N,A]=react.useState({}),[C,W]=react.useState(""),[D,y]=react.useState(false),[M,S]=react.useState({});if(!t||!e)return null;let H=react.useCallback(()=>{T(false),A({}),f("details"),W(""),S({}),a();},[a]),Y=react.useCallback(()=>{r&&Object.keys(N).length>0&&(r(e.id,N),A({}),T(false));},[e.id,N,r]),de=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),H());},[e.id,o,H]),he=react.useCallback(()=>{m&&C.trim()&&(m(e.id,C.trim()),W(""));},[e.id,C,m]),Ie=react.useCallback(async()=>{if(v){y(true);try{let E=await v(e);S(X=>({...X,assignees:E}));}catch(E){console.error("Failed to suggest assignee:",E);}finally{y(false);}}},[e,v]),Le=react.useCallback(async()=>{if(b){y(true);try{let E=await b(e);S(X=>({...X,subtasks:E}));}catch(E){console.error("Failed to generate subtasks:",E);}finally{y(false);}}},[e,b]),R=react.useCallback(async()=>{if(g){y(true);try{let E=await g(e);S(X=>({...X,effort:E}));}catch(E){console.error("Failed to estimate effort:",E);}finally{y(false);}}},[e,g]),F={...e,...N},U=s.filter(E=>F.assignedUserIds?.includes(E.id));return jsxRuntime.jsx(at,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:H,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:E=>E.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:N.title??F.title,onChange:E=>A({...N,title:E.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:Y,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{T(false),A({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>T(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick: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:H,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>f("details"),className:`card-detail-tab ${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:()=>f("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",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("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",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("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",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("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:N.description??F.description??"",onChange:E=>A({...N,description:E.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:N.assignedUserIds??F.assignedUserIds??[],onChange:E=>{let X=Array.from(E.target.selectedOptions,ee=>ee.value);A({...N,assignedUserIds:X});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(E=>jsxRuntime.jsx("option",{value:E.id,children:E.name},E.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:U.length>0?U.map(E=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:E.color},children:E.initials}),jsxRuntime.jsx("span",{children:E.name})]},E.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:N.priority??F.priority??"",onChange:E=>A({...N,priority:E.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(E=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:E},E)):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:N.startDate?new Date(N.startDate).toISOString().split("T")[0]:F.startDate?new Date(F.startDate).toISOString().split("T")[0]:"",onChange:E=>A({...N,startDate:E.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:N.endDate?new Date(N.endDate).toISOString().split("T")[0]:F.endDate?new Date(F.endDate).toISOString().split("T")[0]:"",onChange:E=>A({...N,endDate:E.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:N.estimatedTime??F.estimatedTime??"",onChange:E=>A({...N,estimatedTime:E.target.value?parseFloat(E.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(E=>{let X=typeof E=="string"?E:E.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",X.slice(-4)]},X)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children: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:E=>W(E.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:he,disabled:!C.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:l.length>0?l.map(E=>{let X=s.find(ee=>ee.id===E.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[X&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:X.color},children:X.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:X?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(E.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(E.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:E.content})]},E.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:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(E=>{let X=s.find(ee=>ee.id===E.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[E.type.includes("CREATED")&&"\u2795",E.type.includes("UPDATED")&&"\u270F\uFE0F",E.type.includes("MOVED")&&"\u27A1\uFE0F",E.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",E.type.includes("COMMENT")&&"\u{1F4AC}",E.type.includes("ASSIGNED")&&"\u{1F464}",E.type.includes("PRIORITY")&&"\u{1F3AF}",E.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",E.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:X?.name||"Unknown"})," ",E.type.replace(/_/g," ").toLowerCase(),E.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:E.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(E.timestamp).toLocaleString()})]})]},E.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(za,{cardId:e.id,attachments:n,onUpload:i?E=>i(e.id,E):void 0,onDelete:u,currentUserId:x,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:Ie,disabled:D||!v,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:Le,disabled:D||!b,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:R,disabled:D||!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"]})]}),M.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),M.assignees.map((E,X)=>{let ee=s.find(z=>z.id===E.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ee&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ee.color},children:ee.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ee?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:E.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(E.confidence*100).toFixed(0),"%"]})]})]},X)})]}),M.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),M.subtasks.map((E,X)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:E.title}),E.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:E.description}),E.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",E.estimatedTime,"h"]})]},X))]}),M.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:[M.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(M.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),p.map(E=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${E.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:E.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:E.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:E.description}),E.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",E.suggestedAction]})]},E.id))]}),!M.assignees&&!M.subtasks&&!M.effort&&p.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 io({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:l=""}){let[c,p]=react.useState({top:0,left:0}),n=react.useRef(null),m=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),i=window.innerHeight,u=window.innerWidth,v=4,b=d.left;b+o>u-10&&(b=u-o-10),b<10&&(b=10);let g=i-d.bottom,x=d.top,h;return g>=s+v?h=d.bottom+v:x>=s+v?h=d.top-s-v:g>=x?h=d.bottom+v:h=Math.max(10,d.top-s-v),{top:h,left:b}},[e,o,s]);return react.useEffect(()=>{t&&p(m());},[t,m]),react.useEffect(()=>{if(!t)return;let d=u=>{let v=u.target;n.current&&!n.current.contains(v)&&e.current&&!e.current.contains(v)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(at,{children:jsxRuntime.jsx("div",{ref:n,className:`smart-popover ${l}`,style:{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var _o=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Rr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:l=true}){let[c,p]=react.useState(false),[n,m]=react.useState(""),[d,i]=react.useState(false),[u,v]=react.useState(_o[10]||"#3B82F6"),[b,g]=react.useState({top:0,left:0}),x=react.useRef(null),h=react.useRef(null),f=react.useRef(null),k=react.useRef(null),T=t.filter(y=>y.name.toLowerCase().includes(n.toLowerCase())),N=t.some(y=>y.name.toLowerCase()===n.toLowerCase());react.useEffect(()=>{if(c&&h.current){let y=h.current.getBoundingClientRect();g({top:y.bottom+6,left:y.left});}},[c]),react.useEffect(()=>{let y=M=>{let S=M.target,H=x.current?.contains(S),Y=f.current?.contains(S);!H&&!Y&&(p(false),m(""),i(false));};if(c)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]),react.useEffect(()=>{c&&k.current&&k.current.focus();},[c]);let A=y=>{let M=e.some(S=>S.id===y.id);a(M?e.filter(S=>S.id!==y.id):[...e,y]);},C=async()=>{if(!(!r||!n.trim())){i(true);try{let y=await r(n.trim(),u);y&&(a([...e,y]),m(""),v(_o[Math.floor(Math.random()*_o.length)]||"#3B82F6"));}finally{i(false);}}},W=(y,M)=>{M.stopPropagation(),a(e.filter(S=>S.id!==y));},D={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&p(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:D,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(y=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${y.color}20`,color:y.color},children:y.name},y.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Etiquetas"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:f,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:b.top,left:b.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:n,onChange:y=>m(y.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:y=>{y.key==="Enter"&&n.trim()&&!N&&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(y=>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:`${y.color}20`,color:y.color},onClick:M=>W(y.id,M),children:[y.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},y.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:T.length>0?T.map(y=>{let M=e.some(S=>S.id===y.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>A(y),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:M?`${y.color}15`:"transparent",color:o.textPrimary},onMouseEnter:S=>{M||(S.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:S=>{M||(S.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:y.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:y.name}),M&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:y.color}})]},y.id)}):n.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),n.trim()&&!N&&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:_o.map(y=>jsxRuntime.jsx("button",{type:"button",onClick:()=>v(y),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:y,outline:u===y?`2px solid ${y}`:"none",outlineOffset:"2px"}},y))}),jsxRuntime.jsxs("button",{type:"button",onClick:C,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:u,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',n.trim(),'"']})]})]})}),document.body)]})}function os({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 Ml({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(os,{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 Ge={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#06B6D4",todayLight:"rgba(6, 182, 212, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#0891B2",todayLight:"rgba(8, 145, 178, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var Em=["LOW","MEDIUM","HIGH","URGENT"],Pm=["todo","in-progress","review","done"];function ss({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:c=[],onAddComment:p,onDeleteComment:n,currentUser:m,onAIGenerateDescription:d,onAICreateSubtasks:i,onAIFindSimilar:u,availableColumns:v=[],availableLabels:b=[],availableTags:g=[],onCreateTag:x,onUploadCoverImage:h,unsplashAccessKey:f,theme:k,onSubtasksChange:T,attachments:N=[],onUploadAttachments:A,onDeleteAttachment:C}){let W=Mr(),D=k||W?.themeName||"dark",[y,M]=react.useState(e),[S,H]=react.useState(false),[Y,de]=react.useState(e?.subtasks||[]),[he,Ie]=react.useState(false),[Le,R]=react.useState(""),[F,U]=react.useState(""),[E,X]=react.useState("all"),[ee,z]=react.useState(false),[Me,ve]=react.useState(false),[Xe,ge]=react.useState(false),[et,Te]=react.useState(false),[ot,gt]=react.useState(false),[ft,tt]=react.useState(false),B=react.useRef(null),se=react.useRef(null),xe=react.useRef(null),De=react.useRef(null),Ee=react.useRef(null),Ve=react.useRef(null),Ct=react.useRef(null),q=react.useRef(null),O=react.useRef(null),we=react.useRef(null),We=react.useRef(null),Ue=react.useRef(null);react.useEffect(()=>{e&&!y?(M({...e}),de(e.subtasks||[])):e&&y&&e.id!==y.id&&(M({...e}),de(e.subtasks||[]));},[e,y]),react.useEffect(()=>{let $=pe=>{let Ce=pe.target;De.current&&!De.current.contains(Ce)&&z(false),Ee.current&&!Ee.current.contains(Ce)&&ve(false),Ve.current&&!Ve.current.contains(Ce)&&ge(false),Ct.current&&!Ct.current.contains(Ce)&&Te(false);};if(ee||Me||Xe||et)return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[ee,Me,Xe,et]),react.useEffect(()=>{if(!t)return;let $=pe=>{let Ce=pe.target,zt=Ce.tagName==="INPUT"||Ce.tagName==="TEXTAREA"||Ce.isContentEditable;if(pe.key==="Escape"){pe.preventDefault(),ee||Me||Xe||et||ot||ft?(z(false),ve(false),ge(false),Te(false),gt(false),tt(false)):zt||a();return}if(zt&&pe.key!=="Escape")return;let ea=pe.metaKey||pe.ctrlKey;switch(pe.key.toLowerCase()){case "s":pe.preventDefault(),z(true);break;case "a":pe.preventDefault(),ge(true);break;case "p":pe.preventDefault(),ve(true);break;case "l":pe.preventDefault(),Te(true);break;case "d":ea||(pe.preventDefault(),gt(true),setTimeout(()=>q.current?.focus(),0));break;case "e":ea||(pe.preventDefault(),tt(true));break;case "i":pe.preventDefault(),H(true),setTimeout(()=>se.current?.focus(),0);break;case "t":pe.preventDefault(),Ie(true);break;case "c":pe.preventDefault(),xe.current?.focus();break}};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[t,a,ee,Me,Xe,et,ot,ft]);let ht=react.useCallback($=>{let pe=$.currentTarget.textContent?.trim()||"";if(y&&pe!==y.title){let Ce={...y,title:pe};M(Ce),r?.(y.id,{title:pe});}},[y,r]),Z=react.useCallback($=>{$.key==="Enter"&&($.preventDefault(),$.currentTarget.blur()),$.key==="Escape"&&($.preventDefault(),$.currentTarget.textContent=y?.title||"",$.currentTarget.blur());},[y]),te=react.useCallback(()=>{y&&e&&y.description!==e.description&&r?.(y.id,{description:y.description}),H(false);},[y,e,r]),ke=react.useCallback($=>{if(y){let pe={...y,columnId:$};M(pe),r?.(y.id,{columnId:$}),z(false);}},[y,r]),Pe=react.useCallback($=>{if(y){let pe={...y,priority:$};M(pe),r?.(y.id,{priority:$}),ve(false);}},[y,r]),J=react.useCallback($=>{if(y){let pe=y.assignedUserIds||[],Ce=pe.includes($)?pe.filter(ea=>ea!==$):[...pe,$],zt={...y,assignedUserIds:Ce};M(zt),r?.(y.id,{assignedUserIds:Ce});}},[y,r]),Ae=react.useCallback($=>{if(y){let pe=y.labels||[],Ce=pe.includes($)?pe.filter(ea=>ea!==$):[...pe,$],zt={...y,labels:Ce};M(zt),r?.(y.id,{labels:Ce});}},[y,r]),ye=react.useCallback($=>{if(y){let pe={...y,tags:$};M(pe),r?.(y.id,{tags:$});}},[y,r]),Ne=react.useCallback($=>{if(y){let pe=$.target.value,Ce={...y,endDate:pe};M(Ce),r?.(y.id,{endDate:pe}),gt(false);}},[y,r]),ce=react.useCallback($=>{if(y){let pe={...y,estimatedTime:parseFloat($)||0};M(pe),r?.(y.id,{estimatedTime:parseFloat($)||0});}},[y,r]),Re=react.useCallback(()=>{if(Le.trim()&&y){let $={id:`subtask-${Date.now()}`,title:Le.trim(),completed:false,createdAt:new Date},pe=[...Y,$];de(pe),R(""),Ie(false),T?.(y.id,pe);}},[Le,Y,y,T]),Fe=react.useCallback($=>{let pe=Y.map(Ce=>Ce.id===$?{...Ce,completed:!Ce.completed,updatedAt:new Date}:Ce);de(pe),y&&T?.(y.id,pe);},[Y,y,T]),Oe=react.useCallback($=>{let pe=Y.filter(Ce=>Ce.id!==$);de(pe),y&&T?.(y.id,pe);},[Y,y,T]),_=react.useCallback(()=>{F.trim()&&y&&p&&(p(y.id,F.trim()),U(""));},[F,y,p]),j=react.useCallback($=>{($.metaKey||$.ctrlKey)&&$.key==="Enter"&&($.preventDefault(),_());},[_]),st=$=>jsxRuntime.jsx(Dm__default.default,{remarkPlugins:[Nm__default.default],rehypePlugins:[Sm__default.default],components:{a:({node:pe,...Ce})=>jsxRuntime.jsx("a",{...Ce,target:"_blank",rel:"noopener noreferrer"})},children:$}),He=c.filter($=>E==="comments"?$.type.includes("COMMENT"):E==="history"?!$.type.includes("COMMENT"):true);if(!t||!e)return null;let fe=y||e,Vt=s.filter($=>fe.assignedUserIds?.includes($.id)),Tt=Y.filter($=>$.completed).length;return jsxRuntime.jsx(at,{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:$=>$.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":D,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:B,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ht,onKeyDown:Z,children:fe.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:De,children:[jsxRuntime.jsxs("button",{ref:O,className:"modal-v2-field",onClick:()=>z(!ee),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:fe.columnId||"No status"})]}),jsxRuntime.jsx(io,{triggerRef:O,isOpen:ee,onClose:()=>z(false),width:250,estimatedHeight:200,children:(v.length>0?v:Pm.map($=>({id:$,title:$}))).map($=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${fe.columnId===$.id?"active":""}`,onClick:()=>ke($.id),children:$.title},$.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ve,children:[jsxRuntime.jsxs("button",{ref:we,className:"modal-v2-field",onClick:()=>ge(!Xe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 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:Vt.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Vt.map($=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:$.color},title:$.name,children:$.initials},$.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(io,{triggerRef:we,isOpen:Xe,onClose:()=>ge(false),width:280,estimatedHeight:300,children:s.map($=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${fe.assignedUserIds?.includes($.id)?"active":""}`,onClick:()=>J($.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:$.color},children:$.initials}),$.name,fe.assignedUserIds?.includes($.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"})})]},$.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ee,children:[jsxRuntime.jsxs("button",{ref:We,className:"modal-v2-field",onClick:()=>ve(!Me),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:fe.priority||"None"})]}),jsxRuntime.jsxs(io,{triggerRef:We,isOpen:Me,onClose:()=>ve(false),width:180,estimatedHeight:220,children:[Em.map($=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${$.toLowerCase()} ${fe.priority===$?"active":""}`,onClick:()=>Pe($),children:$},$)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Pe(""),children:"None"})]})]}),g.length>0||x?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(Rr,{selectedTags:fe.tags||[],availableTags:g,onChange:ye,onCreateTag:x,theme:Ge[D]||Ge.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ct,children:[jsxRuntime.jsxs("button",{ref:Ue,className:"modal-v2-field",onClick:()=>Te(!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("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:fe.labels&&fe.labels.length>0?jsxRuntime.jsx("span",{children:fe.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(io,{triggerRef:Ue,isOpen:et,onClose:()=>Te(false),width:220,estimatedHeight:200,children:(b.length>0?b:["Bug","Feature","Enhancement","Documentation"]).map($=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${fe.labels?.includes($)?"active":""}`,onClick:()=>Ae($),children:[$,fe.labels?.includes($)&&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"})})]},$))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{gt(!ot),setTimeout(()=>q.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:fe.endDate?new Date(fe.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:q,type:"date",value:typeof fe.endDate=="string"?fe.endDate.split("T")[0]:fe.endDate?(()=>{let $=new Date(fe.endDate),pe=$.getUTCFullYear(),Ce=String($.getUTCMonth()+1).padStart(2,"0"),zt=String($.getUTCDate()).padStart(2,"0");return `${pe}-${Ce}-${zt}`})():"",onChange:Ne,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>tt(!ft),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:fe.estimatedTime?`${fe.estimatedTime}h`:"Not set"})]}),ft&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:fe.estimatedTime||"",onChange:$=>ce($.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>tt(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"})]}),S?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:fe.description||"",onChange:$=>{if(y){let pe={...y,description:$.target.value};M(pe);}},onBlur:te,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>H(true),children:fe.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:st(fe.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"}),Y.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Tt,"/",Y.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ie(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:[Y.map($=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${$.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Fe($.id),children:$.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:$.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Oe($.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"})]})})]},$.id)),he&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:Le,onChange:$=>R($.target.value),onKeyDown:$=>{$.key==="Enter"&&Re(),$.key==="Escape"&&(Ie(false),R(""));},onBlur:Re,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(A||N.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"}),N.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:N.length})]}),jsxRuntime.jsx(za,{cardId:fe.id,attachments:N,onUpload:A?$=>A(fe.id,$):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 ${E==="all"?"active":""}`,onClick:()=>X("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${E==="comments"?"active":""}`,onClick:()=>X("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${E==="history"?"active":""}`,onClick:()=>X("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:xe,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:F,onChange:$=>U($.target.value),onKeyDown:j,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:_,disabled:!F.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[He.map($=>{let pe=s.find(zt=>zt.id===$.userId);if($.type.includes("COMMENT")){let zt=l.find(ea=>ea.id===$.metadata?.commentId);return zt?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[pe&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:pe.color},children:pe.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:pe?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date($.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:zt.content})]})]},$.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[$.type.includes("CREATED")&&"\u2795",$.type.includes("UPDATED")&&"\u270F\uFE0F",$.type.includes("MOVED")&&"\u27A1\uFE0F",$.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",$.type.includes("ASSIGNED")&&"\u{1F464}",$.type.includes("PRIORITY")&&"\u{1F3AF}",$.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:pe?.name||"Unknown"})," ",$.type.replace(/_/g," ").toLowerCase(),$.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:$.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date($.timestamp).toLocaleString()})]})]},$.id)}),He.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 zm({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 ls({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(l=>({...l,average:l.average??e.reduce((c,p)=>c+p.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(zm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((l,c)=>l+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((l,c)=>l+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(l=>l.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((l,c)=>l+(c.planned||0),0)})]})]})]})}function Km({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 ds({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),l=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,p=s>0?(s-l)/s*100:0,n=l<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Km,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",fill:n?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:n?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:p>=50?"#10B981":"#F59E0B"},children:[p.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:n?"#10B981":"#EF4444"},children:l})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:n?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:n?"#10B981":"#EF4444"},children:n?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var au={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Ol=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function ru({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let l=r+(o-r)*.5,c=e+l*Math.cos(-a*(Math.PI/180)),p=t+l*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:p,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function zl({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 cs({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((p,n)=>p+n.value,0),l=e.map(p=>({...p,totalValue:s,color:p.color||au[p.name]||Ol[e.indexOf(p)%Ol.length]})),c=l.map(p=>p.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:l,cx:"50%",cy:"50%",labelLine:false,label:o?ru:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:l.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(zl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,n)=>{let m=n.payload,d=s>0?(m.value/s*100).toFixed(0):"0";return `${p} (${m.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:l,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(zl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:l.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((p,n)=>n.value>p.value?n:p).name})]})]})]})}var jo=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[l,c]=react.useState(false),[p,n]=react.useState(false),[m,d]=react.useState(false),[i,u]=react.useState(false);if(e.length===0)return null;let v=e.map(k=>k.id),b=k=>{r.onBulkUpdate?.(v,{priority:k}),c(false);},g=k=>{r.onBulkMove?.(v,k),n(false),a();},x=k=>{r.onBulkUpdate?.(v,{assignedUserIds:k}),d(false);},h=k=>{let T=new Set;e.forEach(A=>{A.labels?.forEach(C=>T.add(C));});let N=Array.from(new Set([...T,...k]));r.onBulkUpdate?.(v,{labels:N}),u(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(v),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!l),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(k),children:[jsxRuntime.jsx("span",{className:w("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:()=>n(!p),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),p&&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:()=>d(!m),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([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:()=>u(!i),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(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:f,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});jo.displayName="BulkOperationsToolbar";function lu(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,l,c,p,n;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(u=>{let v=a?.find(b=>b.id===u);l=`assignee-${u}`,c=v?.name||`User ${u}`,p=v?.color,n=v?.avatar,r.has(l)||r.set(l,{id:l,title:c,groupValue:u,cardIds:[],color:p,icon:n}),r.get(l).cardIds.push(o.id);}):(l="assignee-unassigned",c="Unassigned",p="#6b7280",n="\u{1F464}",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:p,icon:n}),r.get(l).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",l=`priority-${s}`;let i={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=i.title,p=i.color,r.has(l)||r.set(l,{id:l,title:c,groupValue:s,cardIds:[],color:p}),r.get(l).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{l=`label-${u}`,c=u,p="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:u,cardIds:[],color:p}),r.get(l).cardIds.push(o.id);}):(l="label-none",c="No Labels",p="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:p}),r.get(l).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function ps({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,l]=react.useState(new Set),c=react.useMemo(()=>lu(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=react.useCallback(n=>{l(m=>{let d=new Set(m);return d.has(n)?d.delete(n):d.add(n),d});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Qa,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:w("asakaa-swimlane-view",o),children:[c.map(n=>{let m=s.has(n.id),d=e.cards.filter(u=>n.cardIds.includes(u.id)),i={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&p(n.id),style:{borderLeft:n.color?`4px solid ${n.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:n.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:n.color},children:n.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",n.cardIds.length," ",n.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Qa,{board:i,callbacks:r,availableUsers:a})})]},n.id)}),c.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var ms=[{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 us({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null),c=ms.find(n=>n.value===e)||ms[0];react.useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&l.current&&!l.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let p=n=>{t(n),o(false);};return jsxRuntime.jsxs("div",{className:w("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:w("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:ms.map(n=>jsxRuntime.jsxs("button",{onClick:()=>p(n.value),className:w("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===n.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:n.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:n.label}),e===n.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:n.description})]})]},n.value))})]})]})}var co=[{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 pu(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(n=>e.key===n||e.code===n))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,l=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return s&&l&&c&&p}function Gl(e={}){let{shortcuts:t=co,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let l=react.useCallback(p=>{o.current=[...o.current,p];},[]),c=react.useCallback(p=>{o.current=o.current.filter(n=>n.action!==p);},[]);return react.useEffect(()=>{function p(n){if(!s.current)return;let m=n.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&n.key!=="Escape"&&!n.ctrlKey&&!n.metaKey)){for(let d of o.current)if(pu(n,d)){r&&n.preventDefault();let i=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:l,unregisterShortcut:c,isEnabled:a}}function uu(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function gu(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 fu(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=gu(e),r=t?uu(t):"";return a?`${a} + ${r}`:r}function hu(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function gs({shortcuts:e=co,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function c(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let l=hu(e);return jsxRuntime.jsxs("div",{className:w("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(l).map(([c,p])=>p.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:p.map(n=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:n.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:fu(n)})]},n.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var fs=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
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'),Md=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion'),cmdk=require('cmdk'),Nm=require('react-markdown'),Sm=require('remark-gfm'),Em=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Md__default=/*#__PURE__*/_interopDefault(Md);var Nm__default=/*#__PURE__*/_interopDefault(Nm);var Sm__default=/*#__PURE__*/_interopDefault(Sm);var Em__default=/*#__PURE__*/_interopDefault(Em);var Mo=(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 Ao=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 [Ao.Translate.toString(e),Ao.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function w(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Io(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 rp(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Fn(e,t){return e.length===0?1e3:t===0?Io(null,e[0].position):t>=e.length?Io(e[e.length-1].position,null):Io(e[t-1].position,e[t].position)}function $i(e,t=100){return e>t}var op=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 np(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 Lo(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:l=op,onRetry:c}=t,p,n=0;for(let m=1;m<=a;m++){n=m;try{return {data:await e(),attempts:n,success:!0}}catch(d){if(p=d,m===a||!l(p,m))return {error:p,attempts:n,success:false};let u=np(m,r,o,s);if(c)try{c(p,m,u);}catch(v){console.error("Error in retry callback:",v);}await new Promise(v=>setTimeout(v,u));}}return {error:p||new Error("Unknown error"),attempts:n,success:false}}function sp(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 ip(e,t={}){return async(...a)=>Lo(()=>e(...a),t)}var Bn=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 zi=(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))(zi||{}),dr=class dr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...l}=t,c=`[${a}] [${r}] [${s}]`,p=Object.keys(l).length>0;switch(r){case "DEBUG":console.debug(c,o,p?l:"");break;case "INFO":console.info(c,o,p?l:"");break;case "WARN":console.warn(c,o,p?l:"");break;case "ERROR":console.error(c,o,p?l:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...dr.globalOptions};}static configure(t){dr.globalOptions={...dr.globalOptions,...t};}child(t){return new dr({...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 Fo((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Fo(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:zi[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};dr.globalOptions={};var Rn=dr,Fo=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}},Ui=new Rn;function dp(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 cp(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let l=e.columns.find(c=>c.id===s.columnId);return [s.id,On(s.title),On(s.description||""),On(l?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
2
+ `)}async function pp(e,t,a){let r=t;if(!r){let l=document.querySelector(".asakaa-board");l&&(r=l.parentElement||l);}if(r)try{let l=await Md__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),c=l.toDataURL("image/png"),p=297,n=210,m=l.width/l.height,d=p-20,i=d/m;i>n-20&&(i=n-20,d=i*m);let u=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});u.setFontSize(16),u.setTextColor(255,255,255),u.setFillColor(10,10,10),u.rect(0,0,p,15,"F"),u.text(e.title||"Kanban Board",10,10);let v=(p-d)/2;return u.addImage(c,"PNG",v,20,d,i),u}catch(l){console.error("Error capturing board:",l);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(l=>{let c=e.cards.filter(p=>p.columnId===l.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(l.title,20,s),s+=8,c.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):c.forEach(p=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(p.title,25,s),s+=6,p.description){o.setFontSize(9),o.setFont("helvetica","normal");let m=o.splitTextToSize(p.description,160);o.text(m,25,s),s+=m.length*5;}let n=[];if(p.priority&&n.push(`Priority: ${p.priority}`),p.labels&&p.labels.length>0&&n.push(`Labels: ${p.labels.join(", ")}`),p.assignedUserIds&&p.assignedUserIds.length>0&&n.push(`Assigned: ${p.assignedUserIds.length} user(s)`),p.startDate||p.endDate){let m=[];p.startDate&&m.push(`Start: ${p.startDate}`),p.endDate&&m.push(`End: ${p.endDate}`),n.push(m.join(" \u2192 "));}n.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(n.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function On(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function Hi(e,t,a,r){switch(t){case "json":return dp(e,r);case "csv":return cp(e);case "pdf":return await pp(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Gi(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let m=`${r}.pdf`;e.save(m);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,l={json:"application/json",csv:"text/csv",pdf:"application/pdf"},c=new Blob([e],{type:l[t]}),p=URL.createObjectURL(c),n=document.createElement("a");n.href=p,n.download=s,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(p);}function mp(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 up(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=_i(t[0]),r=[],o=new Map,s=[];for(let l=1;l<t.length;l++)try{let c=_i(t[l]||"");if(c.length>a.length){s.push(`Line ${l+1}: Too many columns`);continue}if(a.length-c.length>3){s.push(`Line ${l+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let n={};a.forEach((u,v)=>{n[u]=c[v]||"";});let m=n.Column||"Unnamed";o.has(m)||o.set(m,{id:`col-${o.size+1}`,title:m,position:o.size+1,cardIds:[]});let d=o.get(m),i={id:n["Card ID"]||`card-${l}`,title:n.Title||"Untitled",description:n.Description?n.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:n.Priority||void 0,labels:n.Labels?n.Labels.split(";").filter(Boolean):void 0,assignedUserIds:n["Assigned Users"]?n["Assigned Users"].split(";").filter(Boolean):void 0,startDate:n["Start Date"]?n["Start Date"]:void 0,endDate:n["End Date"]?n["End Date"]:void 0,createdAt:n["Created At"]?n["Created At"]:void 0,updatedAt:n["Updated At"]?n["Updated At"]:void 0};r.push(i),d.cardIds.push(i.id);}catch(c){s.push(`Line ${l+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function _i(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],l=e[o+1];s==='"'&&r&&l==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Vi(e,t){switch(t){case "json":return mp(e);case "csv":return up(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function ji(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 $n=react.createContext(null);function Ki(){return react.useContext($n)}var Yi=react.createContext(null);function qi({children:e,themeName:t}){return jsxRuntime.jsx(Yi.Provider,{value:{themeName:t},children:e})}function Mr(){return react.useContext(Yi)}function at({children:e,container:t}){let[a,r]=react.useState(false),o=Ki(),s=Mr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let l=t||(typeof document<"u"?document.body:null);if(!l)return null;if(o){let{theme:c,themeName:p}=o,n={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":p,"data-gantt-portal":"true",style:n,children:e}),l)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),l):reactDom.createPortal(e,l)}var el={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},kp="#BDC3C7",wp=({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 cr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,l]=react.useState({top:0,left:0}),c=react.useRef(null),p=react.useRef(null),n=()=>{if(!p.current)return;let u=p.current.getBoundingClientRect(),v=window.innerHeight,b=window.innerWidth,g=160,x=220,h=4,f=u.right-g;f<10&&(f=u.left),f+g>b-10&&(f=b-g-10);let k=v-u.bottom,T=u.top,N;k>=x+h?N=u.bottom+h:T>=x+h?N=u.top-x-h:N=k>=T?u.bottom+h:Math.max(10,u.top-x-h),l({top:N,left:f}),o(true);};react.useEffect(()=>{let u=v=>{c.current&&!c.current.contains(v.target)&&!p.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),react.useEffect(()=>{let u=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let m=u=>{t(u),o(false);},d=e?el[e]:null,i=d?.color||kp;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>r?o(false):n(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${i}10`:"transparent",boxShadow:e?`0 0 0 2px ${i}30 inset`:"none"},title:d?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:i,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(at,{children:jsxRuntime.jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(el).map(([u,v])=>jsxRuntime.jsxs("button",{onClick:()=>m(u),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:v.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(wp,{color:v.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:v.label}),e===u&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},u)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>m(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:u=>{u.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:u=>{u.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Cp=[{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 Qr({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[l,c]=react.useState({top:0,left:0}),p=react.useRef(null),n=react.useRef(null),i=(Mr()?.themeName||"dark")==="dark",u=()=>{if(!n.current)return;let f=n.current.getBoundingClientRect(),k=window.innerHeight,T=window.innerWidth,N=320,A=380,C=4,W=f.left;W+N>T-10&&(W=T-N-10),W<10&&(W=10);let D=k-f.bottom,y=f.top,M;D>=A+C?M=f.bottom+C:y>=A+C?M=f.top-A-C:M=D>=y?f.bottom+C:Math.max(10,f.top-A-C),c({top:M,left:W}),s(true);};react.useEffect(()=>{let f=k=>{p.current&&!p.current.contains(k.target)&&!n.current?.contains(k.target)&&s(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),react.useEffect(()=>{let f=k=>{k.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let v=f=>{let k=new Date,T=W=>{let D=W.getFullYear(),y=String(W.getMonth()+1).padStart(2,"0"),M=String(W.getDate()).padStart(2,"0");return `${D}-${y}-${M}`},N=T(k),A=new Date(k);A.setDate(A.getDate()+f);let C=T(A);a(N,C),s(false);},b=()=>{if(!e||!t)return "Set date";let f=A=>{if(A instanceof Date)return A;if(typeof A!="string"||!A.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=A.split("-").map(Number);if(C.length!==3||C.some(M=>isNaN(M)))return null;let W=C[0],D=C[1],y=C[2];return W===void 0||D===void 0||y===void 0?null:new Date(W,D-1,y)},k=f(e),T=f(t);if(!k||!T||isNaN(k.getTime())||isNaN(T.getTime()))return "Set date";let N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${N[k.getMonth()]} ${k.getDate()} \u2013 ${N[T.getMonth()]} ${T.getDate()}`},g=e&&t,h=(()=>{if(!t)return false;let f=typeof t=="string"?new Date(t):t,k=new Date;return k.setHours(0,0,0,0),f<k})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o?s(false):u(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:g?`${b()}`:"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:b()})]}),o&&jsxRuntime.jsx(at,{children:jsxRuntime.jsxs("div",{ref:p,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,background:i?"#1A1D25":"#FFFFFF",border:`1px solid ${i?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:i?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:i?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:Cp.map(f=>jsxRuntime.jsx("button",{onClick:()=>v(f.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",k.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:k=>{k.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",k.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:f.label},f.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:f=>a(f.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:f=>a(e,f.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function mr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,l]=react.useState(false),[c,p]=react.useState(""),[n,m]=react.useState({top:0,left:0}),d=react.useRef(null),i=react.useRef(null),u=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),f=window.innerHeight,k=window.innerWidth,T=300,N=380,A=4,C=h.right-T;C<10&&(C=h.left),C+T>k-10&&(C=k-T-10);let W=f-h.bottom,D=h.top,y;W>=N+A?y=h.bottom+A:D>=N+A?y=h.top-N-A:y=W>=D?h.bottom+A:Math.max(10,h.top-N-A),m({top:y,left:C}),l(true);};react.useEffect(()=>{let h=f=>{d.current&&!d.current.contains(f.target)&&!i.current?.contains(f.target)&&(l(false),p(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&(l(false),p(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let v=h=>{let f=e.some(k=>k.id===h.id);a(f?e.filter(k=>k.id!==h.id):[...e,h]);},b=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),g=e.slice(0,o),x=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>s?l(false):u(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[g.map(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)),x>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",x]})]}):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(at,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:c,onChange:h=>p(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:b.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"}):b.map(h=>{let f=e.some(k=>k.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>v(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:f?"#3b82f6":"transparent"},children:f?"\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([]),l(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Bo(e,t,a){let r=new Map;e.forEach(p=>{if(p.dependencies&&Array.isArray(p.dependencies)){let n=p.dependencies.map(m=>{if(typeof m=="string")return m;let d=m;return d.taskId||d.targetId||""}).filter(Boolean);r.set(p.id,n);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,l=new Set,c=p=>{if(!s.has(p)){s.add(p),l.add(p);let n=r.get(p)||[];for(let m of n){if(!s.has(m)&&c(m))return true;if(l.has(m))return true}}return l.delete(p),false};return c(a)}function to({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:l}){let[c,p]=react.useState(false),[n,m]=react.useState(""),[d,i]=react.useState(t.length>0),[u,v]=react.useState({top:0,left:0}),[b,g]=react.useState(null),x=react.useRef(null),h=react.useRef(null),f=()=>{if(!h.current)return;let C=h.current.getBoundingClientRect(),W=window.innerHeight,D=window.innerWidth,y=300,M=d?380:120,S=4,H=C.right-y;H<10&&(H=C.left),H+y>D-10&&(H=D-y-10);let Y=W-C.bottom,de=C.top,he;Y>=M+S?he=C.bottom+S:de>=M+S?he=C.top-M-S:he=Y>=de?C.bottom+S:Math.max(10,C.top-M-S),v({top:he,left:H}),p(true);};react.useEffect(()=>{if(!c||!h.current)return;let C=h.current.getBoundingClientRect(),W=window.innerHeight,D=window.innerWidth,y=300,M=d?380:120,S=4,H=C.right-y;H<10&&(H=C.left),H+y>D-10&&(H=D-y-10);let Y=W-C.bottom,de=C.top,he;Y>=M+S?he=C.bottom+S:de>=M+S?he=C.top-M-S:he=Y>=de?C.bottom+S:Math.max(10,C.top-M-S),v({top:he,left:H});},[d,c]),react.useEffect(()=>{let C=W=>{x.current&&!x.current.contains(W.target)&&!h.current?.contains(W.target)&&(p(false),m(""));};if(c)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]),react.useEffect(()=>{let C=W=>{W.key==="Escape"&&(p(false),m(""));};if(c)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[c]);let k=C=>{let W=t.includes(C),D=a.find(y=>y.id===C);if(g(null),W){let y=t.filter(M=>M!==C);r(y),y.length===0&&i(false);}else {if(s&&Bo(a,C,e)){let M=`Cannot add "${D?.title||C}" as dependency - would create circular reference`;g(M),l?.(C,D?.title||C),setTimeout(()=>g(null),3e3);return}r([...t,C]),i(true);}},T=()=>{let C=!d;i(C),C||r([]);},N=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(n.toLowerCase())||C.id.toLowerCase().includes(n.toLowerCase())),A=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:h,onClick:()=>c?p(false):f(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:A,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:A},children:t.length})]}),c&&jsxRuntime.jsx(at,{children:jsxRuntime.jsxs("div",{ref:x,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${u.top}px`,left:`${u.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[b&&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:b})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:T,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:n,onChange:C=>m(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:N.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"}):N.map(C=>{let W=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:D=>{D.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:D=>{D.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:W?"#3b82f6":"transparent",borderColor:W?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:W&&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([]),i(false),p(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 Ga=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:l,availableUsers:c=[],allCards:p=[]})=>{let{attributes:n,listeners:m,setNodeRef:d,transform:i,transition:u,isDragging:v}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),b={transform:Ao.Transform.toString(i),transition:u};if(t)return jsxRuntime.jsx("div",{ref:d,style:b,...n,...m,onClick:()=>a?.(e),children:t(e)});let g=c.filter(f=>e.assignedUserIds?.includes(f.id)),x=e.progress===100,h={...b,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:h,className:w("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...n,...m,onClick:f=>{f.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:f=>{f.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:x?"line-through":"none",opacity:x?.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:f=>f.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(cr,{priority:e.priority,onChange:f=>l?.(e.id,{priority:f})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Qr,{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:(f,k)=>l?.(e.id,{startDate:f,endDate:k})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(mr,{assignedUsers:g,availableUsers:c,onChange:f=>l?.(e.id,{assignedUserIds:f.map(k=>k.id)})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(to,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(f=>typeof f=="string"?f:f.taskId):[],availableTasks:p,onChange:f=>l?.(e.id,{dependencies:f})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(f=>jsxRuntime.jsx("span",{className:"asakaa-label",children:f},f))}),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));Ga.displayName="Card";var Ro={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"}},cl=({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 pl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[l,c]=react.useState({top:0,left:0}),p=react.useRef(null),n=react.useRef(null),m=[...Object.entries(Ro).map(([g,x])=>({id:g,label:x.label,color:x.color,icon:x.icon})),...r.filter(g=>!Object.keys(Ro).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let g=Ro[e];if(g)return {...g,id:e};let x=r.find(h=>h.id===e);return x?{id:x.id,label:x.title,color:x.color||"#8B5CF6",icon:"circle-dot"}:{...Ro.todo,id:"todo"}},i=()=>{if(!n.current)return;let g=n.current.getBoundingClientRect(),x=window.innerHeight,h=window.innerWidth,f=180,k=280,T=4,N=g.right-f;N<10&&(N=g.left),N+f>h-10&&(N=h-f-10);let A=x-g.bottom,C=g.top,W;A>=k+T?W=g.bottom+T:C>=k+T?W=g.top-k-T:W=A>=C?g.bottom+T:Math.max(10,g.top-k-T),c({top:W,left:N}),s(true);};react.useEffect(()=>{let g=x=>{p.current&&!p.current.contains(x.target)&&!n.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let u=g=>{t(g),s(false);},v=d(),b=v.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:n,onClick:()=>o?s(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${b}10`,boxShadow:`0 0 0 2px ${b}30 inset`},title:v.label,children:jsxRuntime.jsx(cl,{icon:v.icon,color:b})}),o&&jsxRuntime.jsx(at,{children:jsxRuntime.jsxs("div",{ref:p,className:"status-selector-menu",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:m.map(g=>jsxRuntime.jsxs("button",{onClick:()=>u(g.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:g.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(cl,{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 ml({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,l]=react.useState(false),[c,p]=react.useState(false),[n,m]=react.useState(e),[d,i]=react.useState({top:0,left:0}),u=react.useRef(null),v=react.useRef(null),b=react.useRef(null);react.useEffect(()=>{if(s&&v.current){let f=v.current.getBoundingClientRect();i({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[s]),react.useEffect(()=>{let f=k=>{u.current&&!u.current.contains(k.target)&&!v.current?.contains(k.target)&&(l(false),p(false));};if(s)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),react.useEffect(()=>{let f=k=>{k.key==="Escape"&&(l(false),p(false),m(e));};if(s)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[s,e]),react.useEffect(()=>{c&&b.current&&(b.current.focus(),b.current.select());},[c]);let g=()=>{p(true),m(e);},x=()=>{let f=n.trim();f&&f!==e&&t(f),p(false),l(false),m(e);},h=f=>{f.key==="Enter"?x():f.key==="Escape"&&(p(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>l(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsxRuntime.jsx(at,{children:jsxRuntime.jsx("div",{ref:u,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:c?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:b,type:"text",value:n,onChange:f=>m(f.target.value),onKeyDown:h,onBlur:x,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:g,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),l(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var Lr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:l,onCardUpdate:c,availableUsers:p,allCards:n,enableVirtualization:m,cardHeight:d=120,isCollapsed:i,onToggleCollapse:u,onColumnRename:v,onColumnDelete:b,isDeletable:g=false,className:x})=>{let{setNodeRef:h,isOver:f}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),k=react.useRef(null),T=m??$i(t.length),N=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>d,enabled:T});if(a)return jsxRuntime.jsx("div",{ref:h,className:x,children:a(e,t)});let C=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let y=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:y}:y>=80?{state:"warning",percentage:y}:y>=60?{state:"approaching",percentage:y}:{state:"ok",percentage:y}})(),W=C.state==="exceeded",D=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:w("asakaa-column",f&&"ring-2 ring-asakaa-accent-blue",W&&"ring-2 ring-asakaa-accent-red",x),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:w(D()),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"})]})]}),(v||b)&&jsxRuntime.jsx(ml,{columnTitle:e.title,onRename:y=>v?.(e.id,y),onDelete:b?()=>b(e.id):void 0,isDeletable:g}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":i?"Expand column":"Collapse column",children:i?"\u25B6":"\u25BC"})]})]}),!i&&jsxRuntime.jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:T?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(y=>y.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):T?jsxRuntime.jsx("div",{style:{height:`${N.getTotalSize()}px`,position:"relative"},children:N.getVirtualItems().map(y=>{let M=t[y.index];return M?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${y.start}px)`},children:jsxRuntime.jsx(Ga,{card:M,render:r,onClick:l,onUpdate:c,availableUsers:p,allCards:n})},M.id):null})}):t.map(y=>jsxRuntime.jsx(Ga,{card:y,render:r,onClick:l,onUpdate:c,availableUsers:p,allCards:n},y.id))})})]})});Lr.displayName="Column";function Gn({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,l]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let p=()=>{let m=s.trim();m&&m!==e?t(m):l(e),o(false);},n=m=>{m.key==="Enter"?p():m.key==="Escape"&&(l(e),o(false));};return r?jsxRuntime.jsx("input",{ref:c,type:"text",value:s,onChange:m=>l(m.target.value),onBlur:p,onKeyDown:n,className:w("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:w("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Vn(){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 Qa({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:l,style:c,isLoading:p,error:n,children:m}){let[d,i]=Vn(),u=o?.theme||"dark",b=u==="dark"||u==="neutral"?"dark":"",g=react.useCallback((D,y)=>{t.onCardUpdate?.(D,y);},[t]),x=react.useCallback((D,y)=>{t.onColumnUpdate?.(D,{title:y});},[t]),h=react.useCallback(D=>{t.onColumnDelete?.(D);},[t]),f=["todo","in-progress","completed"],k=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),T=react.useMemo(()=>{let D=new Map;return e.columns.forEach(y=>{let M=y.cardIds.map(S=>e.cards.find(H=>H.id===S)).filter(S=>S!==void 0).sort((S,H)=>S.position-H.position);D.set(y.id,M);}),D},[e.cards,e.columns]),N=react.useCallback(D=>{let{active:y}=D,M=e.cards.find(S=>S.id===y.id);M&&i({isDragging:true,draggedCardId:M.id,sourceColumnId:M.columnId,targetColumnId:M.columnId});},[e.cards,i]),A=react.useCallback(D=>{let{active:y,over:M}=D;if(!M||!e.cards.find(Y=>Y.id===y.id))return;let H=null;M.data.current?.type==="column"?H=M.id:M.data.current?.type==="card"&&(H=e.cards.find(de=>de.id===M.id)?.columnId||null),H&&H!==d.targetColumnId&&i({...d,targetColumnId:H});},[e.cards,d,i]),C=react.useCallback(async D=>{let{active:y,over:M}=D;if(i({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!M)return;let S=e.cards.find(he=>he.id===y.id);if(!S)return;let H,Y;if(M.data.current?.type==="column"){H=M.id;let he=T.get(H)||[];Y=Fn(he,0);}else {let he=e.cards.find(R=>R.id===M.id);if(!he)return;H=he.columnId;let Ie=T.get(H)||[],Le=Ie.findIndex(R=>R.id===M.id);Y=Fn(Ie,Le);}let de=e.columns.find(he=>he.id===H);if(de&&de.wipLimit&&de.wipLimitType==="hard"){let he=T.get(H)||[];if(S.columnId!==H&&he.length>=de.wipLimit){t.onWipLimitExceeded?.(de,S);return}}(S.columnId!==H||S.position!==Y)&&await t.onCardMove?.(S.id,H,Y);},[e.cards,e.columns,T,t,i]),W=react.useCallback(D=>{a?.(D);},[a]);return p?jsxRuntime.jsx("div",{className:w("asakaa-board",b,l),style:c,children:jsxRuntime.jsx(Kp,{columnCount:3})}):n?jsxRuntime.jsx("div",{className:w("asakaa-board",b,l),style:c,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof n=="string"?n:n.message})]})})}):jsxRuntime.jsx(qi,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:k,collisionDetection:core$1.closestCorners,onDragStart:N,onDragOver:A,onDragEnd:C,children:[jsxRuntime.jsxs("div",{className:w("asakaa-board",b,l),style:c,"data-theme":u,children:[e.columns.sort((D,y)=>D.position-y.position).map(D=>{let y=T.get(D.id)||[],M=!f.includes(D.id);return jsxRuntime.jsx(Lr,{column:D,cards:y,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:W,onCardUpdate:g,onColumnRename:x,onColumnDelete:h,isDeletable:M,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},D.id)}),m]}),jsxRuntime.jsx(core$1.DragOverlay,{children:d.draggedCardId?jsxRuntime.jsx(Ga,{card:e.cards.find(D=>D.id===d.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function Kp({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 Zp={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)"},Qp={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)"},em={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},tm={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function am({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,l]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let n=m=>{c.current&&!c.current.contains(m.target)&&l(false);};return s&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[s]);let p=n=>{t(n),l(false);};return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((n,m)=>n.position-m.position).map((n,m)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(n.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:m<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:n.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:n.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[n.cardIds.length," ",n.cardIds.length===1?"tarea":"tareas"]})]})]},n.id))]})})})]})}function rm({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,l]=react.useState(false),[c,p]=react.useState(null),n=react.useRef(null);if(react.useEffect(()=>{let u=v=>{n.current&&!n.current.contains(v.target)&&l(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(u=>u.handler),i=async(u,v)=>{if(v){p(u);try{await v();}catch(b){console.error(`Export ${u} failed:`,b);}finally{p(null),l(false);}}};return jsxRuntime.jsxs("div",{ref:n,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((u,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(u.id,u.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<d.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:c===u.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):u.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:u.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:u.description})]})]},u.id))})})})]})}function om({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 Kn({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:l,onExportJSON:c,onExportExcel:p,translations:n}){let m=r==="dark"?Zp:Qp,d={...o==="es"?em:tm,...n},i=l||c||p;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:m.bgGrid,borderColor:m.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(rm,{theme:m,t:d,onExportCSV:l,onExportJSON:c,onExportExcel:p}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),t&&(s?jsxRuntime.jsx(am,{columns:e,onSelect:t,theme:m,t:d,createTaskLabel:a}):jsxRuntime.jsx(om,{onClick:()=>t(),label:a||d.newTask}))]})})}function qn({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,l]=react.useState(false),[c,p]=react.useState(""),n=react.useCallback(()=>{let i=c.trim();i&&(e(i),p(""),l(false));},[c,e]),m=react.useCallback(i=>{i.key==="Enter"?(i.preventDefault(),n()):i.key==="Escape"&&(p(""),l(false));},[n]),d=react.useCallback(()=>{setTimeout(()=>{c.trim()||l(false);},150);},[c]);return s?jsxRuntime.jsx("div",{className:w("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:c,onChange:i=>p(i.target.value),onKeyDown:m,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:n,disabled:!c.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{p(""),l(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:w("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>l(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Xn({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:l=false,theme:c="dark",locale:p="es"}){let[n,m]=react.useState(false),[d,i]=react.useState(false),[u,v]=react.useState(""),[b,g]=react.useState([]),[x,h]=react.useState(""),[f,k]=react.useState(""),[T,N]=react.useState(""),[A,C]=react.useState(false),[W,D]=react.useState(false),[y,M]=react.useState(false),S=react.useRef(null),H=react.useRef(null),Y={placeholder:o||(p==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(p==="es"?"Agregar Tarea":"Add Task"),save:p==="es"?"Guardar":"Save",addAssignee:p==="es"?"Agregar asignado":"Add assignee",addDates:p==="es"?"Agregar fechas":"Add dates",addPriority:p==="es"?"Agregar prioridad":"Add priority",startDate:p==="es"?"Inicio":"Start",endDate:p==="es"?"Fin":"End",low:p==="es"?"Baja":"Low",medium:p==="es"?"Media":"Medium",high:p==="es"?"Alta":"High",urgent:p==="es"?"Urgente":"Urgent"},de=react.useCallback(()=>{v(""),g([]),h(""),k(""),N(""),C(false),D(false),M(false),m(false);},[]);react.useEffect(()=>{n&&S.current&&S.current.focus();},[n]),react.useEffect(()=>{if(!n)return;let F=U=>{H.current&&!H.current.contains(U.target)&&(u.trim()||de());};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[n,u,de]);let he=react.useCallback(async()=>{let F=u.trim();if(!(!F||d)){i(true);try{await t({name:F,columnId:e,assigneeIds:b.length>0?b:void 0,startDate:x?new Date(x):void 0,endDate:f?new Date(f):void 0,priority:T||void 0}),v(""),g([]),h(""),k(""),N(""),C(!1),D(!1),M(!1),S.current?.focus();}catch(U){console.error("Error creating card:",U);}finally{i(false);}}},[u,e,b,x,f,T,t,d]),Ie=react.useCallback(F=>{F.key==="Enter"&&!F.shiftKey?(F.preventDefault(),he()):F.key==="Escape"&&de();},[he,de]),Le=react.useCallback(F=>{g(U=>U.includes(F)?U.filter(E=>E!==F):[...U,F]);},[]),R=c==="dark";return n?jsxRuntime.jsxs("div",{ref:H,className:w("rounded-lg overflow-hidden shadow-lg",R?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:S,type:"text",value:u,onChange:F=>v(F.target.value),onKeyDown:Ie,placeholder:Y.placeholder,disabled:d,className:w("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",R?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>C(!A),className:w("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",A||b.length>0?"bg-emerald-500/20 text-emerald-400":R?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:Y.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"})]}),b.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:b.length})]}),jsxRuntime.jsx("button",{onClick:()=>D(!W),className:w("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",W||x||f?"bg-blue-500/20 text-blue-400":R?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:Y.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:()=>M(!y),className:w("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",y||T?T==="urgent"?"bg-red-500/20 text-red-400":T==="high"?"bg-orange-500/20 text-orange-400":T==="medium"?"bg-yellow-500/20 text-yellow-400":T==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":R?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:Y.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:he,disabled:!u.trim()||d,className:w("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):Y.save})]})]}),A&&a.length>0&&jsxRuntime.jsx("div",{className:w("px-3 pb-3 pt-0","border-t",R?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(F=>jsxRuntime.jsxs("button",{onClick:()=>Le(F.id),className:w("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",b.includes(F.id)?"bg-emerald-500 text-white":R?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[F.avatar?jsxRuntime.jsx("img",{src:F.avatar,alt:F.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:w("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",b.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))})}),W&&jsxRuntime.jsx("div",{className:w("px-3 pb-3 pt-0","border-t",R?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:w("block text-[10px] uppercase tracking-wide mb-1",R?"text-gray-500":"text-gray-400"),children:Y.startDate}),jsxRuntime.jsx("input",{type:"date",value:x,onChange:F=>h(F.target.value),className:w("w-full px-2 py-1.5 rounded text-xs border",R?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:w("block text-[10px] uppercase tracking-wide mb-1",R?"text-gray-500":"text-gray-400"),children:Y.endDate}),jsxRuntime.jsx("input",{type:"date",value:f,onChange:F=>k(F.target.value),className:w("w-full px-2 py-1.5 rounded text-xs border",R?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),y&&jsxRuntime.jsx("div",{className:w("px-3 pb-3 pt-0","border-t",R?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(F=>jsxRuntime.jsx("button",{onClick:()=>N(T===F?"":F),className:w("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",T===F?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[F]} text-white`:R?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:Y[F]},F))})})]}):jsxRuntime.jsxs("button",{onClick:()=>m(true),disabled:l,className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",R?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",l&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:Y.buttonLabel})]})}var so=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(Qa,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
5
+ `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(l=>{l?o(l):s(new Error("Failed to create PNG blob"));},"image/png");})}};function Dl(e={}){return new so(e)}var Fr=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(l){console.error("Error in error handler:",l);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:l}=this.props;return a&&r?s?s(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:l?`Error in ${l}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function Jn(e,t){let a=r=>jsxRuntime.jsx(Fr,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Qn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:l,onPredictRisks:c,onOpenAIUsage:p,shortcut:n="k",className:m=""}){let[d,i]=react.useState(false),[u,v]=react.useState(""),[b,g]=react.useState("home"),[x,h]=react.useState(""),[f,k]=react.useState("");react.useEffect(()=>{let C=W=>{(W.metaKey||W.ctrlKey)&&W.key===n&&(W.preventDefault(),i(D=>!D)),W.key==="Escape"&&(i(false),g("home"),v(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[n]),react.useEffect(()=>{d||(g("home"),v(""),h(""),k(""));},[d]);let T=react.useCallback(()=>{i(false);},[]),N=react.useCallback(C=>{let[W,D]=C.split(":");switch(W){case "create-card":g("create-card");break;case "create-card-in":h(D||"");break;case "navigate":D?(a?.(D),T()):g("navigate");break;case "search":r?.(u),T();break;case "priority":g("priority");break;case "set-priority":f&&D&&(o?.(f,D),T());break;case "assign":g("assign");break;case "assign-user":f&&D&&(s?.(f,D),T());break;case "ai":g("ai");break;case "ai-generate-plan":l?.(),T();break;case "ai-predict-risks":c?.(),T();break;case "ai-usage":p?.(),T();break;case "back":g("home");break;}},[u,f,t,a,r,o,s,l,c,p,T]),A=react.useCallback(()=>{x&&u.trim()&&(t?.(x,u.trim()),T());},[x,u,t,T]);return d?jsxRuntime.jsx(at,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:T,children:jsxRuntime.jsx("div",{className:`command-palette ${m}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,onValueChange:v,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:b==="create-card"&&x?"Type card title and press Enter...":b==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&b==="create-card"&&x&&A();}}),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."}),b==="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:N,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:N,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:N,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:N,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:N,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(W=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:W},W))})]},C.id))})]}),b==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,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:N,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))})]}),b==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,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 W=e.columns.find(D=>D.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:N,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:W?.title})]}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(D=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:D},D))})]},C.id)})})]}),b==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,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:N,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:N,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:N,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 um(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 gm(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 Br(e){return e.startsWith("image/")}function $a({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[l,c]=react.useState(false),[p,n]=react.useState(false),[m,d]=react.useState(null),[i,u]=react.useState(null),v=react.useRef(null);react.useEffect(()=>{let y=M=>{if(i){if(M.key==="Escape")u(null);else if(M.key==="ArrowLeft"||M.key==="ArrowRight"){let S=e.filter(he=>Br(he.type)),H=S.findIndex(he=>he.id===i.id);if(H===-1)return;let Y;M.key==="ArrowLeft"?Y=H>0?H-1:S.length-1:Y=H<S.length-1?H+1:0;let de=S[Y];de&&u(de);}}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[i,e]);let b=react.useCallback((y,M)=>{M.preventDefault(),M.stopPropagation(),u(y);},[]),g=react.useCallback(()=>{u(null);},[]),x=react.useCallback((y,M)=>{M.stopPropagation();let S=e.filter(he=>Br(he.type)),H=S.findIndex(he=>he.id===i?.id);if(H===-1)return;let Y;y==="prev"?Y=H>0?H-1:S.length-1:Y=H<S.length-1?H+1:0;let de=S[Y];de&&u(de);},[e,i]),h=react.useCallback(y=>{let M=[],S=[];return e.length+y.length>s?(S.push(`Maximum ${s} files allowed`),{valid:M,errors:S}):(y.forEach(H=>{if(H.size/1048576>r){S.push(`${H.name} is too large (max ${r}MB)`);return}if(o&&!o.some(de=>H.type.match(de))){S.push(`${H.name} has invalid file type`);return}M.push(H);}),{valid:M,errors:S})},[e.length,s,r,o]),f=react.useCallback(async y=>{let{valid:M,errors:S}=h(y);if(S.length>0){d(S.join(", ")),setTimeout(()=>d(null),5e3);return}if(M.length!==0){n(true),d(null);try{await t?.(M);}catch(H){d(H instanceof Error?H.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{n(false);}}},[h,t]),k=react.useCallback(y=>{y.preventDefault(),y.stopPropagation(),c(true);},[]),T=react.useCallback(y=>{y.preventDefault(),y.stopPropagation(),c(false);},[]),N=react.useCallback(y=>{y.preventDefault(),y.stopPropagation();},[]),A=react.useCallback(y=>{y.preventDefault(),y.stopPropagation(),c(false);let M=Array.from(y.dataTransfer.files);f(M);},[f]),C=react.useCallback(y=>{let M=y.target.files?Array.from(y.target.files):[];f(M),v.current&&(v.current.value="");},[f]),W=react.useCallback(()=>{v.current?.click();},[]),D=react.useCallback(y=>{confirm("Are you sure you want to delete this attachment?")&&a?.(y);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${l?"dragging":""} ${p?"uploading":""}`,onDragEnter:k,onDragLeave:T,onDragOver:N,onDrop:A,onClick:W,children:[jsxRuntime.jsx("input",{ref:v,type:"file",multiple:true,onChange:C,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:l?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),m&&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:m})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(y=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Br(y.type)&&y.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:M=>b(y,M),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:y.thumbnailUrl||y.url,alt:y.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:gm(y.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:y.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:y.name,children:y.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:um(y.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(y.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>D(y.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"})})})]},y.id))}),i&&reactDom.createPortal(jsxRuntime.jsxs("div",{className:"attachment-lightbox",onClick:g,children:[jsxRuntime.jsx("img",{src:i.url,alt:i.name,className:"attachment-lightbox-image",onClick:y=>y.stopPropagation()}),jsxRuntime.jsx("div",{className:"attachment-lightbox-hint",children:"Click anywhere or press ESC to close"}),e.filter(y=>Br(y.type)).length>1&&jsxRuntime.jsx("div",{className:"attachment-lightbox-dots",onClick:y=>y.stopPropagation(),children:e.filter(y=>Br(y.type)).map((y,M)=>jsxRuntime.jsx("button",{type:"button",className:`attachment-lightbox-dot ${y.id===i.id?"active":""}`,onClick:()=>u(y),title:`Image ${M+1}`},y.id))}),e.filter(y=>Br(y.type)).length>1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",className:"attachment-lightbox-nav-area attachment-lightbox-nav-prev",onClick:y=>x("prev",y),title:"Previous (\u2190)",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M15 18L9 12L15 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("button",{type:"button",className:"attachment-lightbox-nav-area attachment-lightbox-nav-next",onClick:y=>x("next",y),title:"Next (\u2192)",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M9 18L15 12L9 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),document.body)]})}function ts({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:c=[],aiInsights:p=[],attachments:n=[],onAddComment:m,onDeleteComment:d,onUploadAttachments:i,onDeleteAttachment:u,onSuggestAssignee:v,onGenerateSubtasks:b,onEstimateEffort:g,currentUserId:x="user-1"}){let[h,f]=react.useState("details"),[k,T]=react.useState(false),[N,A]=react.useState({}),[C,W]=react.useState(""),[D,y]=react.useState(false),[M,S]=react.useState({});if(!t||!e)return null;let H=react.useCallback(()=>{T(false),A({}),f("details"),W(""),S({}),a();},[a]),Y=react.useCallback(()=>{r&&Object.keys(N).length>0&&(r(e.id,N),A({}),T(false));},[e.id,N,r]),de=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),H());},[e.id,o,H]),he=react.useCallback(()=>{m&&C.trim()&&(m(e.id,C.trim()),W(""));},[e.id,C,m]),Ie=react.useCallback(async()=>{if(v){y(true);try{let E=await v(e);S(X=>({...X,assignees:E}));}catch(E){console.error("Failed to suggest assignee:",E);}finally{y(false);}}},[e,v]),Le=react.useCallback(async()=>{if(b){y(true);try{let E=await b(e);S(X=>({...X,subtasks:E}));}catch(E){console.error("Failed to generate subtasks:",E);}finally{y(false);}}},[e,b]),R=react.useCallback(async()=>{if(g){y(true);try{let E=await g(e);S(X=>({...X,effort:E}));}catch(E){console.error("Failed to estimate effort:",E);}finally{y(false);}}},[e,g]),F={...e,...N},U=s.filter(E=>F.assignedUserIds?.includes(E.id));return jsxRuntime.jsx(at,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:H,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:E=>E.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:N.title??F.title,onChange:E=>A({...N,title:E.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:Y,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{T(false),A({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>T(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick: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:H,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>f("details"),className:`card-detail-tab ${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:()=>f("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",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("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",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("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",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("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:N.description??F.description??"",onChange:E=>A({...N,description:E.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:N.assignedUserIds??F.assignedUserIds??[],onChange:E=>{let X=Array.from(E.target.selectedOptions,ee=>ee.value);A({...N,assignedUserIds:X});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(E=>jsxRuntime.jsx("option",{value:E.id,children:E.name},E.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:U.length>0?U.map(E=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:E.color},children:E.initials}),jsxRuntime.jsx("span",{children:E.name})]},E.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:N.priority??F.priority??"",onChange:E=>A({...N,priority:E.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(E=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:E},E)):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:N.startDate?new Date(N.startDate).toISOString().split("T")[0]:F.startDate?new Date(F.startDate).toISOString().split("T")[0]:"",onChange:E=>A({...N,startDate:E.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:N.endDate?new Date(N.endDate).toISOString().split("T")[0]:F.endDate?new Date(F.endDate).toISOString().split("T")[0]:"",onChange:E=>A({...N,endDate:E.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:N.estimatedTime??F.estimatedTime??"",onChange:E=>A({...N,estimatedTime:E.target.value?parseFloat(E.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(E=>{let X=typeof E=="string"?E:E.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",X.slice(-4)]},X)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children: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:E=>W(E.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:he,disabled:!C.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:l.length>0?l.map(E=>{let X=s.find(ee=>ee.id===E.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[X&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:X.color},children:X.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:X?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(E.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(E.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:E.content})]},E.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:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(E=>{let X=s.find(ee=>ee.id===E.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[E.type.includes("CREATED")&&"\u2795",E.type.includes("UPDATED")&&"\u270F\uFE0F",E.type.includes("MOVED")&&"\u27A1\uFE0F",E.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",E.type.includes("COMMENT")&&"\u{1F4AC}",E.type.includes("ASSIGNED")&&"\u{1F464}",E.type.includes("PRIORITY")&&"\u{1F3AF}",E.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",E.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:X?.name||"Unknown"})," ",E.type.replace(/_/g," ").toLowerCase(),E.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:E.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(E.timestamp).toLocaleString()})]})]},E.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($a,{cardId:e.id,attachments:n,onUpload:i?E=>i(e.id,E):void 0,onDelete:u,currentUserId:x,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:Ie,disabled:D||!v,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:Le,disabled:D||!b,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:R,disabled:D||!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"]})]}),M.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),M.assignees.map((E,X)=>{let ee=s.find($=>$.id===E.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ee&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ee.color},children:ee.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ee?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:E.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(E.confidence*100).toFixed(0),"%"]})]})]},X)})]}),M.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),M.subtasks.map((E,X)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:E.title}),E.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:E.description}),E.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",E.estimatedTime,"h"]})]},X))]}),M.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:[M.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(M.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),p.map(E=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${E.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:E.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:E.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:E.description}),E.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",E.suggestedAction]})]},E.id))]}),!M.assignees&&!M.subtasks&&!M.effort&&p.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 lo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:l=""}){let[c,p]=react.useState({top:0,left:0}),n=react.useRef(null),m=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),i=window.innerHeight,u=window.innerWidth,v=4,b=d.left;b+o>u-10&&(b=u-o-10),b<10&&(b=10);let g=i-d.bottom,x=d.top,h;return g>=s+v?h=d.bottom+v:x>=s+v?h=d.top-s-v:g>=x?h=d.bottom+v:h=Math.max(10,d.top-s-v),{top:h,left:b}},[e,o,s]);return react.useEffect(()=>{t&&p(m());},[t,m]),react.useEffect(()=>{if(!t)return;let d=u=>{let v=u.target;n.current&&!n.current.contains(v)&&e.current&&!e.current.contains(v)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(at,{children:jsxRuntime.jsx("div",{ref:n,className:`smart-popover ${l}`,style:{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var _o=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Or({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:l=true}){let[c,p]=react.useState(false),[n,m]=react.useState(""),[d,i]=react.useState(false),[u,v]=react.useState(_o[10]||"#3B82F6"),[b,g]=react.useState({top:0,left:0}),x=react.useRef(null),h=react.useRef(null),f=react.useRef(null),k=react.useRef(null),T=t.filter(y=>y.name.toLowerCase().includes(n.toLowerCase())),N=t.some(y=>y.name.toLowerCase()===n.toLowerCase());react.useEffect(()=>{if(c&&h.current){let y=h.current.getBoundingClientRect();g({top:y.bottom+6,left:y.left});}},[c]),react.useEffect(()=>{let y=M=>{let S=M.target,H=x.current?.contains(S),Y=f.current?.contains(S);!H&&!Y&&(p(false),m(""),i(false));};if(c)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]),react.useEffect(()=>{c&&k.current&&k.current.focus();},[c]);let A=y=>{let M=e.some(S=>S.id===y.id);a(M?e.filter(S=>S.id!==y.id):[...e,y]);},C=async()=>{if(!(!r||!n.trim())){i(true);try{let y=await r(n.trim(),u);y&&(a([...e,y]),m(""),v(_o[Math.floor(Math.random()*_o.length)]||"#3B82F6"));}finally{i(false);}}},W=(y,M)=>{M.stopPropagation(),a(e.filter(S=>S.id!==y));},D={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&p(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:D,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(y=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${y.color}20`,color:y.color},children:y.name},y.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Etiquetas"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:f,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:b.top,left:b.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:n,onChange:y=>m(y.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:y=>{y.key==="Enter"&&n.trim()&&!N&&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(y=>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:`${y.color}20`,color:y.color},onClick:M=>W(y.id,M),children:[y.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},y.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:T.length>0?T.map(y=>{let M=e.some(S=>S.id===y.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>A(y),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:M?`${y.color}15`:"transparent",color:o.textPrimary},onMouseEnter:S=>{M||(S.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:S=>{M||(S.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:y.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:y.name}),M&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:y.color}})]},y.id)}):n.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),n.trim()&&!N&&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:_o.map(y=>jsxRuntime.jsx("button",{type:"button",onClick:()=>v(y),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:y,outline:u===y?`2px solid ${y}`:"none",outlineOffset:"2px"}},y))}),jsxRuntime.jsxs("button",{type:"button",onClick:C,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:u,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',n.trim(),'"']})]})]})}),document.body)]})}function os({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 Pl({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(os,{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 Ge={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#06B6D4",todayLight:"rgba(6, 182, 212, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#0891B2",todayLight:"rgba(8, 145, 178, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var Pm=["LOW","MEDIUM","HIGH","URGENT"],Mm=["todo","in-progress","review","done"];function ss({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:c=[],onAddComment:p,onDeleteComment:n,currentUser:m,onAIGenerateDescription:d,onAICreateSubtasks:i,onAIFindSimilar:u,availableColumns:v=[],availableLabels:b=[],availableTags:g=[],onCreateTag:x,onUploadCoverImage:h,unsplashAccessKey:f,theme:k,onSubtasksChange:T,attachments:N=[],onUploadAttachments:A,onDeleteAttachment:C}){let W=Mr(),D=k||W?.themeName||"dark",[y,M]=react.useState(e),[S,H]=react.useState(false),[Y,de]=react.useState(e?.subtasks||[]),[he,Ie]=react.useState(false),[Le,R]=react.useState(""),[F,U]=react.useState(""),[E,X]=react.useState("all"),[ee,$]=react.useState(false),[Me,ve]=react.useState(false),[qe,ge]=react.useState(false),[et,Te]=react.useState(false),[ot,gt]=react.useState(false),[ft,tt]=react.useState(false),B=react.useRef(null),se=react.useRef(null),xe=react.useRef(null),De=react.useRef(null),Ee=react.useRef(null),Ve=react.useRef(null),Ct=react.useRef(null),q=react.useRef(null),O=react.useRef(null),we=react.useRef(null),We=react.useRef(null),Ue=react.useRef(null);react.useEffect(()=>{e&&!y?(M({...e}),de(e.subtasks||[])):e&&y&&e.id!==y.id&&(M({...e}),de(e.subtasks||[]));},[e,y]),react.useEffect(()=>{let z=pe=>{let Ce=pe.target;De.current&&!De.current.contains(Ce)&&$(false),Ee.current&&!Ee.current.contains(Ce)&&ve(false),Ve.current&&!Ve.current.contains(Ce)&&ge(false),Ct.current&&!Ct.current.contains(Ce)&&Te(false);};if(ee||Me||qe||et)return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[ee,Me,qe,et]),react.useEffect(()=>{if(!t)return;let z=pe=>{let Ce=pe.target,$t=Ce.tagName==="INPUT"||Ce.tagName==="TEXTAREA"||Ce.isContentEditable;if(pe.key==="Escape"){pe.preventDefault(),ee||Me||qe||et||ot||ft?($(false),ve(false),ge(false),Te(false),gt(false),tt(false)):$t||a();return}if($t&&pe.key!=="Escape")return;let ea=pe.metaKey||pe.ctrlKey;switch(pe.key.toLowerCase()){case "s":pe.preventDefault(),$(true);break;case "a":pe.preventDefault(),ge(true);break;case "p":pe.preventDefault(),ve(true);break;case "l":pe.preventDefault(),Te(true);break;case "d":ea||(pe.preventDefault(),gt(true),setTimeout(()=>q.current?.focus(),0));break;case "e":ea||(pe.preventDefault(),tt(true));break;case "i":pe.preventDefault(),H(true),setTimeout(()=>se.current?.focus(),0);break;case "t":pe.preventDefault(),Ie(true);break;case "c":pe.preventDefault(),xe.current?.focus();break}};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[t,a,ee,Me,qe,et,ot,ft]);let ht=react.useCallback(z=>{let pe=z.currentTarget.textContent?.trim()||"";if(y&&pe!==y.title){let Ce={...y,title:pe};M(Ce),r?.(y.id,{title:pe});}},[y,r]),Z=react.useCallback(z=>{z.key==="Enter"&&(z.preventDefault(),z.currentTarget.blur()),z.key==="Escape"&&(z.preventDefault(),z.currentTarget.textContent=y?.title||"",z.currentTarget.blur());},[y]),te=react.useCallback(()=>{y&&e&&y.description!==e.description&&r?.(y.id,{description:y.description}),H(false);},[y,e,r]),ke=react.useCallback(z=>{if(y){let pe={...y,columnId:z};M(pe),r?.(y.id,{columnId:z}),$(false);}},[y,r]),Pe=react.useCallback(z=>{if(y){let pe={...y,priority:z};M(pe),r?.(y.id,{priority:z}),ve(false);}},[y,r]),J=react.useCallback(z=>{if(y){let pe=y.assignedUserIds||[],Ce=pe.includes(z)?pe.filter(ea=>ea!==z):[...pe,z],$t={...y,assignedUserIds:Ce};M($t),r?.(y.id,{assignedUserIds:Ce});}},[y,r]),Ae=react.useCallback(z=>{if(y){let pe=y.labels||[],Ce=pe.includes(z)?pe.filter(ea=>ea!==z):[...pe,z],$t={...y,labels:Ce};M($t),r?.(y.id,{labels:Ce});}},[y,r]),ye=react.useCallback(z=>{if(y){let pe={...y,tags:z};M(pe),r?.(y.id,{tags:z});}},[y,r]),Ne=react.useCallback(z=>{if(y){let pe=z.target.value,Ce={...y,endDate:pe};M(Ce),r?.(y.id,{endDate:pe}),gt(false);}},[y,r]),ce=react.useCallback(z=>{if(y){let pe={...y,estimatedTime:parseFloat(z)||0};M(pe),r?.(y.id,{estimatedTime:parseFloat(z)||0});}},[y,r]),Re=react.useCallback(()=>{if(Le.trim()&&y){let z={id:`subtask-${Date.now()}`,title:Le.trim(),completed:false,createdAt:new Date},pe=[...Y,z];de(pe),R(""),Ie(false),T?.(y.id,pe);}},[Le,Y,y,T]),Fe=react.useCallback(z=>{let pe=Y.map(Ce=>Ce.id===z?{...Ce,completed:!Ce.completed,updatedAt:new Date}:Ce);de(pe),y&&T?.(y.id,pe);},[Y,y,T]),Oe=react.useCallback(z=>{let pe=Y.filter(Ce=>Ce.id!==z);de(pe),y&&T?.(y.id,pe);},[Y,y,T]),_=react.useCallback(()=>{F.trim()&&y&&p&&(p(y.id,F.trim()),U(""));},[F,y,p]),j=react.useCallback(z=>{(z.metaKey||z.ctrlKey)&&z.key==="Enter"&&(z.preventDefault(),_());},[_]),st=z=>jsxRuntime.jsx(Nm__default.default,{remarkPlugins:[Sm__default.default],rehypePlugins:[Em__default.default],components:{a:({node:pe,...Ce})=>jsxRuntime.jsx("a",{...Ce,target:"_blank",rel:"noopener noreferrer"})},children:z}),He=c.filter(z=>E==="comments"?z.type.includes("COMMENT"):E==="history"?!z.type.includes("COMMENT"):true);if(!t||!e)return null;let fe=y||e,Vt=s.filter(z=>fe.assignedUserIds?.includes(z.id)),Tt=Y.filter(z=>z.completed).length;return jsxRuntime.jsx(at,{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":D,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:B,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ht,onKeyDown:Z,children:fe.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:De,children:[jsxRuntime.jsxs("button",{ref:O,className:"modal-v2-field",onClick:()=>$(!ee),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:fe.columnId||"No status"})]}),jsxRuntime.jsx(lo,{triggerRef:O,isOpen:ee,onClose:()=>$(false),width:250,estimatedHeight:200,children:(v.length>0?v:Mm.map(z=>({id:z,title:z}))).map(z=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${fe.columnId===z.id?"active":""}`,onClick:()=>ke(z.id),children:z.title},z.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ve,children:[jsxRuntime.jsxs("button",{ref:we,className:"modal-v2-field",onClick:()=>ge(!qe),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:Vt.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Vt.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(lo,{triggerRef:we,isOpen:qe,onClose:()=>ge(false),width:280,estimatedHeight:300,children:s.map(z=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${fe.assignedUserIds?.includes(z.id)?"active":""}`,onClick:()=>J(z.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:z.color},children:z.initials}),z.name,fe.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:Ee,children:[jsxRuntime.jsxs("button",{ref:We,className:"modal-v2-field",onClick:()=>ve(!Me),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:fe.priority||"None"})]}),jsxRuntime.jsxs(lo,{triggerRef:We,isOpen:Me,onClose:()=>ve(false),width:180,estimatedHeight:220,children:[Pm.map(z=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${z.toLowerCase()} ${fe.priority===z?"active":""}`,onClick:()=>Pe(z),children:z},z)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Pe(""),children:"None"})]})]}),g.length>0||x?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(Or,{selectedTags:fe.tags||[],availableTags:g,onChange:ye,onCreateTag:x,theme:Ge[D]||Ge.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ct,children:[jsxRuntime.jsxs("button",{ref:Ue,className:"modal-v2-field",onClick:()=>Te(!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("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:fe.labels&&fe.labels.length>0?jsxRuntime.jsx("span",{children:fe.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(lo,{triggerRef:Ue,isOpen:et,onClose:()=>Te(false),width:220,estimatedHeight:200,children:(b.length>0?b:["Bug","Feature","Enhancement","Documentation"]).map(z=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${fe.labels?.includes(z)?"active":""}`,onClick:()=>Ae(z),children:[z,fe.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:()=>{gt(!ot),setTimeout(()=>q.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:fe.endDate?new Date(fe.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:q,type:"date",value:typeof fe.endDate=="string"?fe.endDate.split("T")[0]:fe.endDate?(()=>{let z=new Date(fe.endDate),pe=z.getUTCFullYear(),Ce=String(z.getUTCMonth()+1).padStart(2,"0"),$t=String(z.getUTCDate()).padStart(2,"0");return `${pe}-${Ce}-${$t}`})():"",onChange:Ne,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>tt(!ft),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:fe.estimatedTime?`${fe.estimatedTime}h`:"Not set"})]}),ft&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:fe.estimatedTime||"",onChange:z=>ce(z.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>tt(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"})]}),S?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:fe.description||"",onChange:z=>{if(y){let pe={...y,description:z.target.value};M(pe);}},onBlur:te,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>H(true),children:fe.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:st(fe.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"}),Y.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Tt,"/",Y.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ie(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:[Y.map(z=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${z.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Fe(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:()=>Oe(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)),he&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:Le,onChange:z=>R(z.target.value),onKeyDown:z=>{z.key==="Enter"&&Re(),z.key==="Escape"&&(Ie(false),R(""));},onBlur:Re,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(A||N.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"}),N.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:N.length})]}),jsxRuntime.jsx($a,{cardId:fe.id,attachments:N,onUpload:A?z=>A(fe.id,z):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 ${E==="all"?"active":""}`,onClick:()=>X("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${E==="comments"?"active":""}`,onClick:()=>X("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${E==="history"?"active":""}`,onClick:()=>X("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:xe,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:F,onChange:z=>U(z.target.value),onKeyDown:j,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:_,disabled:!F.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[He.map(z=>{let pe=s.find($t=>$t.id===z.userId);if(z.type.includes("COMMENT")){let $t=l.find(ea=>ea.id===z.metadata?.commentId);return $t?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[pe&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:pe.color},children:pe.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:pe?.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:$t.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:pe?.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)}),He.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 zm({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 ls({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(l=>({...l,average:l.average??e.reduce((c,p)=>c+p.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(zm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((l,c)=>l+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((l,c)=>l+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(l=>l.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((l,c)=>l+(c.planned||0),0)})]})]})]})}function Ym({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 ds({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),l=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,p=s>0?(s-l)/s*100:0,n=l<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ym,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",fill:n?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:n?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:p>=50?"#10B981":"#F59E0B"},children:[p.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:n?"#10B981":"#EF4444"},children:l})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:n?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:n?"#10B981":"#EF4444"},children:n?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var ru={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Rl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function ou({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let l=r+(o-r)*.5,c=e+l*Math.cos(-a*(Math.PI/180)),p=t+l*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:p,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Ol({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 cs({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((p,n)=>p+n.value,0),l=e.map(p=>({...p,totalValue:s,color:p.color||ru[p.name]||Rl[e.indexOf(p)%Rl.length]})),c=l.map(p=>p.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:l,cx:"50%",cy:"50%",labelLine:false,label:o?ou:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:l.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ol,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,n)=>{let m=n.payload,d=s>0?(m.value/s*100).toFixed(0):"0";return `${p} (${m.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:l,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ol,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:l.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((p,n)=>n.value>p.value?n:p).name})]})]})]})}var jo=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[l,c]=react.useState(false),[p,n]=react.useState(false),[m,d]=react.useState(false),[i,u]=react.useState(false);if(e.length===0)return null;let v=e.map(k=>k.id),b=k=>{r.onBulkUpdate?.(v,{priority:k}),c(false);},g=k=>{r.onBulkMove?.(v,k),n(false),a();},x=k=>{r.onBulkUpdate?.(v,{assignedUserIds:k}),d(false);},h=k=>{let T=new Set;e.forEach(A=>{A.labels?.forEach(C=>T.add(C));});let N=Array.from(new Set([...T,...k]));r.onBulkUpdate?.(v,{labels:N}),u(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(v),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!l),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(k),children:[jsxRuntime.jsx("span",{className:w("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:()=>n(!p),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),p&&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:()=>d(!m),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([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:()=>u(!i),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(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:f,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});jo.displayName="BulkOperationsToolbar";function du(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,l,c,p,n;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(u=>{let v=a?.find(b=>b.id===u);l=`assignee-${u}`,c=v?.name||`User ${u}`,p=v?.color,n=v?.avatar,r.has(l)||r.set(l,{id:l,title:c,groupValue:u,cardIds:[],color:p,icon:n}),r.get(l).cardIds.push(o.id);}):(l="assignee-unassigned",c="Unassigned",p="#6b7280",n="\u{1F464}",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:p,icon:n}),r.get(l).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",l=`priority-${s}`;let i={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=i.title,p=i.color,r.has(l)||r.set(l,{id:l,title:c,groupValue:s,cardIds:[],color:p}),r.get(l).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{l=`label-${u}`,c=u,p="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:u,cardIds:[],color:p}),r.get(l).cardIds.push(o.id);}):(l="label-none",c="No Labels",p="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:p}),r.get(l).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function ps({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,l]=react.useState(new Set),c=react.useMemo(()=>du(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=react.useCallback(n=>{l(m=>{let d=new Set(m);return d.has(n)?d.delete(n):d.add(n),d});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Qa,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:w("asakaa-swimlane-view",o),children:[c.map(n=>{let m=s.has(n.id),d=e.cards.filter(u=>n.cardIds.includes(u.id)),i={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&p(n.id),style:{borderLeft:n.color?`4px solid ${n.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:n.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:n.color},children:n.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",n.cardIds.length," ",n.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Qa,{board:i,callbacks:r,availableUsers:a})})]},n.id)}),c.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var ms=[{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 us({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null),c=ms.find(n=>n.value===e)||ms[0];react.useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&l.current&&!l.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let p=n=>{t(n),o(false);};return jsxRuntime.jsxs("div",{className:w("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:w("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:ms.map(n=>jsxRuntime.jsxs("button",{onClick:()=>p(n.value),className:w("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===n.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:n.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:n.label}),e===n.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:n.description})]})]},n.value))})]})]})}var po=[{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 mu(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(n=>e.key===n||e.code===n))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,l=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return s&&l&&c&&p}function Hl(e={}){let{shortcuts:t=po,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let l=react.useCallback(p=>{o.current=[...o.current,p];},[]),c=react.useCallback(p=>{o.current=o.current.filter(n=>n.action!==p);},[]);return react.useEffect(()=>{function p(n){if(!s.current)return;let m=n.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&n.key!=="Escape"&&!n.ctrlKey&&!n.metaKey)){for(let d of o.current)if(mu(n,d)){r&&n.preventDefault();let i=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:l,unregisterShortcut:c,isEnabled:a}}function gu(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function fu(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 hu(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=fu(e),r=t?gu(t):"";return a?`${a} + ${r}`:r}function bu(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function gs({shortcuts:e=po,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function c(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let l=bu(e);return jsxRuntime.jsxs("div",{className:w("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(l).map(([c,p])=>p.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:p.map(n=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:n.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:hu(n)})]},n.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var fs=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
6
6
  1.
7
7
 
8
8
  **Expected behavior:**
@@ -42,7 +42,7 @@
42
42
  1.
43
43
 
44
44
  **Action items:**
45
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function hs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&l.current&&!l.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=n=>{t(n),o(false);},p=e.reduce((n,m)=>{let d=m.category||"Other";return n[d]||(n[d]=[]),n[d].push(m),n},{});return jsxRuntime.jsxs("div",{className:w("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",n.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",n.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:w("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(p).map(([n,m])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:n})}),jsxRuntime.jsx("div",{children:m.map(d=>jsxRuntime.jsxs("button",{onClick:()=>c(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},n)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function ys({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[l,c]=react.useState("export"),[p,n]=react.useState("json"),[m,d]=react.useState(null),i=react.useRef(null);if(!t)return null;let u=async()=>{let b=o?.current||void 0,g=await Hi(e,p,b);Gi(g,p);},v=async b=>{let g=b.target.files?.[0];if(g){try{let x=await ji(g),h=g.name.endsWith(".json")?"json":"csv",f=Vi(x,h);d(f),f.success&&r&&r(f,x);}catch(x){d({success:false,errors:[`Failed to read file: ${x instanceof Error?x.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxRuntime.jsxs("div",{className:w("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>c("export"),className:w("flex-1 px-6 py-4 font-semibold transition-colors",l==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:w("flex-1 px-6 py-4 font-semibold transition-colors",l==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[l==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(b=>jsxRuntime.jsxs("button",{onClick:()=>n(b),className:w("p-4 rounded-lg border-2 transition-all text-center",p===b?"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:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:u,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),l==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:i,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>i.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),m&&jsxRuntime.jsxs("div",{className:w("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:w("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:m.errors.map((b,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},g))})]})]})]})]})]})}var ku=["URGENT","HIGH","MEDIUM","LOW"],wu=[{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"}],Cu=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function vs({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:l,onFilterHighPriority:c,availableUsers:p=[],availableLabels:n=[],availableColumns:m=[],showQuickFilters:d=true,compact:i=false,groupBy:u="none",onGroupByChange:v}){let[b,g]=react.useState(true),x=react.useCallback(N=>{a({search:N.target.value});},[a]),h=react.useCallback(N=>{a({dateFilter:N.target.value});},[a]),f=react.useCallback(N=>{r({by:N.target.value});},[r]),k=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),T=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${b?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:N=>{N.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:b?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),T&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!b&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:x,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:N=>{let A=N.target.value;a({priorities:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),ku.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),p.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:N=>{let A=N.target.value;a({assignees:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),p.map(N=>jsxRuntime.jsx("option",{value:N.id,children:N.name},N.id))]})}),n.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:N=>{let A=N.target.value;a({labels:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),n.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:f,className:"filter-bar__select filter-bar__select--sm",children:wu.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.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"})]}),v&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:N=>v(N.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Cu.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))})}),T&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function xs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:l,onExportGanttPNG:c,onExportGanttCSV:p}){let[n,m]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let u=v=>{d.current&&!d.current.contains(v.target)&&m(false);};return n&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[n]);let i=u=>{u(),m(false);};return jsxRuntime.jsxs("div",{className:w("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>m(!n),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",u.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",u.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":n,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),n&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>i(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>i(()=>p?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>i(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>i(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var ks={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"}},ws={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"}},Cs={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"}},hr={dark:ks,light:ws,neutral:Cs},Yo="dark";var qo=react.createContext(void 0),Lu="asakaa-theme";function jl({children:e,defaultTheme:t=Yo,storageKey:a=Lu}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,p=hr[r];Object.entries(p.colors).forEach(([m,d])=>{d&&c.style.setProperty(`--theme-${Fu(m)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([m,d])=>{let i=p.colors[m];i&&c.style.setProperty(d,i);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let l={theme:r,setTheme:s,themes:hr};return jsxRuntime.jsx(qo.Provider,{value:l,children:e})}function $r(){let e=react.useContext(qo);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Fu(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ts({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=$r();return e?jsxRuntime.jsxs("div",{className:w("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(hr).map(([s,l])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:w("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:l.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:l.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Kl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ge[e]||Ge.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,l)=>a.getPropertyValue(s).trim()||l;return {bgPrimary:r("--theme-bg-primary",Ge[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ge[e].bgSecondary),bgGrid:r("--theme-bg-card",Ge[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ge[e].bgWeekend),border:r("--theme-border-primary",Ge[e].border),borderLight:r("--theme-border-subtle",Ge[e].borderLight),textPrimary:r("--theme-text-primary",Ge[e].textPrimary),textSecondary:r("--theme-text-secondary",Ge[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ge[e].textTertiary),accent:r("--theme-accent-primary",Ge[e].accent),accentHover:r("--theme-accent-hover",Ge[e].accentHover),accentLight:r("--theme-accent-primary",Ge[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ge[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ge[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ge[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ge[e].dependency),dependencyHover:r("--theme-border-secondary",Ge[e].dependencyHover),criticalPath:r("--theme-error",Ge[e].criticalPath),criticalPathLight:r("--theme-error",Ge[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ge[e].today):e==="neutral"?r("--theme-text-primary",Ge[e].today):r("--theme-error",Ge[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ge[e].todayLight):e==="neutral"?r("--theme-text-primary",Ge[e].todayLight):r("--theme-error",Ge[e].todayLight),milestone:r("--theme-warning",Ge[e].milestone),milestoneLight:r("--theme-warning",Ge[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ge[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ge[e].statusInProgress),statusCompleted:r("--theme-success",Ge[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ge[e].hoverBg),focusRing:r("--theme-accent-primary",Ge[e].focusRing)}}var Xo={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Yl={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Ds={en:Xo,es:Yl};function ql(e){return Ds[e]||Ds.en}function Ns(e,t){let a=ql(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 Wr=react.createContext(Xo);function po(){return react.useContext(Wr)}function Ju({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:l}){let[c,p]=react.useState(false),[n,m]=react.useState(null),d=react.useRef(null),i=po();if(react.useEffect(()=>{let g=x=>{d.current&&!d.current.contains(x.target)&&p(false);};return c&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[c]),!(t||a||r||o||s||l))return null;let v=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:l}].filter(g=>g.handler),b=async(g,x)=>{if(x){m(g);try{await x();}catch(h){console.error(`Export ${g} failed:`,h);}finally{m(null),p(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:i.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:v.map((g,x)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>b(g.id,g.handler),disabled:n!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:n===g.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):g.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Zu({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let l=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:l?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500,zIndex:l?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[l&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Qu({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 eg({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=po();react.useEffect(()=>{let n=m=>{s.current&&!s.current.contains(m.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],p=c.find(n=>n.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${l.toolbar.density||"Density"}: ${p}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((n,m)=>{let d=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(n.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:m<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:n.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function Jo({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:l,rowDensity:c,onRowDensityChange:p,showThemeSelector:n=false,showCreateTaskButton:m=false,createTaskLabel:d,onCreateTask:i,onExportPNG:u,onExportPDF:v,onExportExcel:b,onExportCSV:g,onExportJSON:x,onExportMSProject:h}){let f=po(),k=u||v||b||g||x||h,T=[{value:"day",label:f.toolbar.day},{value:"week",label:f.toolbar.week},{value:"month",label:f.toolbar.month}],N=[{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(Qu,{options:T,value:t,onChange:A=>a(A),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(eg,{theme:e,value:c,onChange:p})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[m&&i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:i,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||f.toolbar.createTask})]}),(k||n)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ju,{theme:e,onExportPNG:u,onExportPDF:v,onExportExcel:b,onExportCSV:g,onExportJSON:x,onExportMSProject:h}),n&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsxRuntime.jsx(Zu,{options:N,value:s,onChange:A=>l(A),theme:e})]})]})}function Zo({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,l]=react.useState({x:0,y:0}),c=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(!r)return;let m=d=>{c.current&&!c.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let n=e.filter(m=>m.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:p,onClick:()=>{if(!r&&p.current){let m=p.current.getBoundingClientRect();l({x:m.left,y:m.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(at,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),n.map(m=>jsxRuntime.jsxs("button",{onClick:()=>{t(m.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:m.label}),m.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function Hr({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let l=react.useRef(null),[c,p]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let m=200,d=r.length*36+8,i=8,u=window.innerWidth,v=window.innerHeight,b=t,g=a;t+m+i>u&&(b=t-m,b<i&&(b=i)),a+d+i>v&&(g=v-d-i,g<i&&(g=i)),p({x:b,y:g});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let m=i=>{l.current&&!l.current.contains(i.target)&&o();},d=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let n=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:n(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(m=>jsxRuntime.jsxs("div",{children:[m.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:d=>{m.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var kt={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 ld({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:l,onTaskIndent:c,onTaskOutdent:p,onTaskRename:n,onTaskToggleExpand:m,onOpenTaskModal:d,enableKeyboard:i=true}){let u=react.useRef(false),v=react.useCallback(f=>{u.current=f;},[]),b=react.useCallback(f=>{let k=[],T=N=>{for(let A of N)k.push(A),A.subtasks&&A.subtasks.length>0&&A.isExpanded&&T(A.subtasks);};return T(f),k},[]),g=react.useCallback(()=>{let f=b(e);for(let k of f)if(t.has(k.id))return k;return null},[e,t,b]),x=react.useCallback((f,k)=>{let T=b(e);if(T.length===0)return;let N=g();if(!N){a(T[0].id,false);return}let A=T.findIndex(D=>D.id===N.id);if(A===-1)return;let C=f==="up"?A-1:A+1;if(C<0||C>=T.length)return;let W=T[C];a(W.id,k);},[e,g,b,a]),h=react.useCallback(f=>{if(!i)return;let k=f.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||u.current){f.key==="Escape"&&(k.blur(),u.current=false);return}let A=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,C=Array.from(t),W=g();if(f.key==="ArrowUp"){f.preventDefault(),x("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),x("down",f.shiftKey);return}if(W&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){W.subtasks&&W.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!W.isExpanded||f.key==="ArrowLeft"&&W.isExpanded)&&m(W.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){C.length>0&&(f.preventDefault(),l(C,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){C.length>0&&(f.preventDefault(),c(C));return}if(f.key==="Tab"&&f.shiftKey){C.length>0&&(f.preventDefault(),p(C));return}if(f.key==="Enter"&&!f.shiftKey&&!A){W&&(f.preventDefault(),r(W.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!A){W&&(f.preventDefault(),r(W.id,"above"));return}if(f.key==="Enter"&&A){W&&(f.preventDefault(),d(W.id));return}if(f.key==="F2"){W&&(f.preventDefault(),n(W.id));return}if(f.key==="Delete"||f.key==="Backspace"&&A){C.length>0&&(f.preventDefault(),o(C));return}if(f.key==="d"&&A&&!f.shiftKey){C.length>0&&(f.preventDefault(),s(C));return}},[i,t,g,x,r,o,s,l,c,p,n,m,d]);return react.useEffect(()=>{if(i)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[i,h]),{setIsEditing:v}}function cd(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(i=>{let u=new Set(i);return u.has(d)?u.delete(d):u.add(d),u}),r(d);},[]),l=react.useCallback((d,i)=>{if(!a){o(d);return}let u=i.indexOf(a),v=i.indexOf(d);if(u===-1||v===-1){o(d);return}let b=Math.min(u,v),g=Math.max(u,v),x=i.slice(b,g+1);t(new Set(x)),r(d);},[a,o]),c=react.useCallback((d,i,u,v)=>{v?l(d,i):u?s(d):o(d);},[o,s,l]),p=react.useCallback((d,i)=>{i?t(u=>{let v=new Set(u);return v.add(d),v}):o(d);},[o]),n=react.useCallback(()=>{t(new Set),r(null);},[]),m=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:l,handleTaskClick:c,handleKeyboardSelection:p,clearSelection:n,isTaskSelected:m}}function Gr(e){let t=[],a=(r,o,s=0)=>{for(let l=0;l<r.length;l++){let c={...r[l],parentId:o,level:s,position:l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function pd(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=pd(a.subtasks,t);if(r)return r}}return null}function Ps(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Ps(a.subtasks,t);if(r)return r}return null}function Ms(e,t){if(t.length===0)return e;let a=Gr(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],l=(d,i)=>{let u=[];return {tasks:d.filter(b=>{if(i.has(b.id))return u.push(b),false;if(b.subtasks){let g=l(b.subtasks,i);b.subtasks=g.tasks,u.push(...g.removed);}return true}),removed:u}},c=(d,i,u)=>d.map(v=>v.id===i?{...v,subtasks:[...v.subtasks||[],...u],isExpanded:true}:v.subtasks?{...v,subtasks:c(v.subtasks,i,u)}:v),p=new Set(t),{tasks:n,removed:m}=l(e,p);return c(n,s.id,m)}function As(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Ps(a,r);if(!o)continue;let s=Ps(a,o.id),l=(n,m,d)=>{for(let i=0;i<n.length;i++){let u=n[i];if(u.id===m&&u.subtasks){let v=u.subtasks.findIndex(b=>b.id===d);if(v!==-1){let[b]=u.subtasks.splice(v,1);return b}}if(u.subtasks){let v=l(u.subtasks,m,d);if(v)return v}}return null},c=(n,m,d)=>{let i=n.findIndex(u=>u.id===m);if(i!==-1)return n.splice(i+1,0,d),n;for(let u of n)u.subtasks&&c(u.subtasks,m,d);return n},p=l(a,o.id,r);p&&(s&&s.subtasks?c(s.subtasks,o.id,p):c(a,o.id,p));}return a}function Is(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(l,c,p)=>{let n=l.findIndex(d=>d.id===c);if(n===-1){for(let d of l)if(d.subtasks&&s(d.subtasks,c,p))return true;return false}let m=p==="up"?n-1:n+1;return m<0||m>=l.length?false:([l[n],l[m]]=[l[m],l[n]],true)};return s(r,o,a),r}function Ls(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 Fs(e,t){let a=[...e];for(let r of t){let o=l=>{let c=l.findIndex(m=>m.id===r);if(c===-1){for(let m of l)if(m.subtasks&&o(m.subtasks))return true;return false}let p=l[c],n={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks):void 0};return l.splice(c+1,0,n),true},s=l=>l.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function md(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let l={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},c=p=>{let n=p.findIndex(d=>d.id===t);if(n===-1){for(let d of p)if(d.subtasks&&c(d.subtasks))return true;return false}let m=a==="above"?n:n+1;return p.splice(m,0,l),true};return c(r),{tasks:r,newTask:l}}function Bs(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Bs(r.subtasks,t,a)}:r)}function Rs(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Rs(a.subtasks,t)}:a)}function Os(e,t){let a=m=>{for(let d of m){if(d.id===t)return d;if(d.subtasks){let i=a(d.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let l=r?.startDate||o,c=r?.endDate||s,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(l),endDate:new Date(c),color:r?.color||"#3B82F6"},n=m=>m.map(d=>{if(d.id===t){let i=d.subtasks||[];return {...d,subtasks:[...i,p],isExpanded:true}}return d.subtasks?{...d,subtasks:n(d.subtasks)}:d});return {tasks:n(e),newTask:p}}function ud(e,t,a,r){if(t===a)return e;let o=pd(e,t);if(!o)return e;if(a){let c=(p,n)=>{if(!p.subtasks)return false;for(let m of p.subtasks)if(m.id===n||c(m,n))return true;return false};if(c(o,a))return e}let s=c=>c.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p),l=s(e);if(a===null){let c=r!==void 0?r:l.length;l.splice(c,0,{...o,parentId:void 0});}else {let c=p=>p.map(n=>{if(n.id===a){let m=n.subtasks||[],d=r!==void 0?r:m.length,i=[...m];return i.splice(d,0,{...o,parentId:a}),{...n,subtasks:i,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:c(n.subtasks)}:n});l=c(l);}return l}function tn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:l,onTaskContextMenu:c,onTaskToggle:p,scrollTop:n,columns:m,onToggleColumn:d,onColumnResize:i,onTaskUpdate:u,onTaskIndent:v,onTaskOutdent:b,onTaskMove:g,onMultiTaskDelete:x,onTaskDuplicate:h,onTaskCreate:f,onTaskRename:k,onCreateSubtask:T,onOpenTaskModal:N,onDeleteRequest:A,onTaskReparent:C}){let W=react.useContext(Wr),[D,y]=react.useState(null),[M,S]=react.useState(false),[H,Y]=react.useState(null),[de,he]=react.useState(""),Ie=react.useRef(null),Le=react.useRef(null),[R,F]=react.useState(null),[U,E]=react.useState(0),[X,ee]=react.useState(0),[z,Me]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ve,Xe]=react.useState(null),[ge,et]=react.useState(null),[Te,ot]=react.useState(null),gt=react.useRef(0),ft=5,tt=react.useRef(false),[B,se]=react.useState(null),[xe,De]=react.useState(false),[Ee,Ve]=react.useState(null);react.useEffect(()=>{function _(j){Ie.current&&!Ie.current.contains(j.target)&&S(false);}if(M)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[M]),react.useEffect(()=>{H&&Le.current&&(Le.current.focus(),Le.current.select());},[H]),react.useEffect(()=>{if(!R)return;let _=st=>{let He=st.clientX-U,fe=X+He;i?.(R,fe);},j=()=>{F(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",j),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",j),document.body.style.cursor="",document.body.style.userSelect="";}},[R,U,X,i]);let{selectedTaskIds:Ct,handleTaskClick:q,isTaskSelected:O}=cd(),{setIsEditing:we}=ld({tasks:e,selectedTaskIds:Ct,onTaskSelect:(_,j)=>{let He=Gr(e).map(fe=>fe.id);q(_,He,j||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:x||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:_=>{let j=Gr(e).find(st=>st.id===_);j&&te(j);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:_=>{let j=Gr(e).find(st=>st.id===_);j&&N&&N(j);},enableKeyboard:true}),We=(_,j=0)=>{let st=[];for(let He of _)st.push({task:He,level:j}),He.subtasks&&He.subtasks.length>0&&He.isExpanded&&st.push(...We(He.subtasks,j+1));return st},Ue=We(e),ht=48,Z=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,te=_=>{Y(_.id),he(_.name),we(true);},ke=_=>{de.trim()&&de!==e.find(j=>j.id===_)?.name&&k?.(_,de.trim()),Y(null),he(""),we(false);},Pe=()=>{Y(null),he(""),we(false);},J=(_,j)=>{j.stopPropagation(),T?.(_.id);},Ae=(_,j)=>{j.preventDefault(),gt.current=j.clientY,Xe(_),tt.current=false,De(false),se({x:j.clientX,y:j.clientY});},ye=_=>{if(!ve||(Math.abs(_.clientY-gt.current)>ft&&!tt.current&&(tt.current=true,De(true)),se({x:_.clientX,y:_.clientY}),!tt.current))return;let st=document.querySelectorAll("[data-task-row]"),He=null,fe=null;st.forEach(Vt=>{let Tt=Vt.getBoundingClientRect(),$=Vt.getAttribute("data-task-row");if($&&$!==ve&&_.clientY>=Tt.top&&_.clientY<=Tt.bottom){He=$;let pe=_.clientY-Tt.top,Ce=Tt.height;pe<Ce*.25?fe="above":pe>Ce*.75?fe="below":fe="child";}}),et(He),ot(fe);},Ne=()=>{if(tt.current&&ve&&ge&&Te){if(Te==="child")C?.(ve,ge);else if(Te==="above"||Te==="below"){let _=(He,fe,Vt=null)=>{for(let Tt of He){if(Tt.id===fe)return Vt;if(Tt.subtasks){let $=_(Tt.subtasks,fe,Tt.id);if($!==void 0)return $}}},j=_(e,ge,null),st=(He,fe)=>{let Vt=He.findIndex(Tt=>Tt.id===fe);return Te==="below"?Vt+1:Vt};if(j===null){let He=st(e,ge);C?.(ve,null,He);}else {let He=Ue.find(fe=>fe.task.id===j)?.task;if(He?.subtasks){let fe=st(He.subtasks,ge);C?.(ve,j,fe);}}}}Xe(null),et(null),ot(null),se(null),tt.current=false,De(false);};react.useEffect(()=>{if(ve)return document.addEventListener("mousemove",ye),document.addEventListener("mouseup",Ne),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ye),document.removeEventListener("mouseup",Ne),document.body.style.cursor="",document.body.style.userSelect="";}},[ve,ge,Te]);let ce=(_,j,st)=>{switch(_.id){case "name":let He=H===j.id,fe=D===j.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${st*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:fe?1:.3},onMouseDown:ie=>Ae(j.id,ie),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:ie=>{ie.stopPropagation(),p?.(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"}),!(j.subtasks&&j.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 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"}),He?jsxRuntime.jsx("input",{ref:Le,type:"text",value:de,onChange:ie=>he(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"?ke(j.id):ie.key==="Escape"&&Pe();},onBlur:()=>ke(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:ie=>ie.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}),fe&&!He&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ie=>ie.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ie=>J(j,ie),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:ie=>{ie.stopPropagation(),te(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 Tt=_.id==="startDate"?"startDate":"endDate",$=j[Tt],pe=Ee?.taskId===j.id&&Ee?.field===Tt,Ce=ie=>ie?(typeof ie=="string"?new Date(ie):ie).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:ie=>ie.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:ie=>{if(pe)Ve(null);else {let Dt=ie.currentTarget.getBoundingClientRect();Ve({taskId:j.id,field:Tt,month:$?typeof $=="string"?new Date($):$:new Date,position:{top:Dt.bottom+4,left:Dt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Ce($)})]}),pe&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Ve(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:Ee?.position.top,left:Ee?.position.left},onClick:ie=>ie.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ie=new Date,Dt=new Date(ie);Dt.setDate(ie.getDate()+1);let Jt=new Date(ie);Jt.setDate(ie.getDate()+7);let Sr=new Date(ie);return Sr.setDate(ie.getDate()+14),[{label:"Hoy",date:ie},{label:"Ma\xF1ana",date:Dt},{label:"Pr\xF3xima semana",date:Jt},{label:"2 semanas",date:Sr}].map((Pr,Wa)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:ir=>ir.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ir=>ir.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(j.id,{[Tt]:Pr.date}),Ve(null);},children:Pr.label},Wa))})(),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:ie=>ie.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(j.id,{[Tt]:void 0}),Ve(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:()=>Ve(ie=>ie?{...ie,month:new Date(ie.month.getFullYear(),ie.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:Ee?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Ve(ie=>ie?{...ie,month:new Date(ie.month.getFullYear(),ie.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((ie,Dt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ie},Dt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ie=Ee?.month||new Date,Dt=ie.getFullYear(),Jt=ie.getMonth(),Sr=new Date(Dt,Jt,1).getDay(),Er=new Date(Dt,Jt+1,0).getDate(),Pr=new Date,Wa=[];for(let Et=Sr-1;Et>=0;Et--)Wa.push({day:new Date(Dt,Jt,-Et).getDate(),date:new Date(Dt,Jt-1,new Date(Dt,Jt,-Et).getDate()),isCurrentMonth:false});for(let Et=1;Et<=Er;Et++)Wa.push({day:Et,date:new Date(Dt,Jt,Et),isCurrentMonth:true});let ir=42-Wa.length;for(let Et=1;Et<=ir;Et++)Wa.push({day:Et,date:new Date(Dt,Jt+1,Et),isCurrentMonth:false});return Wa.map((Et,So)=>{let Eo=Et.date.toDateString()===Pr.toDateString(),Jr=($?typeof $=="string"?new Date($):$:null)?.toDateString()===Et.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:Et.isCurrentMonth?Jr?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Jr?"#3B82F6":"transparent",boxShadow:Eo&&!Jr?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{u?.(j.id,{[Tt]:Et.date}),Ve(null);},children:Et.day},So)})})()})]})]})]}),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:Z(j)})});case "assignees":let zt=r.filter(ie=>j.assignees?.some(Dt=>Dt.name===ie.name||Dt.initials===ie.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx(mr,{assignedUsers:zt,availableUsers:r,onChange:ie=>{let Dt=ie.map(Jt=>({id:Jt.id,name:Jt.name,initials:Jt.initials,color:Jt.color}));u?.(j.id,{assignees:Dt.length>0?Dt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx(pl,{status:j.status||"todo",onChange:ie=>{u?.(j.id,{status:ie,progress:ie==="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 ea={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},qa={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Xr=ea[j.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx(cr,{priority:Xr,onChange:ie=>{ie&&u?.(j.id,{priority:qa[ie]||"medium"});}})});default:return null}},Re=_=>[{id:"hide",label:"Hide Column",icon:kt.Hide,onClick:()=>d(_),disabled:_==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:kt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:kt.SortDesc,onClick:()=>{}}],Fe=_=>_.subtasks&&_.subtasks.length>0?[{id:"addSubtask",label:W?.contextMenu?.addSubtask||"Add Subtask",icon:kt.Add,onClick:()=>{T?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:W?.contextMenu?.deleteTask||"Delete Task",icon:kt.Delete,onClick:()=>{A?A(_.id,_.name):x?.([_.id]);}}]:[{id:"edit",label:W?.contextMenu?.editTask||"Edit Task",icon:kt.Pencil,onClick:()=>{l?.(_);}},{id:"addSubtask",label:W?.contextMenu?.addSubtask||"Add Subtask",icon:kt.Add,onClick:()=>{T?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:W?.contextMenu?.markIncomplete||"Mark Incomplete",icon:kt.MarkIncomplete,onClick:()=>{u?.(_.id,{status:"todo",progress:0});},disabled:_.status==="todo"},{id:"setInProgress",label:W?.contextMenu?.setInProgress||"Set In Progress",icon:kt.SetInProgress,onClick:()=>{u?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"markComplete",label:W?.contextMenu?.markComplete||"Mark Complete",icon:kt.MarkComplete,onClick:()=>{u?.(_.id,{status:"completed",progress:100});},disabled:_.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:W?.contextMenu?.splitTask||"Split Task",icon:kt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:W?.contextMenu?.deleteTask||"Delete Task",icon:kt.Delete,onClick:()=>{A?A(_.id,_.name):x?.([_.id]);}}],Oe=m.filter(_=>_.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${ht}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[Oe.map((_,j)=>{let st=j===Oe.length-1,He=_.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${He?"":"justify-center"}`,style:{width:`${_.width}px`,minWidth:`${_.minWidth??(He?200:60)}px`,maxWidth:`${_.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:st?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:fe=>{fe.preventDefault(),Me({isOpen:true,x:fe.clientX,y:fe.clientY,type:"header",columnId:_.id});},onMouseEnter:fe=>{fe.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:fe=>{fe.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:He?"70px":"0"},title:_.label,children:_.label}),He&&jsxRuntime.jsxs("div",{className:"absolute flex items-center gap-1",style:{right:"4px",top:"50%",transform:"translateY(-50%)",zIndex:4},children:[jsxRuntime.jsx(Zo,{columns:m,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>S(!M),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})})]}),_.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:R===_.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:fe=>{fe.preventDefault(),fe.stopPropagation(),F(_.id),E(fe.clientX),ee(_.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},_.id)}),M&&jsxRuntime.jsxs("div",{ref:Ie,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:_=>_.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:()=>S(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",children:Ue.map(({task:_,level:j},st)=>{let He=O(_.id),fe=ge===_.id,Vt=fe&&Te==="above",Tt=fe&&Te==="below",$=fe&&Te==="child",pe={};return $&&(pe.backgroundColor=`${t.accent}15`,pe.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":_.id,className:`flex items-center cursor-pointer group ${ve===_.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:He?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:He?t.accentLight:$?`${t.accent}15`:st%2===0?t.bgPrimary:t.bgGrid,...pe},onMouseEnter:()=>y(_.id),onMouseLeave:()=>y(null),onClick:Ce=>{let ea=Gr(e).map(ie=>ie.id),Xr=navigator.platform.toUpperCase().indexOf("MAC")>=0?Ce.metaKey:Ce.ctrlKey;q(_.id,ea,Xr,Ce.shiftKey),s?.(_);},onDoubleClick:Ce=>{Ce.stopPropagation(),l?.(_);},onContextMenu:Ce=>{Ce.preventDefault(),Me({isOpen:true,x:Ce.clientX,y:Ce.clientY,type:"task",task:_}),c?.(_,Ce);},whileHover:{backgroundColor:He?t.accentLight:t.hoverBg},children:[Vt&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Tt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Oe.map((Ce,zt)=>{let ea=zt===Oe.length-1,qa=Ce.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${qa?"justify-start":"justify-center"}`,style:{width:`${Ce.width}px`,minWidth:`${Ce.minWidth??(qa?200:60)}px`,maxWidth:`${Ce.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ea?"none":`1px solid ${D===_.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ce(Ce,_,qa?j:0)},`${_.id}-${Ce.id}`)})]},_.id)})}),jsxRuntime.jsx(Hr,{isOpen:z.isOpen,x:z.x,y:z.y,items:z.type==="header"&&z.columnId?Re(z.columnId):z.type==="task"&&z.task?Fe(z.task):[],onClose:()=>Me({...z,isOpen:false}),theme:t}),xe&&B&&ve&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:B.x+12,top:B.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let _=Ue.find(j=>j.task.id===ve)?.task;return _?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:_.name})}):null})()}),document.body)]})}function yd(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[l,c]=react.useState(e),[p,n]=react.useState(t),[m,d]=react.useState(null),[i,u]=react.useState(null),[v,b]=react.useState(null),[g,x]=react.useState(null),[h,f]=react.useState(0),[k,T]=react.useState(0),[N,A]=react.useState(null),[C,W]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:l,setGhostX:c,ghostWidth:p,setGhostWidth:n,connectionLine:m,setConnectionLine:d,hoveredTaskId:i,setHoveredTaskId:u,activeZone:v,setActiveZone:b,draggedSegmentIndex:g,setDraggedSegmentIndex:x,draggedSegmentStartX:h,setDraggedSegmentStartX:f,segmentDragOffsetX:k,setSegmentDragOffsetX:T,hoveredSegmentIndex:N,setHoveredSegmentIndex:A,isHovered:C,setIsHovered:W,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(H,Y)=>{r("none"),d(null),u(null),c(H),n(Y),T(0),x(null),f(0);}}}function an({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:l,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:d,onDependencyCreate:i,allTaskPositions:u=[],onDragMove:v,onHoverChange:b}){let g=yd(t,r),x=react.useRef(null),{dragMode:h,setDragMode:f,dragOffset:k,setDragOffset:T,ghostX:N,setGhostX:A,ghostWidth:C,setGhostWidth:W,connectionLine:D,setConnectionLine:y,hoveredTaskId:M,setHoveredTaskId:S,activeZone:H,setActiveZone:Y,draggedSegmentIndex:de,setDraggedSegmentIndex:he,draggedSegmentStartX:Ie,setDraggedSegmentStartX:Le,segmentDragOffsetX:R,setSegmentDragOffsetX:F,hoveredSegmentIndex:U,setHoveredSegmentIndex:E,isHovered:X,setIsHovered:ee,isDragging:z,isResizing:Me,isConnecting:ve,resetDragState:Xe}=g,ge=32,et=8,Te=e.endDate&&e.endDate<new Date&&e.progress<100,ot=e.isCriticalPath,gt=o.name==="neutral"||o.today==="#1C1917",ft=e.status==="completed"||e.progress===100,tt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},se=e.isCriticalPath||Te?"#DC2626":e.color?e.color:e.priority&&tt[e.priority]?tt[e.priority]:o.taskBarPrimary,De=(J=>J>=80?20:J>=60?15:J>=50?12:10)(r),Ee=r<50,Ve=r<40;react.useEffect(()=>{if(b)if(X&&!z&&!e.segments){let J=a<100;b({task:e,x:t,y:a,width:r,height:ge,showBelow:J});}else b(null);},[X,z,e,t,a,r,ge,b]);let Ct=J=>J.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),q=()=>{let J=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${J} day${J!==1?"s":""}`},O=J=>Math.round(J/s)*s,we=J=>{let Ae=Math.round(J/s),ye=new Date(l);return ye.setDate(ye.getDate()+Ae),ye},We=(J,Ae)=>{for(let ye of u){if(ye.id===e.id)continue;let Ne=5;if(J>=ye.x-Ne&&J<=ye.x+ye.width+Ne&&Ae>=ye.y-Ne&&Ae<=ye.y+ye.height+Ne)return ye.id}return null},Ue=react.useCallback((J,Ae,ye)=>{J.preventDefault(),J.stopPropagation();let Ne=x.current?.ownerSVGElement;if(!Ne)return;let ce=Ne.createSVGPoint();ce.x=J.clientX,ce.y=J.clientY;let Re=ce.matrixTransform(Ne.getScreenCTM()?.inverse()),Fe=ye!==void 0?ye:t,Oe=Ae;if(!Oe){let _=Re.x-Fe;J.shiftKey?(Oe="connect",y({x:t+r,y:a+ge/2})):J.ctrlKey||J.metaKey?Oe="move":J.altKey?Oe=_<r/2?"resize-start":"resize-end":Ve?_<r/2?Oe="move":Oe="resize-end":Ee?_<=De/2?Oe="resize-start":_>=r-De/2?Oe="resize-end":Oe="move":_<=De?Oe="resize-start":_>=r-De?Oe="resize-end":Oe="move";}f(Oe),ee(false),Y(null),Oe==="move"?T(Re.x-Fe):Oe==="connect"?y({x:t+r,y:a+ge/2}):T(0),A(Fe),W(r);},[t,r,a,ge]),ht=react.useCallback(J=>{if(h==="none")return;let Ae=x.current?.ownerSVGElement;if(!Ae)return;let ye=Ae.createSVGPoint();ye.x=J.clientX,ye.y=J.clientY;let Ne=ye.matrixTransform(Ae.getScreenCTM()?.inverse());if(h==="connect"){y({x:Ne.x,y:Ne.y});let ce=We(Ne.x,Ne.y);S(ce);}else if(h==="move"){let ce=Ne.x-k,Re=O(ce);A(Re),W(r);let Fe=Math.round((Re-t)/s);if(v?.(e.id,Fe,true),e.segments&&e.segments.length>0&&de!==null){let Oe=Re-Ie;F(Oe);}}else if(h==="resize-start"){let ce=Ne.x,Re=O(ce),Fe=t+r-Re;Fe>=s&&(A(Re),W(Fe));}else if(h==="resize-end"){let ce=Ne.x,Fe=O(ce)-t;Fe>=s&&W(Fe);}},[h,t,r,s,k,e,O,de,Ie,We,S,y,A,W,F,v]),Z=react.useCallback(()=>{if(h!=="none"){if(h==="connect")M&&i&&i(e,M),y(null),S(null);else {let J=e.endDate.getTime()-e.startDate.getTime(),Ae,ye,Ne=true;if(h==="move"){if(Ae=we(N),ye=new Date(Ae.getTime()+J),e.segments&&e.segments.length>0&&de!==null){let ce=Math.round(R/s),Re=e.segments.map((j,st)=>{if(st===de){let He=new Date(j.startDate),fe=new Date(j.endDate);return He.setDate(He.getDate()+ce),fe.setDate(fe.getDate()+ce),{startDate:He,endDate:fe}}return j}),Fe=Re.flatMap(j=>[j.startDate,j.endDate]),Oe=new Date(Math.min(...Fe.map(j=>j.getTime()))),_=new Date(Math.max(...Fe.map(j=>j.getTime())));d?.({...e,segments:Re},Oe,_),Xe(t,r);return}}else h==="resize-start"?(Ae=we(N),ye=e.endDate,Ae>=ye&&(console.warn("Invalid date range: start date must be before end date"),Ne=false)):h==="resize-end"?(Ae=e.startDate,ye=we(N+C),ye<=Ae&&(console.warn("Invalid date range: end date must be after start date"),Ne=false)):Ne=false;Ne&&Ae&&ye&&(ye.getTime()-Ae.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):d?.(e,Ae,ye));}v?.(e.id,0,false),Xe(t,r);}},[h,N,C,e,d,M,i,t,r,s,we,R,de,Xe,v]);react.useEffect(()=>{if(h==="none")return;let J=ye=>{ht(ye);},Ae=()=>{Z();};return window.addEventListener("mousemove",J),window.addEventListener("mouseup",Ae),()=>{window.removeEventListener("mousemove",J),window.removeEventListener("mouseup",Ae);}},[h,ht,Z]);let te=z&&!ve?N:t,ke=z&&!ve?C:r,Pe=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:x,onMouseEnter:()=>!z&&ee(true),onMouseLeave:()=>{z||(ee(false),Y(null));},onClick:()=>!z&&p?.(e),onDoubleClick:J=>{z||(J.stopPropagation(),n?.(e));},onContextMenu:J=>{J.preventDefault(),m?.(e,J);},children:[X&&!z&&!Ee&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:De,height:ge,fill:H==="resize-start"?o.accent:"transparent",opacity:H==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Y("resize-start"),onMouseDown:J=>Ue(J,"resize-start")}),jsxRuntime.jsx("rect",{x:t+De,y:a,width:r-De*2,height:ge,fill:H==="move"?o.accent:"transparent",opacity:H==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>Y("move"),onMouseDown:J=>Ue(J,"move")}),jsxRuntime.jsx("rect",{x:t+r-De,y:a,width:De,height:ge,fill:H==="resize-end"?o.accent:"transparent",opacity:H==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Y("resize-end"),onMouseDown:J=>Ue(J,"resize-end")})]}),X&&!z&&Ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ge,fill:H==="move"?o.accent:"transparent",opacity:H==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>Y("move"),onMouseDown:J=>Ue(J,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ge,fill:H==="resize-end"?o.accent:"transparent",opacity:H==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Y("resize-end"),onMouseDown:J=>Ue(J,"resize-end")}),X&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ge-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),z&&!ve&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:N,y:a,width:C,height:ge,rx:et,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:te,y:a,width:ke,height:ge,rx:et,fill:se,"data-task-class":Pe,initial:{opacity:0,scale:.95},animate:{opacity:z&&!ve?.15:e.parentId?.6:X?.9:.8,scale:X&&!z?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:J=>Ue(J),style:{cursor:z?ve?"crosshair":Me?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:te,y:a,width:ke*(e.progress/100),height:ge,rx:et,fill:se,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((J,Ae)=>{let ye=(J.startDate.getTime()-l.getTime())/864e5*s,ce=(J.endDate.getTime()-l.getTime())/(1e3*60*60*24)*s-ye+s,Re=z&&h==="move"&&de===Ae,Fe=U===Ae,Oe=Re?ye+R:ye;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!z&&E(Ae),onMouseLeave:()=>!z&&E(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Oe,y:a,width:ce,height:ge,rx:et,fill:se,initial:{opacity:0,scale:.95},animate:{opacity:Re||e.parentId?.6:Fe?.9:.8,scale:Fe&&!z?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:_=>{_.stopPropagation(),he(Ae),Le(ye),Ue(_,void 0,ye);},style:{cursor:z?ve?"crosshair":Me?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Oe,y:a,width:ce*(e.progress/100),height:ge,rx:et,fill:se,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ae}`)}),gt&&(Te||ot)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ot&&!Te&&jsxRuntime.jsx("rect",{x:te,y:a,width:ke,height:ge,rx:et,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Te&&jsxRuntime.jsx("rect",{x:te,y:a,width:ke,height:ge,rx:et,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ke>60&&!e.segments&&(()=>{let J=c.taskLabel(e),Ae=typeof J=="string"?J:e.name,ye=Ae.length>Math.floor(ke/8)?`${Ae.substring(0,Math.floor(ke/8))}...`:Ae;return jsxRuntime.jsx("text",{x:te+12,y:a+ge/2,dominantBaseline:"middle",fill:ft?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ft?"line-through":"none"},children:ye})})(),ke>100&&e.progress>0&&e.progress<100&&!z&&!e.segments&&jsxRuntime.jsxs("text",{x:te+ke-12,y:a+ge/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&&ke>80&&!z&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:te+ke-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:te+ke-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(X||Me)&&!ve&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Ee?te-15:te-10,y:a-5,width:Ee?25:20,height:ge+10,fill:"transparent",onMouseDown:J=>Ue(J,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ee?te-8:te-3,y:a+6,width:Ee?8:6,height:Ee?ge-12:ge-16,rx:3,fill:h==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:h==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:te+ke-10,y:a-5,width:Ee?25:20,height:ge+10,fill:"transparent",onMouseDown:J=>Ue(J,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ee?te+ke:te+ke-3,y:a+6,width:Ee?8:6,height:Ee?ge-12:ge-16,rx:3,fill:h==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:h==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:X&&!z&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+8,cy:a+ge/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:J=>{J.stopPropagation(),Ue(J,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+ge/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),ve&&D&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ge/2,x2:D.x,y2:D.y,stroke:M?o.statusCompleted:o.accent,strokeWidth:M?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:M?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:D.x,cy:D.y,r:M?8:6,fill:M?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),M&&jsxRuntime.jsx(framerMotion.motion.text,{x:D.x+15,y:D.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:D.x+10},animate:{opacity:1,x:D.x+15},transition:{duration:.2},children:"Connect"})]}),(X||z)&&!ve&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:te-2,y:a-2,width:ke+4,height:ge+4,rx:et+2,fill:"none",stroke:z?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:z?.6:.4,initial:{opacity:0},animate:{opacity:z?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Me&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:N,y1:0,x2:N,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:N+C,y1:0,x2:N+C,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:X&&!z&&!e.segments&&!b&&(()=>{let ye=a<100,Ne=ye?a+ge+13:a-82-13,ce=ye?`M ${te+ke/2-6} ${a+ge+3} L ${te+ke/2} ${a+ge+13} L ${te+ke/2+6} ${a+ge+3}`:`M ${te+ke/2-6} ${a-13} L ${te+ke/2} ${a-3} L ${te+ke/2+6} ${a-13}`,Re=Ne+22,Fe=Ne+40,Oe=Ne+55,_=Ne+70,j=ye?Ne+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:ye?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ye?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:ce,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:te+ke/2-120,y:Ne,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:te+ke/2,y:Re,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:te+ke/2-110,y:Fe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:te+ke/2-70,y:Fe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ct(e.startDate)}),jsxRuntime.jsx("text",{x:te+ke/2-110,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:te+ke/2-70,y:Oe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ct(e.endDate)}),jsxRuntime.jsx("text",{x:te+ke/2+10,y:Fe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:te+ke/2+65,y:Fe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:q()}),jsxRuntime.jsx("text",{x:te+ke/2+10,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:te+ke/2+65,y:Oe,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:te+ke/2-110,y:_,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:te+ke/2-50,y:_,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(st=>st.name).join(", ").substring(0,30),e.assignees.map(st=>st.name).join(", ").length>30?"...":""]})]}),!ye&&jsxRuntime.jsx("text",{x:te+ke/2,y:j,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ve?"Left: move \u2022 Right: resize":Ee?"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 kd({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:l,showBelow:c}=e,p=82,n=13,m=c?o+l+n:o-p-n,d=c?`M ${r+s/2-6} ${o+l+3} L ${r+s/2} ${o+l+13} L ${r+s/2+6} ${o+l+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=m+22,u=m+40,v=m+55,b=m+70,g=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),x=()=>{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:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:m,width:240,height:p,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:i,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?g(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?g(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:x()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:v,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:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:b,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 nn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:l}){let[c,p]=react.useState(false),n=a-e,m=r-t,d=e+n/2,i=`M ${e} ${t} C ${d} ${t}, ${d} ${r}, ${a} ${r}`,u=6,v=Math.atan2(m,n),b=a-u*Math.cos(v-Math.PI/6),g=r-u*Math.sin(v-Math.PI/6),x=a-u*Math.cos(v+Math.PI/6),h=r-u*Math.sin(v+Math.PI/6),f=o.dependency;react.useEffect(()=>{l&&s&&l(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,l]);let k=!s&&!l;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!k&&p(true),onMouseLeave:()=>!k&&p(false),style:{pointerEvents:k?"none":"auto"},children:[!k&&jsxRuntime.jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:i,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&l?0:c?1:.8,strokeWidth:c?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${b} ${g} M ${a} ${r} L ${x} ${h}`,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&l?0:c?1:.8,scale:c?1.1:1,strokeWidth:c?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:f,initial:{scale:0},animate:{scale:c&&l?0:c?1.3:1,opacity:c&&l?0:c?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),c&&s&&!l&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:T=>{T.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:d,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:d-4,y1:(t+r)/2-4,x2:d+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:d+4,y1:(t+r)/2-4,x2:d-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function ln({task:e,x:t,y:a,theme:r,onClick:o}){let[s,l]=react.useState(false),c=16,p=n=>n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:p(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 ne={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=n=>{n.forEach(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let l=new Set,c=new Set,p=n=>{if(!l.has(n)){l.add(n),c.add(n);let m=r.get(n)||[];for(let d of m){if(!l.has(d)&&p(d))return true;if(c.has(d))return true}}return c.delete(n),false};return p(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=ne.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ne.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ne.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=ne.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(`
45
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function hs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&l.current&&!l.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=n=>{t(n),o(false);},p=e.reduce((n,m)=>{let d=m.category||"Other";return n[d]||(n[d]=[]),n[d].push(m),n},{});return jsxRuntime.jsxs("div",{className:w("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",n.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",n.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:w("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(p).map(([n,m])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:n})}),jsxRuntime.jsx("div",{children:m.map(d=>jsxRuntime.jsxs("button",{onClick:()=>c(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},n)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function ys({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[l,c]=react.useState("export"),[p,n]=react.useState("json"),[m,d]=react.useState(null),i=react.useRef(null);if(!t)return null;let u=async()=>{let b=o?.current||void 0,g=await Hi(e,p,b);Gi(g,p);},v=async b=>{let g=b.target.files?.[0];if(g){try{let x=await ji(g),h=g.name.endsWith(".json")?"json":"csv",f=Vi(x,h);d(f),f.success&&r&&r(f,x);}catch(x){d({success:false,errors:[`Failed to read file: ${x instanceof Error?x.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxRuntime.jsxs("div",{className:w("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>c("export"),className:w("flex-1 px-6 py-4 font-semibold transition-colors",l==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:w("flex-1 px-6 py-4 font-semibold transition-colors",l==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[l==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(b=>jsxRuntime.jsxs("button",{onClick:()=>n(b),className:w("p-4 rounded-lg border-2 transition-all text-center",p===b?"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:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:u,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),l==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:i,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>i.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),m&&jsxRuntime.jsxs("div",{className:w("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:w("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:m.errors.map((b,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},g))})]})]})]})]})]})}var wu=["URGENT","HIGH","MEDIUM","LOW"],Cu=[{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"}],Tu=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function vs({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:l,onFilterHighPriority:c,availableUsers:p=[],availableLabels:n=[],availableColumns:m=[],showQuickFilters:d=true,compact:i=false,groupBy:u="none",onGroupByChange:v}){let[b,g]=react.useState(true),x=react.useCallback(N=>{a({search:N.target.value});},[a]),h=react.useCallback(N=>{a({dateFilter:N.target.value});},[a]),f=react.useCallback(N=>{r({by:N.target.value});},[r]),k=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),T=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${b?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:N=>{N.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:b?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),T&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!b&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:x,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:N=>{let A=N.target.value;a({priorities:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),wu.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),p.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:N=>{let A=N.target.value;a({assignees:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),p.map(N=>jsxRuntime.jsx("option",{value:N.id,children:N.name},N.id))]})}),n.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:N=>{let A=N.target.value;a({labels:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),n.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:f,className:"filter-bar__select filter-bar__select--sm",children:Cu.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.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"})]}),v&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:N=>v(N.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Tu.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))})}),T&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function xs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:l,onExportGanttPNG:c,onExportGanttCSV:p}){let[n,m]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let u=v=>{d.current&&!d.current.contains(v.target)&&m(false);};return n&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[n]);let i=u=>{u(),m(false);};return jsxRuntime.jsxs("div",{className:w("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>m(!n),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",u.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",u.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":n,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),n&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>i(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>i(()=>p?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>i(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>i(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var ks={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"}},ws={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"}},Cs={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"}},hr={dark:ks,light:ws,neutral:Cs},Yo="dark";var qo=react.createContext(void 0),Fu="asakaa-theme";function Vl({children:e,defaultTheme:t=Yo,storageKey:a=Fu}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,p=hr[r];Object.entries(p.colors).forEach(([m,d])=>{d&&c.style.setProperty(`--theme-${Bu(m)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([m,d])=>{let i=p.colors[m];i&&c.style.setProperty(d,i);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let l={theme:r,setTheme:s,themes:hr};return jsxRuntime.jsx(qo.Provider,{value:l,children:e})}function Ur(){let e=react.useContext(qo);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Bu(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ts({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Ur();return e?jsxRuntime.jsxs("div",{className:w("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(hr).map(([s,l])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:w("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:l.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:l.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function jl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ge[e]||Ge.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,l)=>a.getPropertyValue(s).trim()||l;return {bgPrimary:r("--theme-bg-primary",Ge[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ge[e].bgSecondary),bgGrid:r("--theme-bg-card",Ge[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ge[e].bgWeekend),border:r("--theme-border-primary",Ge[e].border),borderLight:r("--theme-border-subtle",Ge[e].borderLight),textPrimary:r("--theme-text-primary",Ge[e].textPrimary),textSecondary:r("--theme-text-secondary",Ge[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ge[e].textTertiary),accent:r("--theme-accent-primary",Ge[e].accent),accentHover:r("--theme-accent-hover",Ge[e].accentHover),accentLight:r("--theme-accent-primary",Ge[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ge[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ge[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ge[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ge[e].dependency),dependencyHover:r("--theme-border-secondary",Ge[e].dependencyHover),criticalPath:r("--theme-error",Ge[e].criticalPath),criticalPathLight:r("--theme-error",Ge[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ge[e].today):e==="neutral"?r("--theme-text-primary",Ge[e].today):r("--theme-error",Ge[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ge[e].todayLight):e==="neutral"?r("--theme-text-primary",Ge[e].todayLight):r("--theme-error",Ge[e].todayLight),milestone:r("--theme-warning",Ge[e].milestone),milestoneLight:r("--theme-warning",Ge[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ge[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ge[e].statusInProgress),statusCompleted:r("--theme-success",Ge[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ge[e].hoverBg),focusRing:r("--theme-accent-primary",Ge[e].focusRing)}}var Xo={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Kl={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Ds={en:Xo,es:Kl};function Yl(e){return Ds[e]||Ds.en}function Ns(e,t){let a=Yl(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 Hr=react.createContext(Xo);function mo(){return react.useContext(Hr)}function Zu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:l}){let[c,p]=react.useState(false),[n,m]=react.useState(null),d=react.useRef(null),i=mo();if(react.useEffect(()=>{let g=x=>{d.current&&!d.current.contains(x.target)&&p(false);};return c&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[c]),!(t||a||r||o||s||l))return null;let v=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:l}].filter(g=>g.handler),b=async(g,x)=>{if(x){m(g);try{await x();}catch(h){console.error(`Export ${g} failed:`,h);}finally{m(null),p(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:i.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:v.map((g,x)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>b(g.id,g.handler),disabled:n!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:n===g.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):g.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Qu({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let l=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:l?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500,zIndex:l?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[l&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function eg({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 tg({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=mo();react.useEffect(()=>{let n=m=>{s.current&&!s.current.contains(m.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],p=c.find(n=>n.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${l.toolbar.density||"Density"}: ${p}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((n,m)=>{let d=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(n.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:m<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:n.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function Jo({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:l,rowDensity:c,onRowDensityChange:p,showThemeSelector:n=false,showCreateTaskButton:m=false,createTaskLabel:d,onCreateTask:i,onExportPNG:u,onExportPDF:v,onExportExcel:b,onExportCSV:g,onExportJSON:x,onExportMSProject:h}){let f=mo(),k=u||v||b||g||x||h,T=[{value:"day",label:f.toolbar.day},{value:"week",label:f.toolbar.week},{value:"month",label:f.toolbar.month}],N=[{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(eg,{options:T,value:t,onChange:A=>a(A),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(tg,{theme:e,value:c,onChange:p})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[m&&i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:i,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||f.toolbar.createTask})]}),(k||n)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Zu,{theme:e,onExportPNG:u,onExportPDF:v,onExportExcel:b,onExportCSV:g,onExportJSON:x,onExportMSProject:h}),n&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsxRuntime.jsx(Qu,{options:N,value:s,onChange:A=>l(A),theme:e})]})]})}function Zo({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,l]=react.useState({x:0,y:0}),c=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(!r)return;let m=d=>{c.current&&!c.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let n=e.filter(m=>m.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:p,onClick:()=>{if(!r&&p.current){let m=p.current.getBoundingClientRect();l({x:m.left,y:m.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(at,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),n.map(m=>jsxRuntime.jsxs("button",{onClick:()=>{t(m.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:m.label}),m.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function Gr({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let l=react.useRef(null),[c,p]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let m=200,d=r.length*36+8,i=8,u=window.innerWidth,v=window.innerHeight,b=t,g=a;t+m+i>u&&(b=t-m,b<i&&(b=i)),a+d+i>v&&(g=v-d-i,g<i&&(g=i)),p({x:b,y:g});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let m=i=>{l.current&&!l.current.contains(i.target)&&o();},d=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let n=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:n(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(m=>jsxRuntime.jsxs("div",{children:[m.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:d=>{m.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var kt={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 id({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:l,onTaskIndent:c,onTaskOutdent:p,onTaskRename:n,onTaskToggleExpand:m,onOpenTaskModal:d,enableKeyboard:i=true}){let u=react.useRef(false),v=react.useCallback(f=>{u.current=f;},[]),b=react.useCallback(f=>{let k=[],T=N=>{for(let A of N)k.push(A),A.subtasks&&A.subtasks.length>0&&A.isExpanded&&T(A.subtasks);};return T(f),k},[]),g=react.useCallback(()=>{let f=b(e);for(let k of f)if(t.has(k.id))return k;return null},[e,t,b]),x=react.useCallback((f,k)=>{let T=b(e);if(T.length===0)return;let N=g();if(!N){a(T[0].id,false);return}let A=T.findIndex(D=>D.id===N.id);if(A===-1)return;let C=f==="up"?A-1:A+1;if(C<0||C>=T.length)return;let W=T[C];a(W.id,k);},[e,g,b,a]),h=react.useCallback(f=>{if(!i)return;let k=f.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||u.current){f.key==="Escape"&&(k.blur(),u.current=false);return}let A=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,C=Array.from(t),W=g();if(f.key==="ArrowUp"){f.preventDefault(),x("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),x("down",f.shiftKey);return}if(W&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){W.subtasks&&W.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!W.isExpanded||f.key==="ArrowLeft"&&W.isExpanded)&&m(W.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){C.length>0&&(f.preventDefault(),l(C,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){C.length>0&&(f.preventDefault(),c(C));return}if(f.key==="Tab"&&f.shiftKey){C.length>0&&(f.preventDefault(),p(C));return}if(f.key==="Enter"&&!f.shiftKey&&!A){W&&(f.preventDefault(),r(W.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!A){W&&(f.preventDefault(),r(W.id,"above"));return}if(f.key==="Enter"&&A){W&&(f.preventDefault(),d(W.id));return}if(f.key==="F2"){W&&(f.preventDefault(),n(W.id));return}if(f.key==="Delete"||f.key==="Backspace"&&A){C.length>0&&(f.preventDefault(),o(C));return}if(f.key==="d"&&A&&!f.shiftKey){C.length>0&&(f.preventDefault(),s(C));return}},[i,t,g,x,r,o,s,l,c,p,n,m,d]);return react.useEffect(()=>{if(i)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[i,h]),{setIsEditing:v}}function dd(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(i=>{let u=new Set(i);return u.has(d)?u.delete(d):u.add(d),u}),r(d);},[]),l=react.useCallback((d,i)=>{if(!a){o(d);return}let u=i.indexOf(a),v=i.indexOf(d);if(u===-1||v===-1){o(d);return}let b=Math.min(u,v),g=Math.max(u,v),x=i.slice(b,g+1);t(new Set(x)),r(d);},[a,o]),c=react.useCallback((d,i,u,v)=>{v?l(d,i):u?s(d):o(d);},[o,s,l]),p=react.useCallback((d,i)=>{i?t(u=>{let v=new Set(u);return v.add(d),v}):o(d);},[o]),n=react.useCallback(()=>{t(new Set),r(null);},[]),m=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:l,handleTaskClick:c,handleKeyboardSelection:p,clearSelection:n,isTaskSelected:m}}function _r(e){let t=[],a=(r,o,s=0)=>{for(let l=0;l<r.length;l++){let c={...r[l],parentId:o,level:s,position:l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function cd(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=cd(a.subtasks,t);if(r)return r}}return null}function Ps(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Ps(a.subtasks,t);if(r)return r}return null}function Ms(e,t){if(t.length===0)return e;let a=_r(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],l=(d,i)=>{let u=[];return {tasks:d.filter(b=>{if(i.has(b.id))return u.push(b),false;if(b.subtasks){let g=l(b.subtasks,i);b.subtasks=g.tasks,u.push(...g.removed);}return true}),removed:u}},c=(d,i,u)=>d.map(v=>v.id===i?{...v,subtasks:[...v.subtasks||[],...u],isExpanded:true}:v.subtasks?{...v,subtasks:c(v.subtasks,i,u)}:v),p=new Set(t),{tasks:n,removed:m}=l(e,p);return c(n,s.id,m)}function As(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Ps(a,r);if(!o)continue;let s=Ps(a,o.id),l=(n,m,d)=>{for(let i=0;i<n.length;i++){let u=n[i];if(u.id===m&&u.subtasks){let v=u.subtasks.findIndex(b=>b.id===d);if(v!==-1){let[b]=u.subtasks.splice(v,1);return b}}if(u.subtasks){let v=l(u.subtasks,m,d);if(v)return v}}return null},c=(n,m,d)=>{let i=n.findIndex(u=>u.id===m);if(i!==-1)return n.splice(i+1,0,d),n;for(let u of n)u.subtasks&&c(u.subtasks,m,d);return n},p=l(a,o.id,r);p&&(s&&s.subtasks?c(s.subtasks,o.id,p):c(a,o.id,p));}return a}function Is(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(l,c,p)=>{let n=l.findIndex(d=>d.id===c);if(n===-1){for(let d of l)if(d.subtasks&&s(d.subtasks,c,p))return true;return false}let m=p==="up"?n-1:n+1;return m<0||m>=l.length?false:([l[n],l[m]]=[l[m],l[n]],true)};return s(r,o,a),r}function Ls(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 Fs(e,t){let a=[...e];for(let r of t){let o=l=>{let c=l.findIndex(m=>m.id===r);if(c===-1){for(let m of l)if(m.subtasks&&o(m.subtasks))return true;return false}let p=l[c],n={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks):void 0};return l.splice(c+1,0,n),true},s=l=>l.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function pd(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let l={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},c=p=>{let n=p.findIndex(d=>d.id===t);if(n===-1){for(let d of p)if(d.subtasks&&c(d.subtasks))return true;return false}let m=a==="above"?n:n+1;return p.splice(m,0,l),true};return c(r),{tasks:r,newTask:l}}function Bs(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Bs(r.subtasks,t,a)}:r)}function Rs(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Rs(a.subtasks,t)}:a)}function Os(e,t){let a=m=>{for(let d of m){if(d.id===t)return d;if(d.subtasks){let i=a(d.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let l=r?.startDate||o,c=r?.endDate||s,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(l),endDate:new Date(c),color:r?.color||"#3B82F6"},n=m=>m.map(d=>{if(d.id===t){let i=d.subtasks||[];return {...d,subtasks:[...i,p],isExpanded:true}}return d.subtasks?{...d,subtasks:n(d.subtasks)}:d});return {tasks:n(e),newTask:p}}function md(e,t,a,r){if(t===a)return e;let o=cd(e,t);if(!o)return e;if(a){let c=(p,n)=>{if(!p.subtasks)return false;for(let m of p.subtasks)if(m.id===n||c(m,n))return true;return false};if(c(o,a))return e}let s=c=>c.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p),l=s(e);if(a===null){let c=r!==void 0?r:l.length;l.splice(c,0,{...o,parentId:void 0});}else {let c=p=>p.map(n=>{if(n.id===a){let m=n.subtasks||[],d=r!==void 0?r:m.length,i=[...m];return i.splice(d,0,{...o,parentId:a}),{...n,subtasks:i,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:c(n.subtasks)}:n});l=c(l);}return l}function tn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:l,onTaskContextMenu:c,onTaskToggle:p,scrollTop:n,columns:m,onToggleColumn:d,onColumnResize:i,onTaskUpdate:u,onTaskIndent:v,onTaskOutdent:b,onTaskMove:g,onMultiTaskDelete:x,onTaskDuplicate:h,onTaskCreate:f,onTaskRename:k,onCreateSubtask:T,onOpenTaskModal:N,onDeleteRequest:A,onTaskReparent:C}){let W=react.useContext(Hr),[D,y]=react.useState(null),[M,S]=react.useState(false),[H,Y]=react.useState(null),[de,he]=react.useState(""),Ie=react.useRef(null),Le=react.useRef(null),[R,F]=react.useState(null),[U,E]=react.useState(0),[X,ee]=react.useState(0),[$,Me]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ve,qe]=react.useState(null),[ge,et]=react.useState(null),[Te,ot]=react.useState(null),gt=react.useRef(0),ft=5,tt=react.useRef(false),[B,se]=react.useState(null),[xe,De]=react.useState(false),[Ee,Ve]=react.useState(null);react.useEffect(()=>{function _(j){Ie.current&&!Ie.current.contains(j.target)&&S(false);}if(M)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[M]),react.useEffect(()=>{H&&Le.current&&(Le.current.focus(),Le.current.select());},[H]),react.useEffect(()=>{if(!R)return;let _=st=>{let He=st.clientX-U,fe=X+He;i?.(R,fe);},j=()=>{F(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",j),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",j),document.body.style.cursor="",document.body.style.userSelect="";}},[R,U,X,i]);let{selectedTaskIds:Ct,handleTaskClick:q,isTaskSelected:O}=dd(),{setIsEditing:we}=id({tasks:e,selectedTaskIds:Ct,onTaskSelect:(_,j)=>{let He=_r(e).map(fe=>fe.id);q(_,He,j||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:x||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:_=>{let j=_r(e).find(st=>st.id===_);j&&te(j);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:_=>{let j=_r(e).find(st=>st.id===_);j&&N&&N(j);},enableKeyboard:true}),We=(_,j=0)=>{let st=[];for(let He of _)st.push({task:He,level:j}),He.subtasks&&He.subtasks.length>0&&He.isExpanded&&st.push(...We(He.subtasks,j+1));return st},Ue=We(e),ht=48,Z=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,te=_=>{Y(_.id),he(_.name),we(true);},ke=_=>{de.trim()&&de!==e.find(j=>j.id===_)?.name&&k?.(_,de.trim()),Y(null),he(""),we(false);},Pe=()=>{Y(null),he(""),we(false);},J=(_,j)=>{j.stopPropagation(),T?.(_.id);},Ae=(_,j)=>{j.preventDefault(),gt.current=j.clientY,qe(_),tt.current=false,De(false),se({x:j.clientX,y:j.clientY});},ye=_=>{if(!ve||(Math.abs(_.clientY-gt.current)>ft&&!tt.current&&(tt.current=true,De(true)),se({x:_.clientX,y:_.clientY}),!tt.current))return;let st=document.querySelectorAll("[data-task-row]"),He=null,fe=null;st.forEach(Vt=>{let Tt=Vt.getBoundingClientRect(),z=Vt.getAttribute("data-task-row");if(z&&z!==ve&&_.clientY>=Tt.top&&_.clientY<=Tt.bottom){He=z;let pe=_.clientY-Tt.top,Ce=Tt.height;pe<Ce*.25?fe="above":pe>Ce*.75?fe="below":fe="child";}}),et(He),ot(fe);},Ne=()=>{if(tt.current&&ve&&ge&&Te){if(Te==="child")C?.(ve,ge);else if(Te==="above"||Te==="below"){let _=(He,fe,Vt=null)=>{for(let Tt of He){if(Tt.id===fe)return Vt;if(Tt.subtasks){let z=_(Tt.subtasks,fe,Tt.id);if(z!==void 0)return z}}},j=_(e,ge,null),st=(He,fe)=>{let Vt=He.findIndex(Tt=>Tt.id===fe);return Te==="below"?Vt+1:Vt};if(j===null){let He=st(e,ge);C?.(ve,null,He);}else {let He=Ue.find(fe=>fe.task.id===j)?.task;if(He?.subtasks){let fe=st(He.subtasks,ge);C?.(ve,j,fe);}}}}qe(null),et(null),ot(null),se(null),tt.current=false,De(false);};react.useEffect(()=>{if(ve)return document.addEventListener("mousemove",ye),document.addEventListener("mouseup",Ne),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ye),document.removeEventListener("mouseup",Ne),document.body.style.cursor="",document.body.style.userSelect="";}},[ve,ge,Te]);let ce=(_,j,st)=>{switch(_.id){case "name":let He=H===j.id,fe=D===j.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${st*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:fe?1:.3},onMouseDown:ie=>Ae(j.id,ie),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:ie=>{ie.stopPropagation(),p?.(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"}),!(j.subtasks&&j.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 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"}),He?jsxRuntime.jsx("input",{ref:Le,type:"text",value:de,onChange:ie=>he(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"?ke(j.id):ie.key==="Escape"&&Pe();},onBlur:()=>ke(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:ie=>ie.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}),fe&&!He&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ie=>ie.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ie=>J(j,ie),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:ie=>{ie.stopPropagation(),te(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 Tt=_.id==="startDate"?"startDate":"endDate",z=j[Tt],pe=Ee?.taskId===j.id&&Ee?.field===Tt,Ce=ie=>ie?(typeof ie=="string"?new Date(ie):ie).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:ie=>ie.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:ie=>{if(pe)Ve(null);else {let Dt=ie.currentTarget.getBoundingClientRect();Ve({taskId:j.id,field:Tt,month:z?typeof z=="string"?new Date(z):z:new Date,position:{top:Dt.bottom+4,left:Dt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Ce(z)})]}),pe&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Ve(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:Ee?.position.top,left:Ee?.position.left},onClick:ie=>ie.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ie=new Date,Dt=new Date(ie);Dt.setDate(ie.getDate()+1);let Jt=new Date(ie);Jt.setDate(ie.getDate()+7);let Sr=new Date(ie);return Sr.setDate(ie.getDate()+14),[{label:"Hoy",date:ie},{label:"Ma\xF1ana",date:Dt},{label:"Pr\xF3xima semana",date:Jt},{label:"2 semanas",date:Sr}].map((Pr,Wa)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:ir=>ir.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ir=>ir.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(j.id,{[Tt]:Pr.date}),Ve(null);},children:Pr.label},Wa))})(),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:ie=>ie.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(j.id,{[Tt]:void 0}),Ve(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:()=>Ve(ie=>ie?{...ie,month:new Date(ie.month.getFullYear(),ie.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:Ee?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Ve(ie=>ie?{...ie,month:new Date(ie.month.getFullYear(),ie.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((ie,Dt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ie},Dt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ie=Ee?.month||new Date,Dt=ie.getFullYear(),Jt=ie.getMonth(),Sr=new Date(Dt,Jt,1).getDay(),Er=new Date(Dt,Jt+1,0).getDate(),Pr=new Date,Wa=[];for(let Et=Sr-1;Et>=0;Et--)Wa.push({day:new Date(Dt,Jt,-Et).getDate(),date:new Date(Dt,Jt-1,new Date(Dt,Jt,-Et).getDate()),isCurrentMonth:false});for(let Et=1;Et<=Er;Et++)Wa.push({day:Et,date:new Date(Dt,Jt,Et),isCurrentMonth:true});let ir=42-Wa.length;for(let Et=1;Et<=ir;Et++)Wa.push({day:Et,date:new Date(Dt,Jt+1,Et),isCurrentMonth:false});return Wa.map((Et,Eo)=>{let Po=Et.date.toDateString()===Pr.toDateString(),Zr=(z?typeof z=="string"?new Date(z):z:null)?.toDateString()===Et.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:Et.isCurrentMonth?Zr?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Zr?"#3B82F6":"transparent",boxShadow:Po&&!Zr?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{u?.(j.id,{[Tt]:Et.date}),Ve(null);},children:Et.day},Eo)})})()})]})]})]}),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:Z(j)})});case "assignees":let $t=r.filter(ie=>j.assignees?.some(Dt=>Dt.name===ie.name||Dt.initials===ie.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx(mr,{assignedUsers:$t,availableUsers:r,onChange:ie=>{let Dt=ie.map(Jt=>({id:Jt.id,name:Jt.name,initials:Jt.initials,color:Jt.color}));u?.(j.id,{assignees:Dt.length>0?Dt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx(pl,{status:j.status||"todo",onChange:ie=>{u?.(j.id,{status:ie,progress:ie==="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 ea={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},qa={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Jr=ea[j.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx(cr,{priority:Jr,onChange:ie=>{ie&&u?.(j.id,{priority:qa[ie]||"medium"});}})});default:return null}},Re=_=>[{id:"hide",label:"Hide Column",icon:kt.Hide,onClick:()=>d(_),disabled:_==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:kt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:kt.SortDesc,onClick:()=>{}}],Fe=_=>_.subtasks&&_.subtasks.length>0?[{id:"addSubtask",label:W?.contextMenu?.addSubtask||"Add Subtask",icon:kt.Add,onClick:()=>{T?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:W?.contextMenu?.deleteTask||"Delete Task",icon:kt.Delete,onClick:()=>{A?A(_.id,_.name):x?.([_.id]);}}]:[{id:"edit",label:W?.contextMenu?.editTask||"Edit Task",icon:kt.Pencil,onClick:()=>{l?.(_);}},{id:"addSubtask",label:W?.contextMenu?.addSubtask||"Add Subtask",icon:kt.Add,onClick:()=>{T?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:W?.contextMenu?.markIncomplete||"Mark Incomplete",icon:kt.MarkIncomplete,onClick:()=>{u?.(_.id,{status:"todo",progress:0});},disabled:_.status==="todo"},{id:"setInProgress",label:W?.contextMenu?.setInProgress||"Set In Progress",icon:kt.SetInProgress,onClick:()=>{u?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"markComplete",label:W?.contextMenu?.markComplete||"Mark Complete",icon:kt.MarkComplete,onClick:()=>{u?.(_.id,{status:"completed",progress:100});},disabled:_.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:W?.contextMenu?.splitTask||"Split Task",icon:kt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:W?.contextMenu?.deleteTask||"Delete Task",icon:kt.Delete,onClick:()=>{A?A(_.id,_.name):x?.([_.id]);}}],Oe=m.filter(_=>_.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${ht}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[Oe.map((_,j)=>{let st=j===Oe.length-1,He=_.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${He?"":"justify-center"}`,style:{width:`${_.width}px`,minWidth:`${_.minWidth??(He?200:60)}px`,maxWidth:`${_.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:st?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:fe=>{fe.preventDefault(),Me({isOpen:true,x:fe.clientX,y:fe.clientY,type:"header",columnId:_.id});},onMouseEnter:fe=>{fe.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:fe=>{fe.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:He?"70px":"0"},title:_.label,children:_.label}),He&&jsxRuntime.jsxs("div",{className:"absolute flex items-center gap-1",style:{right:"4px",top:"50%",transform:"translateY(-50%)",zIndex:4},children:[jsxRuntime.jsx(Zo,{columns:m,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>S(!M),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})})]}),_.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:R===_.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:fe=>{fe.preventDefault(),fe.stopPropagation(),F(_.id),E(fe.clientX),ee(_.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},_.id)}),M&&jsxRuntime.jsxs("div",{ref:Ie,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:_=>_.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:()=>S(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",children:Ue.map(({task:_,level:j},st)=>{let He=O(_.id),fe=ge===_.id,Vt=fe&&Te==="above",Tt=fe&&Te==="below",z=fe&&Te==="child",pe={};return z&&(pe.backgroundColor=`${t.accent}15`,pe.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":_.id,className:`flex items-center cursor-pointer group ${ve===_.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:He?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:He?t.accentLight:z?`${t.accent}15`:st%2===0?t.bgPrimary:t.bgGrid,...pe},onMouseEnter:()=>y(_.id),onMouseLeave:()=>y(null),onClick:Ce=>{let ea=_r(e).map(ie=>ie.id),Jr=navigator.platform.toUpperCase().indexOf("MAC")>=0?Ce.metaKey:Ce.ctrlKey;q(_.id,ea,Jr,Ce.shiftKey),s?.(_);},onDoubleClick:Ce=>{Ce.stopPropagation(),l?.(_);},onContextMenu:Ce=>{Ce.preventDefault(),Me({isOpen:true,x:Ce.clientX,y:Ce.clientY,type:"task",task:_}),c?.(_,Ce);},whileHover:{backgroundColor:He?t.accentLight:t.hoverBg},children:[Vt&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Tt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Oe.map((Ce,$t)=>{let ea=$t===Oe.length-1,qa=Ce.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${qa?"justify-start":"justify-center"}`,style:{width:`${Ce.width}px`,minWidth:`${Ce.minWidth??(qa?200:60)}px`,maxWidth:`${Ce.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ea?"none":`1px solid ${D===_.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ce(Ce,_,qa?j:0)},`${_.id}-${Ce.id}`)})]},_.id)})}),jsxRuntime.jsx(Gr,{isOpen:$.isOpen,x:$.x,y:$.y,items:$.type==="header"&&$.columnId?Re($.columnId):$.type==="task"&&$.task?Fe($.task):[],onClose:()=>Me({...$,isOpen:false}),theme:t}),xe&&B&&ve&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:B.x+12,top:B.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let _=Ue.find(j=>j.task.id===ve)?.task;return _?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:_.name})}):null})()}),document.body)]})}function bd(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[l,c]=react.useState(e),[p,n]=react.useState(t),[m,d]=react.useState(null),[i,u]=react.useState(null),[v,b]=react.useState(null),[g,x]=react.useState(null),[h,f]=react.useState(0),[k,T]=react.useState(0),[N,A]=react.useState(null),[C,W]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:l,setGhostX:c,ghostWidth:p,setGhostWidth:n,connectionLine:m,setConnectionLine:d,hoveredTaskId:i,setHoveredTaskId:u,activeZone:v,setActiveZone:b,draggedSegmentIndex:g,setDraggedSegmentIndex:x,draggedSegmentStartX:h,setDraggedSegmentStartX:f,segmentDragOffsetX:k,setSegmentDragOffsetX:T,hoveredSegmentIndex:N,setHoveredSegmentIndex:A,isHovered:C,setIsHovered:W,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(H,Y)=>{r("none"),d(null),u(null),c(H),n(Y),T(0),x(null),f(0);}}}function an({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:l,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:d,onDependencyCreate:i,allTaskPositions:u=[],onDragMove:v,onHoverChange:b}){let g=bd(t,r),x=react.useRef(null),{dragMode:h,setDragMode:f,dragOffset:k,setDragOffset:T,ghostX:N,setGhostX:A,ghostWidth:C,setGhostWidth:W,connectionLine:D,setConnectionLine:y,hoveredTaskId:M,setHoveredTaskId:S,activeZone:H,setActiveZone:Y,draggedSegmentIndex:de,setDraggedSegmentIndex:he,draggedSegmentStartX:Ie,setDraggedSegmentStartX:Le,segmentDragOffsetX:R,setSegmentDragOffsetX:F,hoveredSegmentIndex:U,setHoveredSegmentIndex:E,isHovered:X,setIsHovered:ee,isDragging:$,isResizing:Me,isConnecting:ve,resetDragState:qe}=g,ge=32,et=8,Te=e.endDate&&e.endDate<new Date&&e.progress<100,ot=e.isCriticalPath,gt=o.name==="neutral"||o.today==="#1C1917",ft=e.status==="completed"||e.progress===100,tt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},se=e.isCriticalPath||Te?"#DC2626":e.color?e.color:e.priority&&tt[e.priority]?tt[e.priority]:o.taskBarPrimary,De=(J=>J>=80?20:J>=60?15:J>=50?12:10)(r),Ee=r<50,Ve=r<40;react.useEffect(()=>{if(b)if(X&&!$&&!e.segments){let J=a<100;b({task:e,x:t,y:a,width:r,height:ge,showBelow:J});}else b(null);},[X,$,e,t,a,r,ge,b]);let Ct=J=>J.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),q=()=>{let J=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${J} day${J!==1?"s":""}`},O=J=>Math.round(J/s)*s,we=J=>{let Ae=Math.round(J/s),ye=new Date(l);return ye.setDate(ye.getDate()+Ae),ye},We=(J,Ae)=>{for(let ye of u){if(ye.id===e.id)continue;let Ne=5;if(J>=ye.x-Ne&&J<=ye.x+ye.width+Ne&&Ae>=ye.y-Ne&&Ae<=ye.y+ye.height+Ne)return ye.id}return null},Ue=react.useCallback((J,Ae,ye)=>{J.preventDefault(),J.stopPropagation();let Ne=x.current?.ownerSVGElement;if(!Ne)return;let ce=Ne.createSVGPoint();ce.x=J.clientX,ce.y=J.clientY;let Re=ce.matrixTransform(Ne.getScreenCTM()?.inverse()),Fe=ye!==void 0?ye:t,Oe=Ae;if(!Oe){let _=Re.x-Fe;J.shiftKey?(Oe="connect",y({x:t+r,y:a+ge/2})):J.ctrlKey||J.metaKey?Oe="move":J.altKey?Oe=_<r/2?"resize-start":"resize-end":Ve?_<r/2?Oe="move":Oe="resize-end":Ee?_<=De/2?Oe="resize-start":_>=r-De/2?Oe="resize-end":Oe="move":_<=De?Oe="resize-start":_>=r-De?Oe="resize-end":Oe="move";}f(Oe),ee(false),Y(null),Oe==="move"?T(Re.x-Fe):Oe==="connect"?y({x:t+r,y:a+ge/2}):T(0),A(Fe),W(r);},[t,r,a,ge]),ht=react.useCallback(J=>{if(h==="none")return;let Ae=x.current?.ownerSVGElement;if(!Ae)return;let ye=Ae.createSVGPoint();ye.x=J.clientX,ye.y=J.clientY;let Ne=ye.matrixTransform(Ae.getScreenCTM()?.inverse());if(h==="connect"){y({x:Ne.x,y:Ne.y});let ce=We(Ne.x,Ne.y);S(ce);}else if(h==="move"){let ce=Ne.x-k,Re=O(ce);A(Re),W(r);let Fe=Math.round((Re-t)/s);if(v?.(e.id,Fe,true),e.segments&&e.segments.length>0&&de!==null){let Oe=Re-Ie;F(Oe);}}else if(h==="resize-start"){let ce=Ne.x,Re=O(ce),Fe=t+r-Re;Fe>=s&&(A(Re),W(Fe));}else if(h==="resize-end"){let ce=Ne.x,Fe=O(ce)-t;Fe>=s&&W(Fe);}},[h,t,r,s,k,e,O,de,Ie,We,S,y,A,W,F,v]),Z=react.useCallback(()=>{if(h!=="none"){if(h==="connect")M&&i&&i(e,M),y(null),S(null);else {let J=e.endDate.getTime()-e.startDate.getTime(),Ae,ye,Ne=true;if(h==="move"){if(Ae=we(N),ye=new Date(Ae.getTime()+J),e.segments&&e.segments.length>0&&de!==null){let ce=Math.round(R/s),Re=e.segments.map((j,st)=>{if(st===de){let He=new Date(j.startDate),fe=new Date(j.endDate);return He.setDate(He.getDate()+ce),fe.setDate(fe.getDate()+ce),{startDate:He,endDate:fe}}return j}),Fe=Re.flatMap(j=>[j.startDate,j.endDate]),Oe=new Date(Math.min(...Fe.map(j=>j.getTime()))),_=new Date(Math.max(...Fe.map(j=>j.getTime())));d?.({...e,segments:Re},Oe,_),qe(t,r);return}}else h==="resize-start"?(Ae=we(N),ye=e.endDate,Ae>=ye&&(console.warn("Invalid date range: start date must be before end date"),Ne=false)):h==="resize-end"?(Ae=e.startDate,ye=we(N+C),ye<=Ae&&(console.warn("Invalid date range: end date must be after start date"),Ne=false)):Ne=false;Ne&&Ae&&ye&&(ye.getTime()-Ae.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):d?.(e,Ae,ye));}v?.(e.id,0,false),qe(t,r);}},[h,N,C,e,d,M,i,t,r,s,we,R,de,qe,v]);react.useEffect(()=>{if(h==="none")return;let J=ye=>{ht(ye);},Ae=()=>{Z();};return window.addEventListener("mousemove",J),window.addEventListener("mouseup",Ae),()=>{window.removeEventListener("mousemove",J),window.removeEventListener("mouseup",Ae);}},[h,ht,Z]);let te=$&&!ve?N:t,ke=$&&!ve?C:r,Pe=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:x,onMouseEnter:()=>!$&&ee(true),onMouseLeave:()=>{$||(ee(false),Y(null));},onClick:()=>!$&&p?.(e),onDoubleClick:J=>{$||(J.stopPropagation(),n?.(e));},onContextMenu:J=>{J.preventDefault(),m?.(e,J);},children:[X&&!$&&!Ee&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:De,height:ge,fill:H==="resize-start"?o.accent:"transparent",opacity:H==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Y("resize-start"),onMouseDown:J=>Ue(J,"resize-start")}),jsxRuntime.jsx("rect",{x:t+De,y:a,width:r-De*2,height:ge,fill:H==="move"?o.accent:"transparent",opacity:H==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>Y("move"),onMouseDown:J=>Ue(J,"move")}),jsxRuntime.jsx("rect",{x:t+r-De,y:a,width:De,height:ge,fill:H==="resize-end"?o.accent:"transparent",opacity:H==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Y("resize-end"),onMouseDown:J=>Ue(J,"resize-end")})]}),X&&!$&&Ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ge,fill:H==="move"?o.accent:"transparent",opacity:H==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>Y("move"),onMouseDown:J=>Ue(J,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ge,fill:H==="resize-end"?o.accent:"transparent",opacity:H==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Y("resize-end"),onMouseDown:J=>Ue(J,"resize-end")}),X&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ge-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),$&&!ve&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:N,y:a,width:C,height:ge,rx:et,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:te,y:a,width:ke,height:ge,rx:et,fill:se,"data-task-class":Pe,initial:{opacity:0,scale:.95},animate:{opacity:$&&!ve?.15:e.parentId?.6:X?.9:.8,scale:X&&!$?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:J=>Ue(J),style:{cursor:$?ve?"crosshair":Me?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:te,y:a,width:ke*(e.progress/100),height:ge,rx:et,fill:se,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((J,Ae)=>{let ye=(J.startDate.getTime()-l.getTime())/864e5*s,ce=(J.endDate.getTime()-l.getTime())/(1e3*60*60*24)*s-ye+s,Re=$&&h==="move"&&de===Ae,Fe=U===Ae,Oe=Re?ye+R:ye;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!$&&E(Ae),onMouseLeave:()=>!$&&E(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Oe,y:a,width:ce,height:ge,rx:et,fill:se,initial:{opacity:0,scale:.95},animate:{opacity:Re||e.parentId?.6:Fe?.9:.8,scale:Fe&&!$?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:_=>{_.stopPropagation(),he(Ae),Le(ye),Ue(_,void 0,ye);},style:{cursor:$?ve?"crosshair":Me?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Oe,y:a,width:ce*(e.progress/100),height:ge,rx:et,fill:se,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ae}`)}),gt&&(Te||ot)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ot&&!Te&&jsxRuntime.jsx("rect",{x:te,y:a,width:ke,height:ge,rx:et,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Te&&jsxRuntime.jsx("rect",{x:te,y:a,width:ke,height:ge,rx:et,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ke>60&&!e.segments&&(()=>{let J=c.taskLabel(e),Ae=typeof J=="string"?J:e.name,ye=Ae.length>Math.floor(ke/8)?`${Ae.substring(0,Math.floor(ke/8))}...`:Ae;return jsxRuntime.jsx("text",{x:te+12,y:a+ge/2,dominantBaseline:"middle",fill:ft?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ft?"line-through":"none"},children:ye})})(),ke>100&&e.progress>0&&e.progress<100&&!$&&!e.segments&&jsxRuntime.jsxs("text",{x:te+ke-12,y:a+ge/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&&ke>80&&!$&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:te+ke-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:te+ke-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(X||Me)&&!ve&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Ee?te-15:te-10,y:a-5,width:Ee?25:20,height:ge+10,fill:"transparent",onMouseDown:J=>Ue(J,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ee?te-8:te-3,y:a+6,width:Ee?8:6,height:Ee?ge-12:ge-16,rx:3,fill:h==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:h==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:te+ke-10,y:a-5,width:Ee?25:20,height:ge+10,fill:"transparent",onMouseDown:J=>Ue(J,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ee?te+ke:te+ke-3,y:a+6,width:Ee?8:6,height:Ee?ge-12:ge-16,rx:3,fill:h==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:h==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:X&&!$&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+8,cy:a+ge/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:J=>{J.stopPropagation(),Ue(J,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+ge/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),ve&&D&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ge/2,x2:D.x,y2:D.y,stroke:M?o.statusCompleted:o.accent,strokeWidth:M?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:M?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:D.x,cy:D.y,r:M?8:6,fill:M?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),M&&jsxRuntime.jsx(framerMotion.motion.text,{x:D.x+15,y:D.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:D.x+10},animate:{opacity:1,x:D.x+15},transition:{duration:.2},children:"Connect"})]}),(X||$)&&!ve&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:te-2,y:a-2,width:ke+4,height:ge+4,rx:et+2,fill:"none",stroke:$?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:$?.6:.4,initial:{opacity:0},animate:{opacity:$?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Me&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:N,y1:0,x2:N,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:N+C,y1:0,x2:N+C,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:X&&!$&&!e.segments&&!b&&(()=>{let ye=a<100,Ne=ye?a+ge+13:a-82-13,ce=ye?`M ${te+ke/2-6} ${a+ge+3} L ${te+ke/2} ${a+ge+13} L ${te+ke/2+6} ${a+ge+3}`:`M ${te+ke/2-6} ${a-13} L ${te+ke/2} ${a-3} L ${te+ke/2+6} ${a-13}`,Re=Ne+22,Fe=Ne+40,Oe=Ne+55,_=Ne+70,j=ye?Ne+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:ye?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ye?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:ce,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:te+ke/2-120,y:Ne,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:te+ke/2,y:Re,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:te+ke/2-110,y:Fe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:te+ke/2-70,y:Fe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ct(e.startDate)}),jsxRuntime.jsx("text",{x:te+ke/2-110,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:te+ke/2-70,y:Oe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ct(e.endDate)}),jsxRuntime.jsx("text",{x:te+ke/2+10,y:Fe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:te+ke/2+65,y:Fe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:q()}),jsxRuntime.jsx("text",{x:te+ke/2+10,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:te+ke/2+65,y:Oe,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:te+ke/2-110,y:_,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:te+ke/2-50,y:_,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(st=>st.name).join(", ").substring(0,30),e.assignees.map(st=>st.name).join(", ").length>30?"...":""]})]}),!ye&&jsxRuntime.jsx("text",{x:te+ke/2,y:j,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ve?"Left: move \u2022 Right: resize":Ee?"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 xd({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:l,showBelow:c}=e,p=82,n=13,m=c?o+l+n:o-p-n,d=c?`M ${r+s/2-6} ${o+l+3} L ${r+s/2} ${o+l+13} L ${r+s/2+6} ${o+l+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=m+22,u=m+40,v=m+55,b=m+70,g=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),x=()=>{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:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:m,width:240,height:p,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:i,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?g(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?g(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:x()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:v,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:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:b,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 nn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:l}){let[c,p]=react.useState(false),n=a-e,m=r-t,d=e+n/2,i=`M ${e} ${t} C ${d} ${t}, ${d} ${r}, ${a} ${r}`,u=6,v=Math.atan2(m,n),b=a-u*Math.cos(v-Math.PI/6),g=r-u*Math.sin(v-Math.PI/6),x=a-u*Math.cos(v+Math.PI/6),h=r-u*Math.sin(v+Math.PI/6),f=o.dependency;react.useEffect(()=>{l&&s&&l(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,l]);let k=!s&&!l;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!k&&p(true),onMouseLeave:()=>!k&&p(false),style:{pointerEvents:k?"none":"auto"},children:[!k&&jsxRuntime.jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:i,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&l?0:c?1:.8,strokeWidth:c?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${b} ${g} M ${a} ${r} L ${x} ${h}`,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&l?0:c?1:.8,scale:c?1.1:1,strokeWidth:c?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:f,initial:{scale:0},animate:{scale:c&&l?0:c?1.3:1,opacity:c&&l?0:c?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),c&&s&&!l&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:T=>{T.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:d,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:d-4,y1:(t+r)/2-4,x2:d+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:d+4,y1:(t+r)/2-4,x2:d-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function ln({task:e,x:t,y:a,theme:r,onClick:o}){let[s,l]=react.useState(false),c=16,p=n=>n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:p(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 ne={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=n=>{n.forEach(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let l=new Set,c=new Set,p=n=>{if(!l.has(n)){l.add(n),c.add(n);let m=r.get(n)||[];for(let d of m){if(!l.has(d)&&p(d))return true;if(c.has(d))return true}}return c.delete(n),false};return p(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=ne.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ne.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ne.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=ne.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(`
46
46
  `)},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=ne.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=ne.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)=>ne.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=ne.findTaskById(e,t);return !a||!a.dependencies?[]:ne.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>ne.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>ne.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=ne.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=>ne.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=ne.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let l=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=s.map(p=>{let n=p.startDate&&p.endDate?ne.calculateDuration(p.startDate,p.endDate):0;return [p.name,p.startDate?ne.formatDate(p.startDate):"N/A",p.endDate?ne.formatDate(p.endDate):"N/A",n>0?`${n} days`:"N/A",`${p.progress}%`,p.status||"N/A"]});r(o,{head:l,body:c,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=ne.flattenTasks(e).map(p=>{let n=p.startDate&&p.endDate?ne.calculateDuration(p.startDate,p.endDate):0;return {"Task ID":p.id,"Task Name":p.name,"Start Date":p.startDate?ne.formatDate(p.startDate):"","End Date":p.endDate?ne.formatDate(p.endDate):"","Duration (days)":n>0?n:"","Progress (%)":p.progress,Status:p.status||"",Assignees:p.assignees?.map(m=>m.name).join(", ")||"",Dependencies:p.dependencies?.join(", ")||"","Is Milestone":p.isMilestone?"Yes":"No","Parent ID":p.parentId||"",Level:p.level||0}}),s=a.utils.json_to_sheet(o),l=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=l;let c=a.utils.book_new();a.utils.book_append_sheet(c,s,"Gantt Tasks"),a.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=ne.flattenTasks(e),o=new Map;r.forEach((i,u)=>{o.set(i.id,u+1);});let s=i=>i.toISOString().replace("Z",""),l=ne.getEarliestStartDate(e)||new Date,c=ne.getLatestEndDate(e)||new Date,p=r.map((i,u)=>{let v=o.get(i.id),b=i.startDate&&i.endDate?ne.calculateDuration(i.startDate,i.endDate):0,g=(i.dependencies||[]).filter(x=>o.has(x)).map(x=>`
47
47
  <PredecessorLink>
48
48
  <PredecessorUID>${o.get(x)}</PredecessorUID>
@@ -273,9 +273,9 @@
273
273
  </Calendars>
274
274
  <Tasks>${p}
275
275
  </Tasks>
276
- </Project>`,m=new Blob([n],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(m),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=ne.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let m=n.startDate&&n.endDate?ne.calculateDuration(n.startDate,n.endDate):0,d=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let v=t.find(b=>b.id===u);if(v){o(v);let b=r.get(u)?.ef||0;d=Math.max(d,b);}}let i=d+m;r.set(n.id,{es:d,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),l=new Map,c=n=>{if(l.has(n.id))return;let m=n.startDate&&n.endDate?ne.calculateDuration(n.startDate,n.endDate):0,d=t.filter(v=>v.dependencies&&v.dependencies.includes(n.id)),i=s;if(d.length>0)for(let v of d){c(v);let b=l.get(v.id)?.ls||0;i=Math.min(i,b);}let u=i-m;l.set(n.id,{ls:u,lf:i});};a.forEach(c);let p=[];for(let n of a){let m=r.get(n.id),d=l.get(n.id);if(m&&d){let i=d.ls-m.es;Math.abs(i)<.01&&p.push(n.id);}}return p},calculateSlack:(e,t)=>{let a=ne.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ne.calculateCriticalPath(e).includes(t))return 0;let o=ne.getDependentTasks(e,t);if(o.length===0){let c=ne.getLatestEndDate(e);if(!c)return null;let p=ne.calculateDuration(a.endDate,c);return Math.max(0,p)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,p)=>c-p)[0];if(!s)return null;let l=ne.calculateDuration(a.endDate,new Date(s));return Math.max(0,l)},isOnCriticalPath:(e,t)=>ne.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ne.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ne.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let c=ne.calculateDuration(l.startDate,l.endDate),p;a!==void 0?(p=new Date(l.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let n=ne.calculateEndDate(p,c),m=d=>d.map(i=>i.id===l.id?{...i,startDate:p,endDate:n}:i.subtasks?{...i,subtasks:m(i.subtasks)}:i);s=m(s),s=ne.autoScheduleDependents(s,l.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,l,c)=>{if(a===0)return [];let p=[],n=o.getTime(),m=1e3*60*60*24,d=ne.findTaskById(e,t);if(!d||!d.endDate)return [];let i=(u,v,b=new Set)=>{if(b.has(u))return;b.add(u);let g=ne.getDependentTasks(e,u);for(let x of g){if(!x.startDate||!x.endDate)continue;let h=r.findIndex(y=>y.id===x.id);if(h===-1)continue;let f=x.startDate.getTime(),T=(x.endDate.getTime()-f)/m,A=(f-n)/m*s,C=A+v*s,W=Math.max(T*s,s),D=c+h*l+12;p.push({taskId:x.id,taskName:x.name,originalX:A,previewX:C,width:W,y:D,rowIndex:h,daysDelta:v,color:x.color}),i(x.id,v,b);}};return i(t,a),p},splitTask:(e,t,a,r=3)=>{let o=ne.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let l=new Date(a);l.setDate(l.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:s},{startDate:l,endDate:c}],n=m=>m.map(d=>d.id===o.id?{...d,endDate:c,segments:p}:d.subtasks?{...d,subtasks:n(d.subtasks)}:d);return n(e)}};function cn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:l,templates:c,onTaskClick:p,onTaskDblClick:n,onTaskContextMenu:m,onTaskDateChange:d,onDependencyCreate:i,onDependencyDelete:u}){let[b,g]=react.useState([]),[x,h]=react.useState(null),[f,k]=react.useState(null),T=react.useCallback(R=>{h(R);},[]),N=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),A=r==="day"?60:r==="week"?20:8,C=N*A*l,W=R=>{let F=new Date(Date.UTC(R.getFullYear(),R.getMonth(),R.getDate())),U=F.getUTCDay()||7;F.setUTCDate(F.getUTCDate()+4-U);let E=new Date(Date.UTC(F.getUTCFullYear(),0,1));return Math.ceil(((F.getTime()-E.getTime())/864e5+1)/7)},D=R=>{let F=R.getDay();return F===0||F===6},y=react.useCallback(R=>{let F=Math.round(R/(A*l)),U=new Date(o);return U.setDate(U.getDate()+F),U},[o,A,l]),M=react.useCallback((R,F)=>{if(F.startDate&&F.endDate)return;let U=R.currentTarget.ownerSVGElement;if(!U)return;let E=U.createSVGPoint();E.x=R.clientX,E.y=R.clientY;let X=E.matrixTransform(U.getScreenCTM()?.inverse()),ee=y(X.x),z=new Date(ee);z.setDate(z.getDate()+1),d?.(F,ee,z);},[y,d]),S=react.useMemo(()=>{let R=X=>X.map(ee=>{if(ee.subtasks&&ee.subtasks.length>0){let z=R(ee.subtasks),Me=z.filter(ve=>ve.startDate&&ve.endDate);if(Me.length>0){let ve=Me.map(Te=>Te.startDate.getTime()),Xe=Me.map(Te=>Te.endDate.getTime()),ge=new Date(Math.min(...ve)),et=new Date(Math.max(...Xe));return {...ee,subtasks:z,startDate:ge,endDate:et}}return {...ee,subtasks:z}}return ee}),F=(X,ee=[])=>{for(let z of X)ee.push(z),z.subtasks&&z.subtasks.length>0&&(z.isExpanded===void 0||z.isExpanded)&&F(z.subtasks,ee);return ee},U=R(e);return F(U)},[e]),H=react.useCallback(R=>{if(!R.startDate||!R.endDate)return {x:0,width:0};let F=R.startDate.getTime(),U=R.endDate.getTime(),E=o.getTime(),X=(F-E)/(1e3*60*60*24),ee=(U-F)/(1e3*60*60*24),z=X*A*l,Me=Math.max(A*l,40),ve=Math.max(ee*A*l,Me);return {x:z,width:ve}},[o,A,l]),Y=react.useMemo(()=>S.filter(R=>R.startDate&&R.endDate).map(R=>{let{x:F,width:U}=H(R),X=S.findIndex(ee=>ee.id===R.id)*a+12;return {id:R.id,x:F,y:X,width:U,height:32}}),[S,H]),de=react.useCallback((R,F,U)=>{if(!U||F===0){g([]);return}let E=ne.calculateCascadePreview(e,R,F,S,o,A*l,a,48);g(E);},[e,S,o,A,l,a,48]),he=react.useMemo(()=>{let R=[],F=new Date(o);for(;F<=s;){let X=(F.getTime()-o.getTime())/864e5*A*l;if(r==="day")R.push({date:new Date(F),label:F.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:X}),F.setDate(F.getDate()+1);else if(r==="week"){let ee=W(F);R.push({date:new Date(F),label:`Week ${ee}`,x:X}),F.setDate(F.getDate()+7);}else R.push({date:new Date(F),label:F.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:X}),F.setMonth(F.getMonth()+1);}return R},[o,s,r,A,l]),Ie=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*A*l,[o,A,l]),Le=Math.max(S.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(C,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(C,1e3),height:48,fill:t.bgGrid}),he.map((R,F)=>jsxRuntime.jsxs("g",{children:[F>0&&jsxRuntime.jsx("line",{x1:R.x,y1:0,x2:R.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:R.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:R.label})]},`header-${F}`)),Ie>=0&&Ie<=C&&jsxRuntime.jsx("circle",{cx:Ie,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(C,1e3),height:Le,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(C,1e3),height:Le,fill:t.bgPrimary}),he.map((R,F)=>{let U=he[F+1]?.x||C,E=D(R.date);return jsxRuntime.jsxs("g",{children:[E&&jsxRuntime.jsx("rect",{x:R.x,y:0,width:U-R.x,height:S.length*a,fill:t.bgWeekend,opacity:1}),F>0&&jsxRuntime.jsx("line",{x1:R.x,y1:0,x2:R.x,y2:S.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},F)}),Ie>=0&&Ie<=C&&jsxRuntime.jsx("line",{x1:Ie,y1:0,x2:Ie,y2:S.length*a,stroke:t.today,strokeWidth:2,opacity:1}),S.map((R,F)=>{let U=R.startDate&&R.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:C,height:a,fill:F%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${R.id}`),!U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:C,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:E=>M(E,R),onMouseEnter:E=>{E.currentTarget.setAttribute("fill",t.accentLight),E.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:E=>{E.currentTarget.setAttribute("fill","transparent"),E.currentTarget.setAttribute("opacity","1");}},`clickable-${R.id}`),jsxRuntime.jsx("text",{x:Ie>0?Ie:100,y:F*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${R.id}`)]})]},`row-group-${R.id}`)}),S.map((R,F)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(U=>{let E=S.find(Me=>Me.id===U);if(!E||!E.startDate||!E.endDate)return null;let X=S.findIndex(Me=>Me.id===U),ee=H(E),z=H(R);return jsxRuntime.jsx(nn,{x1:ee.x+ee.width,y1:X*a+a/2,x2:z.x,y2:F*a+a/2,theme:t},`dep-${U}-${R.id}`)})),S.map((R,F)=>{if(!R.startDate||!R.endDate)return null;let{x:U,width:E}=H(R),X=F*a+12,ee=R.subtasks&&R.subtasks.length>0&&!R.isMilestone;return R.isMilestone?jsxRuntime.jsx(ln,{task:R,x:U+E/2,y:X+16,theme:t,onClick:p},R.id):ee?jsxRuntime.jsxs("g",{onClick:()=>p?.(R),onContextMenu:z=>{z.preventDefault(),z.stopPropagation(),m?.(R,z);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:U,y:X,width:E,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:U,y1:X,x2:U+E,y2:X,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U,y1:X,x2:U,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U+E,y1:X,x2:U+E,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U,y1:X+32,x2:U+E,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),E>60&&jsxRuntime.jsx("text",{x:U+12,y:X+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:R.name})]},R.id):jsxRuntime.jsx(an,{task:R,x:U,y:X,width:E,theme:t,dayWidth:A*l,startDate:o,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:d,onDependencyCreate:i,allTaskPositions:Y,onDragMove:de,onHoverChange:T},R.id)}),S.map((R,F)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(U=>{let E=S.find(xe=>xe.id===U);if(!E||!E.startDate||!E.endDate)return null;let X=S.findIndex(xe=>xe.id===U),ee=H(E),z=H(R),Me=ee.x+ee.width,ve=X*a+a/2,Xe=z.x,ge=F*a+a/2,et=Xe-Me,Te=Me+et/2,ot=xe=>{let De=1-xe,Ee=De*De,Ve=Ee*De,Ct=xe*xe,q=Ct*xe,O=Ve*Me+3*Ee*xe*Te+3*De*Ct*Te+q*Xe,we=Ve*ve+3*Ee*xe*ve+3*De*Ct*ge+q*ge;return {x:O,y:we}},gt=20,ft=[];for(let xe=0;xe<=gt;xe++){let De=.1+xe/gt*.8;ft.push(ot(De));}let tt=ft[0],B=`M ${tt.x} ${tt.y} `+ft.slice(1).map(xe=>`L ${xe.x} ${xe.y}`).join(" ");return f&&f.x1===Me&&f.y1===ve&&f.x2===Xe&&f.y2===ge?null:jsxRuntime.jsx("path",{d:B,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{k({x1:Me,y1:ve,x2:Xe,y2:ge,onDelete:()=>u?.(R.id,U)});}},`dep-hover-${U}-${R.id}`)})),b.map(R=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:R.previewX,y:R.y-48,width:R.width,height:32,rx:8,fill:R.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(R.daysDelta)>0&&jsxRuntime.jsx("text",{x:R.previewX+R.width/2,y:R.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:R.daysDelta>0?`+${R.daysDelta}d`:`${R.daysDelta}d`})]},`cascade-preview-${R.taskId}`)),f&&(()=>{let{x1:R,y1:F,x2:U,y2:E,onDelete:X}=f,ee=U-R,z=E-F,Me=R+ee/2,ve=(F+E)/2,Xe=`M ${R} ${F} C ${Me} ${F}, ${Me} ${E}, ${U} ${E}`,ge=6,et=Math.atan2(z,ee),Te=U-ge*Math.cos(et-Math.PI/6),ot=E-ge*Math.sin(et-Math.PI/6),gt=U-ge*Math.cos(et+Math.PI/6),ft=E-ge*Math.sin(et+Math.PI/6),tt=t.dependency,B="#f87171";return jsxRuntime.jsxs("g",{onMouseLeave:()=>k(null),children:[jsxRuntime.jsx("path",{d:Xe,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:Me,cy:ve,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:Xe,fill:"none",stroke:tt,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:Xe,fill:"none",stroke:tt,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${U} ${E} L ${Te} ${ot} M ${U} ${E} L ${gt} ${ft}`,fill:"none",stroke:tt,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:U,cy:E,r:4,fill:tt,opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:xe=>{xe.stopPropagation(),k(null),X();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:Me,cy:ve,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:B,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsxRuntime.jsx("line",{x1:Me-3,y1:ve-3,x2:Me+3,y2:ve+3,stroke:B,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Me+3,y1:ve-3,x2:Me-3,y2:ve+3,stroke:B,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),x&&jsxRuntime.jsx(kd,{tooltipData:x,theme:t})]})]})}var pn=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];var Hs=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Gs=[{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 mn({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:l=false,mode:c=a?"edit":"create",theme:p="dark",customStatuses:n=[],availableTags:m=[],onCreateTag:d,attachments:i=[],onUploadAttachments:u,onDeleteAttachment:v}){let b=[...Hs,...n.filter(B=>!Hs.some(se=>se.id===B.id))],g=Ge[p]||Ge.dark,[x,h]=react.useState(false),[f,k]=react.useState(false),[T,N]=react.useState(false),[A,C]=react.useState(false),[W,D]=react.useState({top:0,left:0}),[y,M]=react.useState(null),[S,H]=react.useState(new Date),[Y,de]=react.useState({top:0,left:0}),[he,Ie]=react.useState(false),[Le,R]=react.useState([]),F=react.useRef(null),U=react.useRef(null),E=react.useRef(null),X=react.useRef(null),ee=react.useRef(null),[z,Me]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[ve,Xe]=react.useState({});react.useEffect(()=>{a?(Me({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)&&Ie(true)):(Me({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Ie(false),R([]));},[a,e]),react.useEffect(()=>{let B=se=>{F.current&&!F.current.contains(se.target)&&h(false),U.current&&!U.current.contains(se.target)&&k(false),E.current&&!E.current.contains(se.target)&&N(false),X.current&&!X.current.contains(se.target)&&C(false);};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);let ge=()=>{let B={};return z.name.trim()||(B.name="El nombre es requerido"),z.startDate&&z.endDate&&z.startDate>z.endDate&&(B.endDate="La fecha de fin debe ser posterior a la de inicio"),Xe(B),Object.keys(B).length===0},et=async B=>{if(B.preventDefault(),!!ge())try{let se=c==="create"&&Le.length>0?{...z,pendingFiles:Le}:z;await s(se),R([]),t();}catch(se){console.error("Error submitting task:",se);}},Te=(B,se)=>{Me(xe=>{let De={...xe,[B]:se};if(B==="status"){let Ee=se;Ee==="todo"?De.progress=0:Ee==="in-progress"?(xe.progress===0||xe.progress===100)&&(De.progress=50):Ee==="completed"||Ee==="closed"?De.progress=100:(Ee==="in-review"||Ee==="review")&&(De.progress=75);}if(B==="progress"){let Ee=typeof se=="number"?se:parseInt(se,10);Ee===100&&xe.status!=="completed"?De.status="completed":Ee>0&&Ee<100&&xe.status==="todo"?De.status="in-progress":Ee===0&&xe.status!=="todo"&&(De.status="todo");}return De}),ve[B]&&Xe(xe=>{let De={...xe};return delete De[B],De});},ot=b.find(B=>B.id===z.status)??Hs[0],gt=Gs.find(B=>B.id===z.priority)??Gs[1],ft=pn.find(B=>B.value===z.color)??pn[0],tt={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",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:B=>B.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:ot.color||g.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:B=>{B.currentTarget.style.backgroundColor=g.hoverBg,B.currentTarget.style.color=g.textPrimary;},onMouseLeave:B=>{B.currentTarget.style.backgroundColor="transparent",B.currentTarget.style.color=g.textTertiary;},disabled:l,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:z.name,onChange:B=>Te("name",B.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:l,autoFocus:true}),ve.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"}),ve.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:z.description||"",onChange:B=>Te("description",B.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:l})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:F,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&h(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...tt,borderColor:ot.color,backgroundColor:`${ot.color}15`},disabled:l,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:ot.color}}),jsxRuntime.jsx("span",{style:{color:ot.color},children:ot.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:ot.color}})]}),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-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:b.map(B=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:se=>se.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("status",B.id),h(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:B.color}}),B.title,z.status===B.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},B.id))})})]}),jsxRuntime.jsxs("div",{ref:U,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&k(!f),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:tt,disabled:l,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:gt.color}}),jsxRuntime.jsx("span",{children:gt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:Gs.map(B=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:se=>se.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("priority",B.id),k(false);},children:[jsxRuntime.jsx("span",{children:B.icon}),B.label,z.priority===B.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},B.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:E,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&N(!T),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:tt,disabled:l,children:[z.assignees&&z.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:z.assignees.slice(0,3).map((B,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:B.color||g.accent,borderColor:g.bgSecondary},children:B.initials},se))}),z.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:g.textTertiary},children:["+",z.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(B=>{let se=z.assignees?.some(xe=>xe.name===B.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:xe=>xe.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:xe=>xe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let xe=se?(z.assignees||[]).filter(De=>De.name!==B.name):[...z.assignees||[],{name:B.name,avatar:B.avatar,initials:B.name.split(" ").map(De=>De[0]).join("").toUpperCase().slice(0,2),color:g.accent}];Te("assignees",xe);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:g.accent},children:B.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:B.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:se&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},B.id)})})})]}),jsxRuntime.jsxs("div",{ref:X,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!l)if(A)C(false);else {if(X.current){let B=X.current.getBoundingClientRect(),se=window.innerHeight,xe=120,Ee=se-B.bottom<xe?B.top-xe-8:B.bottom+8;D({top:Ee,left:B.left});}C(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:tt,disabled:l,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:z.color}}),jsxRuntime.jsx("span",{children:ft.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:A&&jsxRuntime.jsxs(at,{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:`${W.top}px`,left:`${W.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:B=>B.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"14px 18px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 16px)",gap:"14px"},children:pn.slice(0,18).map(B=>{let se=z.color===B.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>{Te("color",B.value),C(false);},style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:B.value,outline:se?`2px solid ${B.value}`:"none",outlineOffset:"3px",cursor:"pointer",border:"none"},whileHover:{scale:1.2},whileTap:{scale:.95},title:B.name},B.value)})})})})]})})]}),m.length>0||d?jsxRuntime.jsx(Rr,{selectedTags:z.tags||[],availableTags:m,onChange:B=>Te("tags",B),onCreateTag:d,theme:g,disabled:l}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{ref:ee,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!l&&!z.isMilestone)if(y==="start")M(null);else {if(ee.current){let B=ee.current.getBoundingClientRect(),se=window.innerHeight,xe=320,Ee=se-B.bottom<xe?B.top-xe-8:B.bottom+8;de({top:Ee,left:B.left});}M("start"),H(z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...tt,opacity:z.isMilestone?.5:1,cursor:z.isMilestone?"not-allowed":"pointer"},disabled:l||z.isMilestone,children:z.startDate?z.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!l&&!z.isMilestone)if(y==="end")M(null);else {if(ee.current){let B=ee.current.getBoundingClientRect(),se=window.innerHeight,xe=320,Ee=se-B.bottom<xe?B.top-xe-8:B.bottom+8;de({top:Ee,left:B.left});}M("end"),H(z.endDate||z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...tt,opacity:z.isMilestone?.5:1,cursor:z.isMilestone?"not-allowed":"pointer"},disabled:l||z.isMilestone,children:z.endDate?z.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsxs(at,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>M(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:`${Y.top}px`,left:`${Y.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let B=new Date,se=new Date(B);se.setDate(B.getDate()+1);let xe=new Date(B);xe.setDate(B.getDate()+7);let De=new Date(B);return De.setDate(B.getDate()+14),[{label:"Hoy",date:B},{label:"Ma\xF1ana",date:se},{label:"Pr\xF3xima semana",date:xe},{label:"2 semanas",date:De}].map((Ve,Ct)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{y==="start"?(Te("startDate",Ve.date),(!z.endDate||Ve.date>z.endDate)&&Te("endDate",Ve.date),M("end")):(Te("endDate",Ve.date),(!z.startDate||Ve.date<z.startDate)&&Te("startDate",Ve.date),M(null));},children:Ve.label},Ct))})(),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:B=>B.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("startDate",void 0),Te("endDate",void 0),M(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:()=>H(new Date(S.getFullYear(),S.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:S.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>H(new Date(S.getFullYear(),S.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((B,se)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:B},se))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let B=S.getFullYear(),se=S.getMonth(),xe=new Date(B,se,1).getDay(),De=new Date(B,se+1,0).getDate(),Ee=new Date,Ve=[];for(let q=xe-1;q>=0;q--)Ve.push({day:new Date(B,se,-q).getDate(),date:new Date(B,se-1,new Date(B,se,-q).getDate()),isCurrentMonth:false});for(let q=1;q<=De;q++)Ve.push({day:q,date:new Date(B,se,q),isCurrentMonth:true});let Ct=42-Ve.length;for(let q=1;q<=Ct;q++)Ve.push({day:q,date:new Date(B,se+1,q),isCurrentMonth:false});return Ve.map((q,O)=>{let we=q.date.toDateString()===Ee.toDateString(),We=z.startDate?.toDateString()===q.date.toDateString(),Ue=z.endDate?.toDateString()===q.date.toDateString(),ht=z.startDate&&z.endDate&&q.date>=z.startDate&&q.date<=z.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:q.isCurrentMonth?We||Ue?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:We?"#3B82F6":Ue?"#7C3AED":ht?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:we&&!We&&!Ue?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{y==="start"?(Te("startDate",q.date),z.endDate&&q.date>z.endDate&&Te("endDate",q.date),M("end")):(Te("endDate",q.date),z.startDate&&q.date<z.startDate&&Te("startDate",q.date),M(null));},children:q.day},O)})})()})]})]})]})})]}),ve.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:ve.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:z.progress,onChange:B=>Te("progress",parseInt(B.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:z.progress<30?"#EF4444":z.progress<70?"#F59E0B":"#10B981"},disabled:l}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${z.progress<30?"#EF4444":z.progress<70?"#F59E0B":"#10B981"}20`,color:z.progress<30?"#EF4444":z.progress<70?"#F59E0B":"#10B981"},children:[z.progress,"%"]})]})]}),(u||i.length>0||c==="create")&&jsxRuntime.jsxs("div",{className:"pt-2",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 ",c==="create"?Le.length>0&&`(${Le.length})`:i.length>0&&`(${i.length})`]})]}),c==="create"?jsxRuntime.jsx(za,{cardId:"pending",attachments:Le.map((B,se)=>({id:`pending-${se}`,cardId:"pending",name:B.name,size:B.size,type:B.type,url:URL.createObjectURL(B),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:B=>R(se=>[...se,...B]),onDelete:B=>{let se=parseInt(B.replace("pending-",""),10);R(xe=>xe.filter((De,Ee)=>Ee!==se));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(za,{cardId:a?.id||"new",attachments:i,onUpload:u&&a?.id?B=>u(a.id,B):void 0,onDelete:v,maxSizeMB:10,maxFiles:20}),c==="create"&&Le.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[Le.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ie(!he),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 ${he?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:he&&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:[jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:z.isMilestone,onChange:B=>Te("isMilestone",B.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:l}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:g.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:g.bgSecondary},children:r.filter(B=>B.id!==a?.id).map(B=>{let se=z.dependencies?.includes(B.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let xe=se?(z.dependencies||[]).filter(De=>De!==B.id):[...z.dependencies||[],B.id];Te("dependencies",xe);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:se?`${g.accent}30`:g.bgPrimary,color:se?g.accent:g.textSecondary,border:`1px solid ${se?g.accent:g.borderLight}`},disabled:l,children:B.name},B.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:B=>B.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",disabled:l,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:l,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:B=>!l&&(B.currentTarget.style.opacity="0.9"),onMouseLeave:B=>!l&&(B.currentTarget.style.opacity="1"),children:l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var rf=['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"'],Nd=()=>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"})]}),of=()=>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"})}),nf=()=>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"})}),sf=()=>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"})}),lf=()=>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 un({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:l,onDependencyCreate:c,onDependencyDelete:p}){let[n,m]=react.useState(false),[d,i]=react.useState(false),[u,v]=react.useState([]),[b,g]=react.useState(""),[x,h]=react.useState(false),[f,k]=react.useState(true),T=react.useRef(null),N=react.useRef(null),A=react.useRef(null),{enabled:C=true,placeholder:W='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:D="bottom-right",onCommand:y,suggestions:M=rf,maxHistory:S=50,persistHistory:H}=a,Y=H?.storageKey||"gantt-ai-history",de=H?.maxMessages??5;react.useEffect(()=>{if(H?.enabled)try{let U=localStorage.getItem(Y);if(U){let X=JSON.parse(U).map(ee=>({...ee,timestamp:new Date(ee.timestamp)}));v(X.slice(-de));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[H?.enabled,Y,de]),react.useEffect(()=>{if(H?.enabled&&u.length>0)try{let U=u.filter(E=>!E.isLoading).slice(-de);localStorage.setItem(Y,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[u,H?.enabled,Y,de]),react.useEffect(()=>{N.current&&N.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!d&&T.current&&setTimeout(()=>T.current?.focus(),100);},[n,d]);let he=react.useCallback(U=>{if(U.success)switch(U.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":U.taskId&&U.updates&&o?.(U.taskId,U.updates);break;case "create_task":U.newTask&&s?.(U.newTask);break;case "delete_task":U.taskId&&l?.(U.taskId);break;case "link_tasks":U.dependencyFrom&&U.dependencyTo&&c?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&p?.(U.taskId,U.dependencyFrom);break}},[o,s,l,c,p]),Ie=react.useCallback(async U=>{if(!U.trim()||x)return;let E={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};v(ee=>[...ee.slice(-(S-1)),E]),g(""),k(false),h(true);let X={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(ee=>[...ee,X]);try{if(y){let ee=await y(U,e);v(z=>{let Me=z.filter(Xe=>!Xe.isLoading),ve={id:`assistant-${Date.now()}`,role:"assistant",content:ee.message,timestamp:new Date,command:ee};return [...Me,ve]}),he(ee);}else v(ee=>[...ee.filter(Me=>!Me.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(ee){v(z=>[...z.filter(ve=>!ve.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${ee instanceof Error?ee.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[x,S,y,e,he]),Le=U=>{U.preventDefault(),Ie(b);},R=U=>{g(U),T.current?.focus();};if(react.useEffect(()=>{let U=E=>{(E.metaKey||E.ctrlKey)&&E.key==="k"&&(E.preventDefault(),m(X=>!X),n||i(false)),E.key==="Escape"&&n&&m(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[n]),react.useEffect(()=>{if(!n)return;let U=X=>{let ee=X.target;A.current&&!A.current.contains(ee)&&m(false);},E=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(E),document.removeEventListener("mousedown",U);}},[n]),!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(at,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${F[D]} 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:()=>m(true),children:[jsxRuntime.jsx(Nd,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:A,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${F[D]} 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(Nd,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>i(U=>!U),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(sf,{})}),jsxRuntime.jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(nf,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[u.length===0&&f&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:M.slice(0,4).map((U,E)=>jsxRuntime.jsx("button",{onClick:()=>R(U),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:U.length>30?U.slice(0,30)+"...":U},E))})]}),u.map(U=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${U.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${U.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:U.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:U.role==="user"?"white":t.textPrimary},children:[U.isLoading?jsxRuntime.jsx(lf,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:U.content}),U.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:U.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:U.command.success?"#10B981":"#EF4444"},children:[U.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsxRuntime.jsx("div",{ref:N})]}),jsxRuntime.jsxs("form",{onSubmit:Le,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:T,type:"text",value:b,onChange:U=>g(U.target.value),placeholder:W,disabled:x,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!b.trim()||x,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:b.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:b.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(of,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Sd(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,m=true)=>{r(d=>{let i=typeof n=="function"?n(d.present):n;if(o.current)return {...d,present:i};if(!m)return {...d,present:i};let u=[...d.past,d.present];return u.length>t&&u.shift(),{past:u,present:i,future:[]}});},[t]),l=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let m=n.past[n.past.length-1],d=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[n.present,...n.future]}});},[]),c=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let m=n.future[0],d=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:m,future:d}});},[]),p=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:l,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function Ed({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=l=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=c?l.metaKey:l.ctrlKey;if(p&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!c&&p&&l.key==="y"){l.preventDefault(),t();return}if(c&&p&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var mf={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ne.formatDate(e.startDate)} - ${ne.formatDate(e.endDate)}`);let a=ne.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=>ne.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Pd(e){return {...mf,...e}}var vf=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Id=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:l="week",rowDensity:c="comfortable",showThemeSelector:p=true,showExportButton:n=true,availableUsers:m=[],templates:d,enableAutoCriticalPath:i=true,aiAssistant:u,locale:v="en",customTranslations:b,showCreateTaskButton:g=false,createTaskLabel:x,onCreateTask:h,onThemeChange:f,onTaskClick:k,onTaskDblClick:T,onTaskContextMenu:N,onTaskUpdate:A,onProgressChange:C,onTaskEdit:W,onTaskAddSubtask:D,onTaskMarkIncomplete:y,onTaskSetInProgress:M,onDependencyCreate:S,onDependencyDelete:H,onBeforeTaskAdd:Y,onAfterTaskAdd:de,onBeforeTaskUpdate:he,onAfterTaskUpdate:Ie,onBeforeTaskDelete:Le,onAfterTaskDelete:R}=a,U=react.useContext(qo)?.theme,[E,X]=react.useState(U||s||"dark"),[ee,z]=react.useState(l),[Me,ve]=react.useState(c),[Xe,ge]=react.useState(1),[et,Te]=react.useState(0),[ot,gt]=react.useState(false),[ft,tt]=react.useState(null),[B,se]=react.useState({isOpen:false,x:0,y:0,task:null}),[xe,De]=react.useState(null),[Ee,Ve]=react.useState(null);react.useEffect(()=>{U&&U!==E&&X(U);},[U]),react.useEffect(()=>{s&&s!==E&&X(s);},[s]);let Ct=react.useCallback(P=>{X(P),f?.(P);},[f]),{state:q,setState:O,undo:we,redo:We,canUndo:Ue,canRedo:ht,clearHistory:Z}=Sd(t,50),te=react.useRef(new Map);react.useEffect(()=>{let P=I=>I.map(K=>{let ae=te.current.get(K.id),le=ae!==void 0?{...K,isExpanded:ae}:K;return le.subtasks?.length?{...le,subtasks:P(le.subtasks)}:le});te.current.size>0?O(P(t)):O(t);},[t,O]);let ke=react.useRef(t),Pe=react.useRef(true);react.useEffect(()=>{if(Pe.current){Pe.current=false,ke.current=q;return}if(!r)return;let P=JSON.stringify(ke.current),I=JSON.stringify(q);P!==I&&(ke.current=q,r(q));},[q,r]);let J=react.useMemo(()=>Ns(v,b),[v,b]),Ae=react.useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:P.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:P.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:P.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:P.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:P.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:P.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:P.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[ye,Ne]=react.useState(()=>Ae(J));react.useEffect(()=>{Ne(P=>P.map(I=>({...I,label:J.columns[I.id==="name"?"taskName":I.id]||I.label})));},[J]);let ce=react.useMemo(()=>{let P=ye.filter(ae=>ae.visible),I=P.some(ae=>ae.id!=="name");return P.reduce((ae,le)=>ae+le.width,0)+(I?20:0)},[ye]);react.useEffect(()=>{ft!==null&&ft>ce&&(ye.filter(K=>K.visible).some(K=>K.id!=="name")||tt(null));},[ye,ce,ft]);let Re=react.useMemo(()=>ft!==null?Math.max(280,ft,ce):Math.max(280,ce),[ft,ce]),Fe=react.useRef(null),Oe=react.useRef(null),_=react.useRef(null),j=react.useMemo(()=>Kl(E),[E]),st=react.useMemo(()=>({theme:j,themeName:E}),[j,E]),He=react.useMemo(()=>Pd(d),[d]),fe=react.useMemo(()=>{if(!i)return q;let P=ne.calculateCriticalPath(q),I=K=>K.map(ae=>({...ae,isCriticalPath:P.includes(ae.id),subtasks:ae.subtasks?I(ae.subtasks):void 0}));return I(q)},[q,i]),Vt=vf(Me);Ed({undo:we,redo:We,canUndo:Ue,canRedo:ht,enabled:true}),react.useImperativeHandle(o,()=>({getTask:P=>ne.findTaskById(q,P),addTask:(P,I)=>{O(K=>{if(!I)return [...K,{...P,level:0}];let ae=le=>le.map(Se=>Se.id===I?{...Se,subtasks:[...Se.subtasks||[],{...P,parentId:I,level:(Se.level||0)+1}],isExpanded:true}:Se.subtasks?{...Se,subtasks:ae(Se.subtasks)}:Se);return ae(K)});},updateTask:(P,I)=>{O(K=>{let ae=le=>le.map(Se=>Se.id===P?{...Se,...I}:Se.subtasks?{...Se,subtasks:ae(Se.subtasks)}:Se);return ae(K)});},deleteTask:P=>{O(I=>{let K=ae=>ae.filter(le=>le.id===P?false:(le.subtasks&&(le.subtasks=K(le.subtasks)),true));return K(I)});},deleteTasks:P=>{O(I=>Ls(I,P));},duplicateTask:P=>{O(I=>Fs(I,[P]));},splitTask:(P,I,K=3)=>{O(ae=>ne.splitTask(ae,P,I,K));},calculateEndDate:ne.calculateEndDate,calculateDuration:ne.calculateDuration,validateDependency:(P,I)=>!ne.validateDependencies(q,P,I),getAllTasks:()=>ne.flattenTasks(q),getTasksByStatus:P=>ne.flattenTasks(q).filter(I=>I.status===P),getTasksByParent:P=>P?ne.findTaskById(q,P)?.subtasks||[]:q.filter(K=>!K.parentId),getCriticalPath:()=>ne.flattenTasks(q).filter(P=>P.isCriticalPath),indentTask:P=>{O(I=>Ms(I,[P]));},outdentTask:P=>{O(I=>As(I,[P]));},moveTask:(P,I)=>{O(K=>Is(K,[P],I));},createSubtask:async P=>{let{tasks:I,newTask:K}=Os(q,P);if(Y){let ae=Y({...K,parentId:P});if((ae instanceof Promise?await ae:ae)===false)return}O(I),de&&de({...K,parentId:P});},scrollToTask:P=>{let K=ne.flattenTasks(q).findIndex(ae=>ae.id===P);if(K!==-1&&Fe.current){let ae=K*Vt;Fe.current.scrollTo({top:ae,behavior:"smooth"}),Oe.current&&Oe.current.scrollTo({top:ae,behavior:"smooth"});}},highlightTask:(P,I=2e3)=>{},expandTask:P=>{O(I=>{let K=ae=>ae.map(le=>le.id===P?{...le,isExpanded:true}:le.subtasks?{...le,subtasks:K(le.subtasks)}:le);return K(I)});},collapseTask:P=>{O(I=>{let K=ae=>ae.map(le=>le.id===P?{...le,isExpanded:false}:le.subtasks?{...le,subtasks:K(le.subtasks)}:le);return K(I)});},expandAll:()=>{O(P=>{let I=K=>K.map(ae=>({...ae,isExpanded:true,subtasks:ae.subtasks?I(ae.subtasks):void 0}));return I(P)});},collapseAll:()=>{O(P=>{let I=K=>K.map(ae=>({...ae,isExpanded:false,subtasks:ae.subtasks?I(ae.subtasks):void 0}));return I(P)});},undo:we,redo:We,canUndo:()=>Ue,canRedo:()=>ht,clearHistory:Z,exportToPNG:async()=>{if(!_.current)throw new Error("Gantt container not found");let P=await Ad__default.default(_.current,{backgroundColor:j.bgPrimary,scale:2});return new Promise((I,K)=>{P.toBlob(ae=>{ae?I(ae):K(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async P=>{await ne.exportToPDF(q,P);},exportToExcel:async P=>{await ne.exportToExcel(q,P);},exportToJSON:()=>ne.exportToJSON(q),exportToCSV:()=>ne.exportToCSV(q),importFromJSON:P=>{let I=ne.importFromJSON(P);O(I);},getTasks:()=>q,refresh:()=>{O(P=>[...P]);},clearAll:()=>{O([]);}}),[q,we,We,Ue,ht,Z,j,Vt]);let Tt=react.useCallback(P=>{Ne(I=>I.map(K=>K.id===P?{...K,visible:!K.visible}:K));},[]),$=react.useCallback((P,I)=>{Ne(K=>K.map(ae=>{if(ae.id!==P)return ae;let le=ae.minWidth??100,Se=ae.maxWidth??800,Bt=Math.max(le,Math.min(Se,I));return {...ae,width:Bt}}));},[]),pe=react.useCallback(P=>{O(I=>{let K=Rs(I,P),ae=le=>{for(let Se of le){if(Se.id===P){te.current.set(P,Se.isExpanded??true);return}Se.subtasks?.length&&ae(Se.subtasks);}};return ae(K),K}),a.onTaskToggleExpand?.(P);},[a]),Ce=react.useCallback((P,I)=>{if(he&&he(P,I)===false)return;let ae=ne.findTaskById(q,P)?.progress,le=Bt=>Bt.map(Ht=>Ht.id===P?{...Ht,...I}:Ht.subtasks?{...Ht,subtasks:le(Ht.subtasks)}:Ht);O(le(q));let Se=ne.findTaskById(le(q),P);Se&&(A?.(Se),Ie?.(Se),I.progress!==void 0&&ae!==void 0&&I.progress!==ae&&C?.(P,ae,I.progress));},[q,A,he,Ie,C]),zt=react.useCallback(P=>{P.length!==0&&(O(I=>Ms(I,P)),a.onTaskIndent?.(P[0]));},[a]),ea=react.useCallback(P=>{P.length!==0&&(O(I=>As(I,P)),a.onTaskOutdent?.(P[0]));},[a]),qa=react.useCallback((P,I,K)=>{O(ae=>ud(ae,P,I,K)),a.onTaskReparent?.(P,I,K);},[a]),Xr=react.useCallback((P,I)=>{P.length!==0&&(O(K=>Is(K,P,I)),a.onTaskMove?.(P[0],I));},[a]),ie=react.useCallback(async P=>{let I=[];for(let K of P)Le&&await Promise.resolve(Le(K))===false||I.push(K);I.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(I):(O(K=>Ls(K,I)),I.forEach(K=>a.onTaskDelete?.(K))),R&&I.forEach(K=>R(K)));},[a,Le,R]),Dt=react.useCallback(P=>{O(I=>Fs(I,P)),P.forEach(I=>a.onTaskDuplicate?.(I));},[a]),Jt=react.useCallback((P,I)=>{O(K=>{let{tasks:ae,newTask:le}=md(K,P,I);return Y&&Y(le)===false?K:(a.onTaskCreate?.(le.parentId,le.position||0),de?.(le),ae)});},[a,Y,de]),Sr=react.useCallback((P,I)=>{O(K=>Bs(K,P,I)),a.onTaskRename?.(P,I);},[a]),Er=react.useCallback(P=>{O(I=>{let{tasks:K}=Os(I,P);return a.onTaskCreate?.(P,0),K});},[a]),Pr=react.useCallback((P,I,K)=>{let ae=P.startDate?Math.round((I.getTime()-P.startDate.getTime())/864e5):0,le=Ht=>Ht.map(Zt=>Zt.id===P.id?{...Zt,startDate:I,endDate:K,...P.segments&&{segments:P.segments}}:Zt.subtasks?{...Zt,subtasks:le(Zt.subtasks)}:Zt),Se=le(q);Se=ne.autoScheduleDependents(Se,P.id,ae),O(Se);let Bt={...P,startDate:I,endDate:K};A?.(Bt);},[q,A]),Wa=react.useCallback((P,I)=>{N?.(P,I),se({isOpen:true,x:I.clientX,y:I.clientY,task:P});},[N]),ir=react.useCallback((P,I)=>{let K=ne.splitTask(q,P.id,I);O(K),se({isOpen:false,x:0,y:0,task:null});},[q]),Et=react.useCallback(P=>{let I=ne.findTaskById(q,P.id)||P;T?.(I),W||De(I);},[q,T,W]),So=react.useCallback((P,I,K)=>{let ae=new Map,le=Na=>{Na.forEach(Ha=>{Ha.dependencies&&ae.set(Ha.id,Ha.dependencies),Ha.subtasks&&le(Ha.subtasks);});};le(K);let Se=ae.get(I)||[];ae.set(I,[...Se,P]);let Bt=new Set,Ht=new Set,Zt=Na=>{if(!Bt.has(Na)){Bt.add(Na),Ht.add(Na);let Ha=ae.get(Na)||[];for(let lr of Ha){if(!Bt.has(lr)&&Zt(lr))return true;if(Ht.has(lr))return true}}return Ht.delete(Na),false};return Zt(I)},[]),Eo=react.useCallback((P,I)=>{if(So(P.id,I,q)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
276
+ </Project>`,m=new Blob([n],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(m),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=ne.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let m=n.startDate&&n.endDate?ne.calculateDuration(n.startDate,n.endDate):0,d=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let v=t.find(b=>b.id===u);if(v){o(v);let b=r.get(u)?.ef||0;d=Math.max(d,b);}}let i=d+m;r.set(n.id,{es:d,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),l=new Map,c=n=>{if(l.has(n.id))return;let m=n.startDate&&n.endDate?ne.calculateDuration(n.startDate,n.endDate):0,d=t.filter(v=>v.dependencies&&v.dependencies.includes(n.id)),i=s;if(d.length>0)for(let v of d){c(v);let b=l.get(v.id)?.ls||0;i=Math.min(i,b);}let u=i-m;l.set(n.id,{ls:u,lf:i});};a.forEach(c);let p=[];for(let n of a){let m=r.get(n.id),d=l.get(n.id);if(m&&d){let i=d.ls-m.es;Math.abs(i)<.01&&p.push(n.id);}}return p},calculateSlack:(e,t)=>{let a=ne.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ne.calculateCriticalPath(e).includes(t))return 0;let o=ne.getDependentTasks(e,t);if(o.length===0){let c=ne.getLatestEndDate(e);if(!c)return null;let p=ne.calculateDuration(a.endDate,c);return Math.max(0,p)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,p)=>c-p)[0];if(!s)return null;let l=ne.calculateDuration(a.endDate,new Date(s));return Math.max(0,l)},isOnCriticalPath:(e,t)=>ne.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ne.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ne.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let c=ne.calculateDuration(l.startDate,l.endDate),p;a!==void 0?(p=new Date(l.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let n=ne.calculateEndDate(p,c),m=d=>d.map(i=>i.id===l.id?{...i,startDate:p,endDate:n}:i.subtasks?{...i,subtasks:m(i.subtasks)}:i);s=m(s),s=ne.autoScheduleDependents(s,l.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,l,c)=>{if(a===0)return [];let p=[],n=o.getTime(),m=1e3*60*60*24,d=ne.findTaskById(e,t);if(!d||!d.endDate)return [];let i=(u,v,b=new Set)=>{if(b.has(u))return;b.add(u);let g=ne.getDependentTasks(e,u);for(let x of g){if(!x.startDate||!x.endDate)continue;let h=r.findIndex(y=>y.id===x.id);if(h===-1)continue;let f=x.startDate.getTime(),T=(x.endDate.getTime()-f)/m,A=(f-n)/m*s,C=A+v*s,W=Math.max(T*s,s),D=c+h*l+12;p.push({taskId:x.id,taskName:x.name,originalX:A,previewX:C,width:W,y:D,rowIndex:h,daysDelta:v,color:x.color}),i(x.id,v,b);}};return i(t,a),p},splitTask:(e,t,a,r=3)=>{let o=ne.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let l=new Date(a);l.setDate(l.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:s},{startDate:l,endDate:c}],n=m=>m.map(d=>d.id===o.id?{...d,endDate:c,segments:p}:d.subtasks?{...d,subtasks:n(d.subtasks)}:d);return n(e)}};function cn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:l,templates:c,onTaskClick:p,onTaskDblClick:n,onTaskContextMenu:m,onTaskDateChange:d,onDependencyCreate:i,onDependencyDelete:u}){let[b,g]=react.useState([]),[x,h]=react.useState(null),[f,k]=react.useState(null),T=react.useCallback(R=>{h(R);},[]),N=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),A=r==="day"?60:r==="week"?20:8,C=N*A*l,W=R=>{let F=new Date(Date.UTC(R.getFullYear(),R.getMonth(),R.getDate())),U=F.getUTCDay()||7;F.setUTCDate(F.getUTCDate()+4-U);let E=new Date(Date.UTC(F.getUTCFullYear(),0,1));return Math.ceil(((F.getTime()-E.getTime())/864e5+1)/7)},D=R=>{let F=R.getDay();return F===0||F===6},y=react.useCallback(R=>{let F=Math.round(R/(A*l)),U=new Date(o);return U.setDate(U.getDate()+F),U},[o,A,l]),M=react.useCallback((R,F)=>{if(F.startDate&&F.endDate)return;let U=R.currentTarget.ownerSVGElement;if(!U)return;let E=U.createSVGPoint();E.x=R.clientX,E.y=R.clientY;let X=E.matrixTransform(U.getScreenCTM()?.inverse()),ee=y(X.x),$=new Date(ee);$.setDate($.getDate()+1),d?.(F,ee,$);},[y,d]),S=react.useMemo(()=>{let R=X=>X.map(ee=>{if(ee.subtasks&&ee.subtasks.length>0){let $=R(ee.subtasks),Me=$.filter(ve=>ve.startDate&&ve.endDate);if(Me.length>0){let ve=Me.map(Te=>Te.startDate.getTime()),qe=Me.map(Te=>Te.endDate.getTime()),ge=new Date(Math.min(...ve)),et=new Date(Math.max(...qe));return {...ee,subtasks:$,startDate:ge,endDate:et}}return {...ee,subtasks:$}}return ee}),F=(X,ee=[])=>{for(let $ of X)ee.push($),$.subtasks&&$.subtasks.length>0&&($.isExpanded===void 0||$.isExpanded)&&F($.subtasks,ee);return ee},U=R(e);return F(U)},[e]),H=react.useCallback(R=>{if(!R.startDate||!R.endDate)return {x:0,width:0};let F=R.startDate.getTime(),U=R.endDate.getTime(),E=o.getTime(),X=(F-E)/(1e3*60*60*24),ee=(U-F)/(1e3*60*60*24),$=X*A*l,Me=Math.max(A*l,40),ve=Math.max(ee*A*l,Me);return {x:$,width:ve}},[o,A,l]),Y=react.useMemo(()=>S.filter(R=>R.startDate&&R.endDate).map(R=>{let{x:F,width:U}=H(R),X=S.findIndex(ee=>ee.id===R.id)*a+12;return {id:R.id,x:F,y:X,width:U,height:32}}),[S,H]),de=react.useCallback((R,F,U)=>{if(!U||F===0){g([]);return}let E=ne.calculateCascadePreview(e,R,F,S,o,A*l,a,48);g(E);},[e,S,o,A,l,a,48]),he=react.useMemo(()=>{let R=[],F=new Date(o);for(;F<=s;){let X=(F.getTime()-o.getTime())/864e5*A*l;if(r==="day")R.push({date:new Date(F),label:F.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:X}),F.setDate(F.getDate()+1);else if(r==="week"){let ee=W(F);R.push({date:new Date(F),label:`Week ${ee}`,x:X}),F.setDate(F.getDate()+7);}else R.push({date:new Date(F),label:F.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:X}),F.setMonth(F.getMonth()+1);}return R},[o,s,r,A,l]),Ie=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*A*l,[o,A,l]),Le=Math.max(S.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(C,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(C,1e3),height:48,fill:t.bgGrid}),he.map((R,F)=>jsxRuntime.jsxs("g",{children:[F>0&&jsxRuntime.jsx("line",{x1:R.x,y1:0,x2:R.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:R.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:R.label})]},`header-${F}`)),Ie>=0&&Ie<=C&&jsxRuntime.jsx("circle",{cx:Ie,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(C,1e3),height:Le,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(C,1e3),height:Le,fill:t.bgPrimary}),he.map((R,F)=>{let U=he[F+1]?.x||C,E=D(R.date);return jsxRuntime.jsxs("g",{children:[E&&jsxRuntime.jsx("rect",{x:R.x,y:0,width:U-R.x,height:S.length*a,fill:t.bgWeekend,opacity:1}),F>0&&jsxRuntime.jsx("line",{x1:R.x,y1:0,x2:R.x,y2:S.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},F)}),Ie>=0&&Ie<=C&&jsxRuntime.jsx("line",{x1:Ie,y1:0,x2:Ie,y2:S.length*a,stroke:t.today,strokeWidth:2,opacity:1}),S.map((R,F)=>{let U=R.startDate&&R.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:C,height:a,fill:F%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${R.id}`),!U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:C,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:E=>M(E,R),onMouseEnter:E=>{E.currentTarget.setAttribute("fill",t.accentLight),E.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:E=>{E.currentTarget.setAttribute("fill","transparent"),E.currentTarget.setAttribute("opacity","1");}},`clickable-${R.id}`),jsxRuntime.jsx("text",{x:Ie>0?Ie:100,y:F*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${R.id}`)]})]},`row-group-${R.id}`)}),S.map((R,F)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(U=>{let E=S.find(Me=>Me.id===U);if(!E||!E.startDate||!E.endDate)return null;let X=S.findIndex(Me=>Me.id===U),ee=H(E),$=H(R);return jsxRuntime.jsx(nn,{x1:ee.x+ee.width,y1:X*a+a/2,x2:$.x,y2:F*a+a/2,theme:t},`dep-${U}-${R.id}`)})),S.map((R,F)=>{if(!R.startDate||!R.endDate)return null;let{x:U,width:E}=H(R),X=F*a+12,ee=R.subtasks&&R.subtasks.length>0&&!R.isMilestone;return R.isMilestone?jsxRuntime.jsx(ln,{task:R,x:U+E/2,y:X+16,theme:t,onClick:p},R.id):ee?jsxRuntime.jsxs("g",{onClick:()=>p?.(R),onContextMenu:$=>{$.preventDefault(),$.stopPropagation(),m?.(R,$);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:U,y:X,width:E,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:U,y1:X,x2:U+E,y2:X,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U,y1:X,x2:U,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U+E,y1:X,x2:U+E,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U,y1:X+32,x2:U+E,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),E>60&&jsxRuntime.jsx("text",{x:U+12,y:X+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:R.name})]},R.id):jsxRuntime.jsx(an,{task:R,x:U,y:X,width:E,theme:t,dayWidth:A*l,startDate:o,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:d,onDependencyCreate:i,allTaskPositions:Y,onDragMove:de,onHoverChange:T},R.id)}),S.map((R,F)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(U=>{let E=S.find(xe=>xe.id===U);if(!E||!E.startDate||!E.endDate)return null;let X=S.findIndex(xe=>xe.id===U),ee=H(E),$=H(R),Me=ee.x+ee.width,ve=X*a+a/2,qe=$.x,ge=F*a+a/2,et=qe-Me,Te=Me+et/2,ot=xe=>{let De=1-xe,Ee=De*De,Ve=Ee*De,Ct=xe*xe,q=Ct*xe,O=Ve*Me+3*Ee*xe*Te+3*De*Ct*Te+q*qe,we=Ve*ve+3*Ee*xe*ve+3*De*Ct*ge+q*ge;return {x:O,y:we}},gt=20,ft=[];for(let xe=0;xe<=gt;xe++){let De=.1+xe/gt*.8;ft.push(ot(De));}let tt=ft[0],B=`M ${tt.x} ${tt.y} `+ft.slice(1).map(xe=>`L ${xe.x} ${xe.y}`).join(" ");return f&&f.x1===Me&&f.y1===ve&&f.x2===qe&&f.y2===ge?null:jsxRuntime.jsx("path",{d:B,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{k({x1:Me,y1:ve,x2:qe,y2:ge,onDelete:()=>u?.(R.id,U)});}},`dep-hover-${U}-${R.id}`)})),b.map(R=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:R.previewX,y:R.y-48,width:R.width,height:32,rx:8,fill:R.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(R.daysDelta)>0&&jsxRuntime.jsx("text",{x:R.previewX+R.width/2,y:R.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:R.daysDelta>0?`+${R.daysDelta}d`:`${R.daysDelta}d`})]},`cascade-preview-${R.taskId}`)),f&&(()=>{let{x1:R,y1:F,x2:U,y2:E,onDelete:X}=f,ee=U-R,$=E-F,Me=R+ee/2,ve=(F+E)/2,qe=`M ${R} ${F} C ${Me} ${F}, ${Me} ${E}, ${U} ${E}`,ge=6,et=Math.atan2($,ee),Te=U-ge*Math.cos(et-Math.PI/6),ot=E-ge*Math.sin(et-Math.PI/6),gt=U-ge*Math.cos(et+Math.PI/6),ft=E-ge*Math.sin(et+Math.PI/6),tt=t.dependency,B="#f87171";return jsxRuntime.jsxs("g",{onMouseLeave:()=>k(null),children:[jsxRuntime.jsx("path",{d:qe,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:Me,cy:ve,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:qe,fill:"none",stroke:tt,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:qe,fill:"none",stroke:tt,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${U} ${E} L ${Te} ${ot} M ${U} ${E} L ${gt} ${ft}`,fill:"none",stroke:tt,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:U,cy:E,r:4,fill:tt,opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:xe=>{xe.stopPropagation(),k(null),X();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:Me,cy:ve,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:B,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsxRuntime.jsx("line",{x1:Me-3,y1:ve-3,x2:Me+3,y2:ve+3,stroke:B,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Me+3,y1:ve-3,x2:Me-3,y2:ve+3,stroke:B,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),x&&jsxRuntime.jsx(xd,{tooltipData:x,theme:t})]})]})}var pn=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];var Hs=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Gs=[{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 mn({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:l=false,mode:c=a?"edit":"create",theme:p="dark",customStatuses:n=[],availableTags:m=[],onCreateTag:d,attachments:i=[],onUploadAttachments:u,onDeleteAttachment:v}){let b=[...Hs,...n.filter(B=>!Hs.some(se=>se.id===B.id))],g=Ge[p]||Ge.dark,[x,h]=react.useState(false),[f,k]=react.useState(false),[T,N]=react.useState(false),[A,C]=react.useState(false),[W,D]=react.useState({top:0,left:0}),[y,M]=react.useState(null),[S,H]=react.useState(new Date),[Y,de]=react.useState({top:0,left:0}),[he,Ie]=react.useState(false),[Le,R]=react.useState([]),F=react.useRef(null),U=react.useRef(null),E=react.useRef(null),X=react.useRef(null),ee=react.useRef(null),[$,Me]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[ve,qe]=react.useState({});react.useEffect(()=>{a?(Me({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)&&Ie(true)):(Me({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Ie(false),R([]));},[a,e]),react.useEffect(()=>{let B=se=>{F.current&&!F.current.contains(se.target)&&h(false),U.current&&!U.current.contains(se.target)&&k(false),E.current&&!E.current.contains(se.target)&&N(false),X.current&&!X.current.contains(se.target)&&C(false);};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);let ge=()=>{let B={};return $.name.trim()||(B.name="El nombre es requerido"),$.startDate&&$.endDate&&$.startDate>$.endDate&&(B.endDate="La fecha de fin debe ser posterior a la de inicio"),qe(B),Object.keys(B).length===0},et=async B=>{if(B.preventDefault(),!!ge())try{let se=c==="create"&&Le.length>0?{...$,pendingFiles:Le}:$;await s(se),R([]),t();}catch(se){console.error("Error submitting task:",se);}},Te=(B,se)=>{Me(xe=>{let De={...xe,[B]:se};if(B==="status"){let Ee=se;Ee==="todo"?De.progress=0:Ee==="in-progress"?(xe.progress===0||xe.progress===100)&&(De.progress=50):Ee==="completed"||Ee==="closed"?De.progress=100:(Ee==="in-review"||Ee==="review")&&(De.progress=75);}if(B==="progress"){let Ee=typeof se=="number"?se:parseInt(se,10);Ee===100&&xe.status!=="completed"?De.status="completed":Ee>0&&Ee<100&&xe.status==="todo"?De.status="in-progress":Ee===0&&xe.status!=="todo"&&(De.status="todo");}return De}),ve[B]&&qe(xe=>{let De={...xe};return delete De[B],De});},ot=b.find(B=>B.id===$.status)??Hs[0],gt=Gs.find(B=>B.id===$.priority)??Gs[1],ft=pn.find(B=>B.value===$.color)??pn[0],tt={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",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:B=>B.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:ot.color||g.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:B=>{B.currentTarget.style.backgroundColor=g.hoverBg,B.currentTarget.style.color=g.textPrimary;},onMouseLeave:B=>{B.currentTarget.style.backgroundColor="transparent",B.currentTarget.style.color=g.textTertiary;},disabled:l,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:$.name,onChange:B=>Te("name",B.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:l,autoFocus:true}),ve.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"}),ve.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:$.description||"",onChange:B=>Te("description",B.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:l})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:F,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&h(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...tt,borderColor:ot.color,backgroundColor:`${ot.color}15`},disabled:l,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:ot.color}}),jsxRuntime.jsx("span",{style:{color:ot.color},children:ot.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:ot.color}})]}),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-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:b.map(B=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:se=>se.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("status",B.id),h(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:B.color}}),B.title,$.status===B.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},B.id))})})]}),jsxRuntime.jsxs("div",{ref:U,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&k(!f),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:tt,disabled:l,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:gt.color}}),jsxRuntime.jsx("span",{children:gt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:Gs.map(B=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:se=>se.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("priority",B.id),k(false);},children:[jsxRuntime.jsx("span",{children:B.icon}),B.label,$.priority===B.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},B.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:E,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&N(!T),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:tt,disabled:l,children:[$.assignees&&$.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:$.assignees.slice(0,3).map((B,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:B.color||g.accent,borderColor:g.bgSecondary},children:B.initials},se))}),$.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:g.textTertiary},children:["+",$.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(B=>{let se=$.assignees?.some(xe=>xe.name===B.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:xe=>xe.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:xe=>xe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let xe=se?($.assignees||[]).filter(De=>De.name!==B.name):[...$.assignees||[],{name:B.name,avatar:B.avatar,initials:B.name.split(" ").map(De=>De[0]).join("").toUpperCase().slice(0,2),color:g.accent}];Te("assignees",xe);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:g.accent},children:B.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:B.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:se&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},B.id)})})})]}),jsxRuntime.jsxs("div",{ref:X,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!l)if(A)C(false);else {if(X.current){let B=X.current.getBoundingClientRect(),se=window.innerHeight,xe=120,Ee=se-B.bottom<xe?B.top-xe-8:B.bottom+8;D({top:Ee,left:B.left});}C(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:tt,disabled:l,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:$.color}}),jsxRuntime.jsx("span",{children:ft.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:A&&jsxRuntime.jsxs(at,{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:`${W.top}px`,left:`${W.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:B=>B.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"14px 18px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 16px)",gap:"14px"},children:pn.slice(0,18).map(B=>{let se=$.color===B.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>{Te("color",B.value),C(false);},style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:B.value,outline:se?`2px solid ${B.value}`:"none",outlineOffset:"3px",cursor:"pointer",border:"none"},whileHover:{scale:1.2},whileTap:{scale:.95},title:B.name},B.value)})})})})]})})]}),m.length>0||d?jsxRuntime.jsx(Or,{selectedTags:$.tags||[],availableTags:m,onChange:B=>Te("tags",B),onCreateTag:d,theme:g,disabled:l}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{ref:ee,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!l&&!$.isMilestone)if(y==="start")M(null);else {if(ee.current){let B=ee.current.getBoundingClientRect(),se=window.innerHeight,xe=320,Ee=se-B.bottom<xe?B.top-xe-8:B.bottom+8;de({top:Ee,left:B.left});}M("start"),H($.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...tt,opacity:$.isMilestone?.5:1,cursor:$.isMilestone?"not-allowed":"pointer"},disabled:l||$.isMilestone,children:$.startDate?$.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!l&&!$.isMilestone)if(y==="end")M(null);else {if(ee.current){let B=ee.current.getBoundingClientRect(),se=window.innerHeight,xe=320,Ee=se-B.bottom<xe?B.top-xe-8:B.bottom+8;de({top:Ee,left:B.left});}M("end"),H($.endDate||$.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...tt,opacity:$.isMilestone?.5:1,cursor:$.isMilestone?"not-allowed":"pointer"},disabled:l||$.isMilestone,children:$.endDate?$.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsxs(at,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>M(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:`${Y.top}px`,left:`${Y.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let B=new Date,se=new Date(B);se.setDate(B.getDate()+1);let xe=new Date(B);xe.setDate(B.getDate()+7);let De=new Date(B);return De.setDate(B.getDate()+14),[{label:"Hoy",date:B},{label:"Ma\xF1ana",date:se},{label:"Pr\xF3xima semana",date:xe},{label:"2 semanas",date:De}].map((Ve,Ct)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{y==="start"?(Te("startDate",Ve.date),(!$.endDate||Ve.date>$.endDate)&&Te("endDate",Ve.date),M("end")):(Te("endDate",Ve.date),(!$.startDate||Ve.date<$.startDate)&&Te("startDate",Ve.date),M(null));},children:Ve.label},Ct))})(),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:B=>B.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("startDate",void 0),Te("endDate",void 0),M(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:()=>H(new Date(S.getFullYear(),S.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:S.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>H(new Date(S.getFullYear(),S.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((B,se)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:B},se))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let B=S.getFullYear(),se=S.getMonth(),xe=new Date(B,se,1).getDay(),De=new Date(B,se+1,0).getDate(),Ee=new Date,Ve=[];for(let q=xe-1;q>=0;q--)Ve.push({day:new Date(B,se,-q).getDate(),date:new Date(B,se-1,new Date(B,se,-q).getDate()),isCurrentMonth:false});for(let q=1;q<=De;q++)Ve.push({day:q,date:new Date(B,se,q),isCurrentMonth:true});let Ct=42-Ve.length;for(let q=1;q<=Ct;q++)Ve.push({day:q,date:new Date(B,se+1,q),isCurrentMonth:false});return Ve.map((q,O)=>{let we=q.date.toDateString()===Ee.toDateString(),We=$.startDate?.toDateString()===q.date.toDateString(),Ue=$.endDate?.toDateString()===q.date.toDateString(),ht=$.startDate&&$.endDate&&q.date>=$.startDate&&q.date<=$.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:q.isCurrentMonth?We||Ue?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:We?"#3B82F6":Ue?"#7C3AED":ht?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:we&&!We&&!Ue?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{y==="start"?(Te("startDate",q.date),$.endDate&&q.date>$.endDate&&Te("endDate",q.date),M("end")):(Te("endDate",q.date),$.startDate&&q.date<$.startDate&&Te("startDate",q.date),M(null));},children:q.day},O)})})()})]})]})]})})]}),ve.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:ve.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:$.progress,onChange:B=>Te("progress",parseInt(B.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:$.progress<30?"#EF4444":$.progress<70?"#F59E0B":"#10B981"},disabled:l}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${$.progress<30?"#EF4444":$.progress<70?"#F59E0B":"#10B981"}20`,color:$.progress<30?"#EF4444":$.progress<70?"#F59E0B":"#10B981"},children:[$.progress,"%"]})]})]}),(u||i.length>0||c==="create")&&jsxRuntime.jsxs("div",{className:"pt-2",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 ",c==="create"?Le.length>0&&`(${Le.length})`:i.length>0&&`(${i.length})`]})]}),c==="create"?jsxRuntime.jsx($a,{cardId:"pending",attachments:Le.map((B,se)=>({id:`pending-${se}`,cardId:"pending",name:B.name,size:B.size,type:B.type,url:URL.createObjectURL(B),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:B=>R(se=>[...se,...B]),onDelete:B=>{let se=parseInt(B.replace("pending-",""),10);R(xe=>xe.filter((De,Ee)=>Ee!==se));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx($a,{cardId:a?.id||"new",attachments:i,onUpload:u&&a?.id?B=>u(a.id,B):void 0,onDelete:v,maxSizeMB:10,maxFiles:20}),c==="create"&&Le.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[Le.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ie(!he),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 ${he?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:he&&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:[jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:$.isMilestone,onChange:B=>Te("isMilestone",B.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:l}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:g.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:g.bgSecondary},children:r.filter(B=>B.id!==a?.id).map(B=>{let se=$.dependencies?.includes(B.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let xe=se?($.dependencies||[]).filter(De=>De!==B.id):[...$.dependencies||[],B.id];Te("dependencies",xe);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:se?`${g.accent}30`:g.bgPrimary,color:se?g.accent:g.textSecondary,border:`1px solid ${se?g.accent:g.borderLight}`},disabled:l,children:B.name},B.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:B=>B.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",disabled:l,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:l,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:B=>!l&&(B.currentTarget.style.opacity="0.9"),onMouseLeave:B=>!l&&(B.currentTarget.style.opacity="1"),children:l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var of=['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"'],Dd=()=>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"})]}),nf=()=>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"})}),sf=()=>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"})}),lf=()=>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"})}),df=()=>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 un({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:l,onDependencyCreate:c,onDependencyDelete:p}){let[n,m]=react.useState(false),[d,i]=react.useState(false),[u,v]=react.useState([]),[b,g]=react.useState(""),[x,h]=react.useState(false),[f,k]=react.useState(true),T=react.useRef(null),N=react.useRef(null),A=react.useRef(null),{enabled:C=true,placeholder:W='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:D="bottom-right",onCommand:y,suggestions:M=of,maxHistory:S=50,persistHistory:H}=a,Y=H?.storageKey||"gantt-ai-history",de=H?.maxMessages??5;react.useEffect(()=>{if(H?.enabled)try{let U=localStorage.getItem(Y);if(U){let X=JSON.parse(U).map(ee=>({...ee,timestamp:new Date(ee.timestamp)}));v(X.slice(-de));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[H?.enabled,Y,de]),react.useEffect(()=>{if(H?.enabled&&u.length>0)try{let U=u.filter(E=>!E.isLoading).slice(-de);localStorage.setItem(Y,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[u,H?.enabled,Y,de]),react.useEffect(()=>{N.current&&N.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!d&&T.current&&setTimeout(()=>T.current?.focus(),100);},[n,d]);let he=react.useCallback(U=>{if(U.success)switch(U.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":U.taskId&&U.updates&&o?.(U.taskId,U.updates);break;case "create_task":U.newTask&&s?.(U.newTask);break;case "delete_task":U.taskId&&l?.(U.taskId);break;case "link_tasks":U.dependencyFrom&&U.dependencyTo&&c?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&p?.(U.taskId,U.dependencyFrom);break}},[o,s,l,c,p]),Ie=react.useCallback(async U=>{if(!U.trim()||x)return;let E={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};v(ee=>[...ee.slice(-(S-1)),E]),g(""),k(false),h(true);let X={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(ee=>[...ee,X]);try{if(y){let ee=await y(U,e);v($=>{let Me=$.filter(qe=>!qe.isLoading),ve={id:`assistant-${Date.now()}`,role:"assistant",content:ee.message,timestamp:new Date,command:ee};return [...Me,ve]}),he(ee);}else v(ee=>[...ee.filter(Me=>!Me.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(ee){v($=>[...$.filter(ve=>!ve.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${ee instanceof Error?ee.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[x,S,y,e,he]),Le=U=>{U.preventDefault(),Ie(b);},R=U=>{g(U),T.current?.focus();};if(react.useEffect(()=>{let U=E=>{(E.metaKey||E.ctrlKey)&&E.key==="k"&&(E.preventDefault(),m(X=>!X),n||i(false)),E.key==="Escape"&&n&&m(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[n]),react.useEffect(()=>{if(!n)return;let U=X=>{let ee=X.target;A.current&&!A.current.contains(ee)&&m(false);},E=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(E),document.removeEventListener("mousedown",U);}},[n]),!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(at,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${F[D]} 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:()=>m(true),children:[jsxRuntime.jsx(Dd,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:A,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${F[D]} 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(Dd,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>i(U=>!U),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(lf,{})}),jsxRuntime.jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(sf,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[u.length===0&&f&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:M.slice(0,4).map((U,E)=>jsxRuntime.jsx("button",{onClick:()=>R(U),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:U.length>30?U.slice(0,30)+"...":U},E))})]}),u.map(U=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${U.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${U.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:U.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:U.role==="user"?"white":t.textPrimary},children:[U.isLoading?jsxRuntime.jsx(df,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:U.content}),U.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:U.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:U.command.success?"#10B981":"#EF4444"},children:[U.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsxRuntime.jsx("div",{ref:N})]}),jsxRuntime.jsxs("form",{onSubmit:Le,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:T,type:"text",value:b,onChange:U=>g(U.target.value),placeholder:W,disabled:x,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!b.trim()||x,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:b.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:b.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(nf,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Nd(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,m=true)=>{r(d=>{let i=typeof n=="function"?n(d.present):n;if(o.current)return {...d,present:i};if(!m)return {...d,present:i};let u=[...d.past,d.present];return u.length>t&&u.shift(),{past:u,present:i,future:[]}});},[t]),l=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let m=n.past[n.past.length-1],d=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[n.present,...n.future]}});},[]),c=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let m=n.future[0],d=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:m,future:d}});},[]),p=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:l,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function Sd({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=l=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=c?l.metaKey:l.ctrlKey;if(p&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!c&&p&&l.key==="y"){l.preventDefault(),t();return}if(c&&p&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var uf={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ne.formatDate(e.startDate)} - ${ne.formatDate(e.endDate)}`);let a=ne.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=>ne.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Ed(e){return {...uf,...e}}var xf=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Ad=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:l="week",rowDensity:c="comfortable",showThemeSelector:p=true,showExportButton:n=true,availableUsers:m=[],templates:d,enableAutoCriticalPath:i=true,aiAssistant:u,locale:v="en",customTranslations:b,showCreateTaskButton:g=false,createTaskLabel:x,onCreateTask:h,onThemeChange:f,onTaskClick:k,onTaskDblClick:T,onTaskContextMenu:N,onTaskUpdate:A,onProgressChange:C,onTaskEdit:W,onTaskAddSubtask:D,onTaskMarkIncomplete:y,onTaskSetInProgress:M,onDependencyCreate:S,onDependencyDelete:H,onBeforeTaskAdd:Y,onAfterTaskAdd:de,onBeforeTaskUpdate:he,onAfterTaskUpdate:Ie,onBeforeTaskDelete:Le,onAfterTaskDelete:R}=a,U=react.useContext(qo)?.theme,[E,X]=react.useState(U||s||"dark"),[ee,$]=react.useState(l),[Me,ve]=react.useState(c),[qe,ge]=react.useState(1),[et,Te]=react.useState(0),[ot,gt]=react.useState(false),[ft,tt]=react.useState(null),[B,se]=react.useState({isOpen:false,x:0,y:0,task:null}),[xe,De]=react.useState(null),[Ee,Ve]=react.useState(null);react.useEffect(()=>{U&&U!==E&&X(U);},[U]),react.useEffect(()=>{s&&s!==E&&X(s);},[s]);let Ct=react.useCallback(P=>{X(P),f?.(P);},[f]),{state:q,setState:O,undo:we,redo:We,canUndo:Ue,canRedo:ht,clearHistory:Z}=Nd(t,50),te=react.useRef(new Map);react.useEffect(()=>{let P=I=>I.map(K=>{let ae=te.current.get(K.id),le=ae!==void 0?{...K,isExpanded:ae}:K;return le.subtasks?.length?{...le,subtasks:P(le.subtasks)}:le});te.current.size>0?O(P(t)):O(t);},[t,O]);let ke=react.useRef(t),Pe=react.useRef(true);react.useEffect(()=>{if(Pe.current){Pe.current=false,ke.current=q;return}if(!r)return;let P=JSON.stringify(ke.current),I=JSON.stringify(q);P!==I&&(ke.current=q,r(q));},[q,r]);let J=react.useMemo(()=>Ns(v,b),[v,b]),Ae=react.useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:P.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:P.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:P.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:P.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:P.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:P.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:P.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[ye,Ne]=react.useState(()=>Ae(J));react.useEffect(()=>{Ne(P=>P.map(I=>({...I,label:J.columns[I.id==="name"?"taskName":I.id]||I.label})));},[J]);let ce=react.useMemo(()=>{let P=ye.filter(ae=>ae.visible),I=P.some(ae=>ae.id!=="name");return P.reduce((ae,le)=>ae+le.width,0)+(I?20:0)},[ye]);react.useEffect(()=>{ft!==null&&ft>ce&&(ye.filter(K=>K.visible).some(K=>K.id!=="name")||tt(null));},[ye,ce,ft]);let Re=react.useMemo(()=>ft!==null?Math.max(280,ft,ce):Math.max(280,ce),[ft,ce]),Fe=react.useRef(null),Oe=react.useRef(null),_=react.useRef(null),j=react.useMemo(()=>jl(E),[E]),st=react.useMemo(()=>({theme:j,themeName:E}),[j,E]),He=react.useMemo(()=>Ed(d),[d]),fe=react.useMemo(()=>{if(!i)return q;let P=ne.calculateCriticalPath(q),I=K=>K.map(ae=>({...ae,isCriticalPath:P.includes(ae.id),subtasks:ae.subtasks?I(ae.subtasks):void 0}));return I(q)},[q,i]),Vt=xf(Me);Sd({undo:we,redo:We,canUndo:Ue,canRedo:ht,enabled:true}),react.useImperativeHandle(o,()=>({getTask:P=>ne.findTaskById(q,P),addTask:(P,I)=>{O(K=>{if(!I)return [...K,{...P,level:0}];let ae=le=>le.map(Se=>Se.id===I?{...Se,subtasks:[...Se.subtasks||[],{...P,parentId:I,level:(Se.level||0)+1}],isExpanded:true}:Se.subtasks?{...Se,subtasks:ae(Se.subtasks)}:Se);return ae(K)});},updateTask:(P,I)=>{O(K=>{let ae=le=>le.map(Se=>Se.id===P?{...Se,...I}:Se.subtasks?{...Se,subtasks:ae(Se.subtasks)}:Se);return ae(K)});},deleteTask:P=>{O(I=>{let K=ae=>ae.filter(le=>le.id===P?false:(le.subtasks&&(le.subtasks=K(le.subtasks)),true));return K(I)});},deleteTasks:P=>{O(I=>Ls(I,P));},duplicateTask:P=>{O(I=>Fs(I,[P]));},splitTask:(P,I,K=3)=>{O(ae=>ne.splitTask(ae,P,I,K));},calculateEndDate:ne.calculateEndDate,calculateDuration:ne.calculateDuration,validateDependency:(P,I)=>!ne.validateDependencies(q,P,I),getAllTasks:()=>ne.flattenTasks(q),getTasksByStatus:P=>ne.flattenTasks(q).filter(I=>I.status===P),getTasksByParent:P=>P?ne.findTaskById(q,P)?.subtasks||[]:q.filter(K=>!K.parentId),getCriticalPath:()=>ne.flattenTasks(q).filter(P=>P.isCriticalPath),indentTask:P=>{O(I=>Ms(I,[P]));},outdentTask:P=>{O(I=>As(I,[P]));},moveTask:(P,I)=>{O(K=>Is(K,[P],I));},createSubtask:async P=>{let{tasks:I,newTask:K}=Os(q,P);if(Y){let ae=Y({...K,parentId:P});if((ae instanceof Promise?await ae:ae)===false)return}O(I),de&&de({...K,parentId:P});},scrollToTask:P=>{let K=ne.flattenTasks(q).findIndex(ae=>ae.id===P);if(K!==-1&&Fe.current){let ae=K*Vt;Fe.current.scrollTo({top:ae,behavior:"smooth"}),Oe.current&&Oe.current.scrollTo({top:ae,behavior:"smooth"});}},highlightTask:(P,I=2e3)=>{},expandTask:P=>{O(I=>{let K=ae=>ae.map(le=>le.id===P?{...le,isExpanded:true}:le.subtasks?{...le,subtasks:K(le.subtasks)}:le);return K(I)});},collapseTask:P=>{O(I=>{let K=ae=>ae.map(le=>le.id===P?{...le,isExpanded:false}:le.subtasks?{...le,subtasks:K(le.subtasks)}:le);return K(I)});},expandAll:()=>{O(P=>{let I=K=>K.map(ae=>({...ae,isExpanded:true,subtasks:ae.subtasks?I(ae.subtasks):void 0}));return I(P)});},collapseAll:()=>{O(P=>{let I=K=>K.map(ae=>({...ae,isExpanded:false,subtasks:ae.subtasks?I(ae.subtasks):void 0}));return I(P)});},undo:we,redo:We,canUndo:()=>Ue,canRedo:()=>ht,clearHistory:Z,exportToPNG:async()=>{if(!_.current)throw new Error("Gantt container not found");let P=await Md__default.default(_.current,{backgroundColor:j.bgPrimary,scale:2});return new Promise((I,K)=>{P.toBlob(ae=>{ae?I(ae):K(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async P=>{await ne.exportToPDF(q,P);},exportToExcel:async P=>{await ne.exportToExcel(q,P);},exportToJSON:()=>ne.exportToJSON(q),exportToCSV:()=>ne.exportToCSV(q),importFromJSON:P=>{let I=ne.importFromJSON(P);O(I);},getTasks:()=>q,refresh:()=>{O(P=>[...P]);},clearAll:()=>{O([]);}}),[q,we,We,Ue,ht,Z,j,Vt]);let Tt=react.useCallback(P=>{Ne(I=>I.map(K=>K.id===P?{...K,visible:!K.visible}:K));},[]),z=react.useCallback((P,I)=>{Ne(K=>K.map(ae=>{if(ae.id!==P)return ae;let le=ae.minWidth??100,Se=ae.maxWidth??800,Bt=Math.max(le,Math.min(Se,I));return {...ae,width:Bt}}));},[]),pe=react.useCallback(P=>{O(I=>{let K=Rs(I,P),ae=le=>{for(let Se of le){if(Se.id===P){te.current.set(P,Se.isExpanded??true);return}Se.subtasks?.length&&ae(Se.subtasks);}};return ae(K),K}),a.onTaskToggleExpand?.(P);},[a]),Ce=react.useCallback((P,I)=>{if(he&&he(P,I)===false)return;let ae=ne.findTaskById(q,P)?.progress,le=Bt=>Bt.map(Ht=>Ht.id===P?{...Ht,...I}:Ht.subtasks?{...Ht,subtasks:le(Ht.subtasks)}:Ht);O(le(q));let Se=ne.findTaskById(le(q),P);Se&&(A?.(Se),Ie?.(Se),I.progress!==void 0&&ae!==void 0&&I.progress!==ae&&C?.(P,ae,I.progress));},[q,A,he,Ie,C]),$t=react.useCallback(P=>{P.length!==0&&(O(I=>Ms(I,P)),a.onTaskIndent?.(P[0]));},[a]),ea=react.useCallback(P=>{P.length!==0&&(O(I=>As(I,P)),a.onTaskOutdent?.(P[0]));},[a]),qa=react.useCallback((P,I,K)=>{O(ae=>md(ae,P,I,K)),a.onTaskReparent?.(P,I,K);},[a]),Jr=react.useCallback((P,I)=>{P.length!==0&&(O(K=>Is(K,P,I)),a.onTaskMove?.(P[0],I));},[a]),ie=react.useCallback(async P=>{let I=[];for(let K of P)Le&&await Promise.resolve(Le(K))===false||I.push(K);I.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(I):(O(K=>Ls(K,I)),I.forEach(K=>a.onTaskDelete?.(K))),R&&I.forEach(K=>R(K)));},[a,Le,R]),Dt=react.useCallback(P=>{O(I=>Fs(I,P)),P.forEach(I=>a.onTaskDuplicate?.(I));},[a]),Jt=react.useCallback((P,I)=>{O(K=>{let{tasks:ae,newTask:le}=pd(K,P,I);return Y&&Y(le)===false?K:(a.onTaskCreate?.(le.parentId,le.position||0),de?.(le),ae)});},[a,Y,de]),Sr=react.useCallback((P,I)=>{O(K=>Bs(K,P,I)),a.onTaskRename?.(P,I);},[a]),Er=react.useCallback(P=>{O(I=>{let{tasks:K}=Os(I,P);return a.onTaskCreate?.(P,0),K});},[a]),Pr=react.useCallback((P,I,K)=>{let ae=P.startDate?Math.round((I.getTime()-P.startDate.getTime())/864e5):0,le=Ht=>Ht.map(Zt=>Zt.id===P.id?{...Zt,startDate:I,endDate:K,...P.segments&&{segments:P.segments}}:Zt.subtasks?{...Zt,subtasks:le(Zt.subtasks)}:Zt),Se=le(q);Se=ne.autoScheduleDependents(Se,P.id,ae),O(Se);let Bt={...P,startDate:I,endDate:K};A?.(Bt);},[q,A]),Wa=react.useCallback((P,I)=>{N?.(P,I),se({isOpen:true,x:I.clientX,y:I.clientY,task:P});},[N]),ir=react.useCallback((P,I)=>{let K=ne.splitTask(q,P.id,I);O(K),se({isOpen:false,x:0,y:0,task:null});},[q]),Et=react.useCallback(P=>{let I=ne.findTaskById(q,P.id)||P;T?.(I),W||De(I);},[q,T,W]),Eo=react.useCallback((P,I,K)=>{let ae=new Map,le=Na=>{Na.forEach(Ha=>{Ha.dependencies&&ae.set(Ha.id,Ha.dependencies),Ha.subtasks&&le(Ha.subtasks);});};le(K);let Se=ae.get(I)||[];ae.set(I,[...Se,P]);let Bt=new Set,Ht=new Set,Zt=Na=>{if(!Bt.has(Na)){Bt.add(Na),Ht.add(Na);let Ha=ae.get(Na)||[];for(let lr of Ha){if(!Bt.has(lr)&&Zt(lr))return true;if(Ht.has(lr))return true}}return Ht.delete(Na),false};return Zt(I)},[]),Po=react.useCallback((P,I)=>{if(Eo(P.id,I,q)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
277
277
 
278
- Task dependencies must flow in one direction only.`);return}let K=ae=>ae.map(le=>{if(le.id===I){let Se=le.dependencies||[];if(!Se.includes(P.id))return {...le,dependencies:[...Se,P.id]}}return le.subtasks?{...le,subtasks:K(le.subtasks)}:le});O(K(q)),S?.(P.id,I);},[q,S,So]),Ln=react.useCallback((P,I)=>{let K=ae=>ae.map(le=>{if(le.id===P&&le.dependencies){let Se=le.dependencies.filter(Bt=>Bt!==I);return {...le,dependencies:Se}}return le.subtasks?{...le,subtasks:K(le.subtasks)}:le});O(K(q)),H?.(P,I);},[q,H]),{startDate:Jr,endDate:jc}=react.useMemo(()=>{let P=q.filter(Se=>Se.startDate&&Se.endDate);if(P.length===0){let Se=new Date,Bt=new Date(Se);Bt.setDate(Bt.getDate()-30);let Ht=new Date(Se);return Ht.setDate(Ht.getDate()+60),{startDate:Bt,endDate:Ht}}let I=P.flatMap(Se=>[Se.startDate,Se.endDate]).filter(Se=>Se!==void 0),K=new Date(Math.min(...I.map(Se=>Se.getTime()))),ae=new Date(Math.max(...I.map(Se=>Se.getTime()))),le=ee==="day"?7:ee==="week"?14:30;return K.setDate(K.getDate()-le),ae.setDate(ae.getDate()+le),{startDate:K,endDate:ae}},[q,ee]),Kc=react.useCallback(async()=>{if(!_.current)return;let P=await Ad__default.default(_.current,{backgroundColor:j.bgPrimary,scale:2}),I=document.createElement("a");I.download="gantt-chart.png",I.href=P.toDataURL("image/png"),I.click();},[j]),Yc=react.useCallback(async()=>{await ne.exportToPDF(q);},[q]),qc=react.useCallback(async()=>{await ne.exportToExcel(q);},[q]),Xc=react.useCallback(()=>{let P=ne.exportToCSV(q),I=new Blob([P],{type:"text/csv;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(I),K.download="gantt-chart.csv",K.click(),URL.revokeObjectURL(K.href);},[q]),Jc=react.useCallback(()=>{let P=ne.exportToJSON(q),I=new Blob([P],{type:"application/json;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(I),K.download="gantt-chart.json",K.click(),URL.revokeObjectURL(K.href);},[q]),Zc=react.useCallback(()=>{ne.exportToMSProject(q,"Gantt Project","project.xml");},[q]),Qc=P=>{P.preventDefault(),gt(true);};return react.useEffect(()=>{let P=Oe.current,I=Fe.current;if(!P||!I)return;let K=I.querySelector(".gantt-taskgrid-content"),ae=()=>{let Zt=P.scrollTop;Te(Zt),K&&(K.style.transform=`translateY(-${Zt}px)`);},le=Zt=>{if(ot&&I){let Ha=I.parentElement?.getBoundingClientRect()?.left||0,lr=Zt.clientX-Ha,ep=280,tp=Math.min(window.innerWidth-300,800);lr>=ep&&lr<=tp&&tt(lr);}},Se=()=>{gt(false);},Bt=I.querySelector(".gantt-grid-scroll")||I,Ht=Zt=>{let Na=Zt;Na.deltaY!==0&&(P.scrollTop+=Na.deltaY,Zt.preventDefault());};return P.addEventListener("scroll",ae),Bt.addEventListener("wheel",Ht,{passive:false}),document.addEventListener("mousemove",le),document.addEventListener("mouseup",Se),()=>{P.removeEventListener("scroll",ae),Bt.removeEventListener("wheel",Ht),document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",Se);}},[ot]),jsxRuntime.jsx(Wr.Provider,{value:J,children:jsxRuntime.jsx(zn.Provider,{value:st,children:jsxRuntime.jsxs("div",{ref:_,className:"flex flex-col h-full w-full",style:{backgroundColor:j.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Jo,{theme:j,timeScale:ee,onTimeScaleChange:z,zoom:Xe,onZoomChange:ge,currentTheme:E,onThemeChange:Ct,rowDensity:Me,onRowDensityChange:ve,showThemeSelector:p,showCreateTaskButton:g,createTaskLabel:x,onCreateTask:h,onExportPNG:n?Kc:void 0,onExportPDF:n?Yc:void 0,onExportExcel:n?qc:void 0,onExportCSV:n?Xc:void 0,onExportJSON:n?Jc:void 0,onExportMSProject:n?Zc:void 0}),jsxRuntime.jsxs("div",{ref:Fe,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:Re,overflow:"hidden"},children:jsxRuntime.jsx(tn,{tasks:fe,theme:j,rowHeight:Vt,availableUsers:m,templates:He,onTaskClick:k,onTaskDblClick:Et,onTaskContextMenu:N,onTaskToggle:pe,scrollTop:et,columns:ye,onToggleColumn:Tt,onColumnResize:$,onTaskUpdate:Ce,onTaskIndent:zt,onTaskOutdent:ea,onTaskMove:Xr,onMultiTaskDelete:ie,onTaskDuplicate:Dt,onTaskCreate:Jt,onTaskRename:Sr,onCreateSubtask:Er,onOpenTaskModal:k?P=>k(P):void 0,onDeleteRequest:(P,I)=>Ve({taskId:P,taskName:I}),onTaskReparent:qa})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:Qc}),jsxRuntime.jsx("div",{ref:Oe,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(cn,{tasks:fe,theme:j,rowHeight:Vt,timeScale:ee,startDate:Jr,endDate:jc,zoom:Xe,templates:He,onTaskClick:k,onTaskDblClick:Et,onTaskContextMenu:Wa,onTaskDateChange:Pr,onDependencyCreate:Eo,onDependencyDelete:Ln})})]}),B.task&&jsxRuntime.jsx(Hr,{isOpen:B.isOpen,x:B.x,y:B.y,theme:j,onClose:()=>se({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=B.task;if(!P)return [];let I=ne.findTaskById(q,P.id)||P;return I.subtasks&&I.subtasks.length>0?[{id:"addSubtask",label:J.contextMenu?.addSubtask||"Add Subtask",icon:kt.Add,onClick:()=>{D?D(I):Er(I.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:J.contextMenu?.deleteTask||"Delete Task",icon:kt.Delete,onClick:()=>{Ve({taskId:I.id,taskName:I.name});}}]:[{id:"edit",label:J.contextMenu?.editTask||"Edit Task",icon:kt.Pencil,onClick:()=>{W?W(I):De(I);}},{id:"addSubtask",label:J.contextMenu?.addSubtask||"Add Subtask",icon:kt.Add,onClick:()=>{D?D(I):Er(I.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:J.contextMenu?.markIncomplete||"Mark Incomplete",icon:kt.MarkIncomplete,onClick:()=>{y?y(I):Ce(I.id,{status:"todo",progress:0});},disabled:I.status==="todo"},{id:"setInProgress",label:J.contextMenu?.setInProgress||"Set In Progress",icon:kt.SetInProgress,onClick:()=>{M?M(I):Ce(I.id,{status:"in-progress"});},disabled:I.status==="in-progress"},{id:"markComplete",label:J.contextMenu?.markComplete||"Mark Complete",icon:kt.MarkComplete,onClick:()=>{Ce(I.id,{status:"completed",progress:100});},disabled:I.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:J.contextMenu?.splitTask||"Split Task",icon:kt.Split,onClick:()=>{if(!I.startDate||!I.endDate){console.warn("Cannot split task without dates");return}let ae=I.startDate.getTime(),le=I.endDate.getTime(),Se=ae+(le-ae)/2,Bt=new Date(Se);ir(I,Bt);},disabled:!I.startDate||!I.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:J.contextMenu?.deleteTask||"Delete Task",icon:kt.Delete,onClick:()=>{Ve({taskId:I.id,taskName:I.name});}}]})()}),xe&&jsxRuntime.jsx(mn,{isOpen:true,onClose:()=>De(null),task:xe,onSubmit:P=>{Ce(xe.id,P),De(null);},mode:"edit",theme:E}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ee&&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:()=>Ve(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:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:j.bgSecondary,border:`1px solid ${j.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${j.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:j.textPrimary,fontFamily:"Inter, sans-serif"},children:[J.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:j.textSecondary,fontFamily:"Inter, sans-serif"},children:v==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:j.textSecondary,fontFamily:"Inter, sans-serif"},children:[v==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:j.textPrimary},children:['"',Ee.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:j.bgPrimary,borderTop:`1px solid ${j.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Ve(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:j.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=j.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:v==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{ie([Ee.taskId]),Ve(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:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),v==="es"?"Eliminar":"Delete"]})]})]})})}),u?.enabled&&jsxRuntime.jsx(un,{tasks:q,theme:j,config:u,onTasksUpdate:O,onTaskUpdate:Ce,onTaskCreate:P=>{O(I=>[...I,P]);},onTaskDelete:P=>{ie([P]);},onDependencyCreate:(P,I)=>{let K=ne.findTaskById(q,P);K&&Eo(K,I);},onDependencyDelete:Ln})]})})})});var Ld=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
278
+ Task dependencies must flow in one direction only.`);return}let K=ae=>ae.map(le=>{if(le.id===I){let Se=le.dependencies||[];if(!Se.includes(P.id))return {...le,dependencies:[...Se,P.id]}}return le.subtasks?{...le,subtasks:K(le.subtasks)}:le});O(K(q)),S?.(P.id,I);},[q,S,Eo]),Ln=react.useCallback((P,I)=>{let K=ae=>ae.map(le=>{if(le.id===P&&le.dependencies){let Se=le.dependencies.filter(Bt=>Bt!==I);return {...le,dependencies:Se}}return le.subtasks?{...le,subtasks:K(le.subtasks)}:le});O(K(q)),H?.(P,I);},[q,H]),{startDate:Zr,endDate:Vc}=react.useMemo(()=>{let P=q.filter(Se=>Se.startDate&&Se.endDate);if(P.length===0){let Se=new Date,Bt=new Date(Se);Bt.setDate(Bt.getDate()-30);let Ht=new Date(Se);return Ht.setDate(Ht.getDate()+60),{startDate:Bt,endDate:Ht}}let I=P.flatMap(Se=>[Se.startDate,Se.endDate]).filter(Se=>Se!==void 0),K=new Date(Math.min(...I.map(Se=>Se.getTime()))),ae=new Date(Math.max(...I.map(Se=>Se.getTime()))),le=ee==="day"?7:ee==="week"?14:30;return K.setDate(K.getDate()-le),ae.setDate(ae.getDate()+le),{startDate:K,endDate:ae}},[q,ee]),jc=react.useCallback(async()=>{if(!_.current)return;let P=await Md__default.default(_.current,{backgroundColor:j.bgPrimary,scale:2}),I=document.createElement("a");I.download="gantt-chart.png",I.href=P.toDataURL("image/png"),I.click();},[j]),Kc=react.useCallback(async()=>{await ne.exportToPDF(q);},[q]),Yc=react.useCallback(async()=>{await ne.exportToExcel(q);},[q]),qc=react.useCallback(()=>{let P=ne.exportToCSV(q),I=new Blob([P],{type:"text/csv;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(I),K.download="gantt-chart.csv",K.click(),URL.revokeObjectURL(K.href);},[q]),Xc=react.useCallback(()=>{let P=ne.exportToJSON(q),I=new Blob([P],{type:"application/json;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(I),K.download="gantt-chart.json",K.click(),URL.revokeObjectURL(K.href);},[q]),Jc=react.useCallback(()=>{ne.exportToMSProject(q,"Gantt Project","project.xml");},[q]),Zc=P=>{P.preventDefault(),gt(true);};return react.useEffect(()=>{let P=Oe.current,I=Fe.current;if(!P||!I)return;let K=I.querySelector(".gantt-taskgrid-content"),ae=()=>{let Zt=P.scrollTop;Te(Zt),K&&(K.style.transform=`translateY(-${Zt}px)`);},le=Zt=>{if(ot&&I){let Ha=I.parentElement?.getBoundingClientRect()?.left||0,lr=Zt.clientX-Ha,Qc=280,ep=Math.min(window.innerWidth-300,800);lr>=Qc&&lr<=ep&&tt(lr);}},Se=()=>{gt(false);},Bt=I.querySelector(".gantt-grid-scroll")||I,Ht=Zt=>{let Na=Zt;Na.deltaY!==0&&(P.scrollTop+=Na.deltaY,Zt.preventDefault());};return P.addEventListener("scroll",ae),Bt.addEventListener("wheel",Ht,{passive:false}),document.addEventListener("mousemove",le),document.addEventListener("mouseup",Se),()=>{P.removeEventListener("scroll",ae),Bt.removeEventListener("wheel",Ht),document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",Se);}},[ot]),jsxRuntime.jsx(Hr.Provider,{value:J,children:jsxRuntime.jsx($n.Provider,{value:st,children:jsxRuntime.jsxs("div",{ref:_,className:"flex flex-col h-full w-full",style:{backgroundColor:j.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Jo,{theme:j,timeScale:ee,onTimeScaleChange:$,zoom:qe,onZoomChange:ge,currentTheme:E,onThemeChange:Ct,rowDensity:Me,onRowDensityChange:ve,showThemeSelector:p,showCreateTaskButton:g,createTaskLabel:x,onCreateTask:h,onExportPNG:n?jc:void 0,onExportPDF:n?Kc:void 0,onExportExcel:n?Yc:void 0,onExportCSV:n?qc:void 0,onExportJSON:n?Xc:void 0,onExportMSProject:n?Jc:void 0}),jsxRuntime.jsxs("div",{ref:Fe,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:Re,overflow:"hidden"},children:jsxRuntime.jsx(tn,{tasks:fe,theme:j,rowHeight:Vt,availableUsers:m,templates:He,onTaskClick:k,onTaskDblClick:Et,onTaskContextMenu:N,onTaskToggle:pe,scrollTop:et,columns:ye,onToggleColumn:Tt,onColumnResize:z,onTaskUpdate:Ce,onTaskIndent:$t,onTaskOutdent:ea,onTaskMove:Jr,onMultiTaskDelete:ie,onTaskDuplicate:Dt,onTaskCreate:Jt,onTaskRename:Sr,onCreateSubtask:Er,onOpenTaskModal:k?P=>k(P):void 0,onDeleteRequest:(P,I)=>Ve({taskId:P,taskName:I}),onTaskReparent:qa})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:Zc}),jsxRuntime.jsx("div",{ref:Oe,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(cn,{tasks:fe,theme:j,rowHeight:Vt,timeScale:ee,startDate:Zr,endDate:Vc,zoom:qe,templates:He,onTaskClick:k,onTaskDblClick:Et,onTaskContextMenu:Wa,onTaskDateChange:Pr,onDependencyCreate:Po,onDependencyDelete:Ln})})]}),B.task&&jsxRuntime.jsx(Gr,{isOpen:B.isOpen,x:B.x,y:B.y,theme:j,onClose:()=>se({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=B.task;if(!P)return [];let I=ne.findTaskById(q,P.id)||P;return I.subtasks&&I.subtasks.length>0?[{id:"addSubtask",label:J.contextMenu?.addSubtask||"Add Subtask",icon:kt.Add,onClick:()=>{D?D(I):Er(I.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:J.contextMenu?.deleteTask||"Delete Task",icon:kt.Delete,onClick:()=>{Ve({taskId:I.id,taskName:I.name});}}]:[{id:"edit",label:J.contextMenu?.editTask||"Edit Task",icon:kt.Pencil,onClick:()=>{W?W(I):De(I);}},{id:"addSubtask",label:J.contextMenu?.addSubtask||"Add Subtask",icon:kt.Add,onClick:()=>{D?D(I):Er(I.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:J.contextMenu?.markIncomplete||"Mark Incomplete",icon:kt.MarkIncomplete,onClick:()=>{y?y(I):Ce(I.id,{status:"todo",progress:0});},disabled:I.status==="todo"},{id:"setInProgress",label:J.contextMenu?.setInProgress||"Set In Progress",icon:kt.SetInProgress,onClick:()=>{M?M(I):Ce(I.id,{status:"in-progress"});},disabled:I.status==="in-progress"},{id:"markComplete",label:J.contextMenu?.markComplete||"Mark Complete",icon:kt.MarkComplete,onClick:()=>{Ce(I.id,{status:"completed",progress:100});},disabled:I.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:J.contextMenu?.splitTask||"Split Task",icon:kt.Split,onClick:()=>{if(!I.startDate||!I.endDate){console.warn("Cannot split task without dates");return}let ae=I.startDate.getTime(),le=I.endDate.getTime(),Se=ae+(le-ae)/2,Bt=new Date(Se);ir(I,Bt);},disabled:!I.startDate||!I.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:J.contextMenu?.deleteTask||"Delete Task",icon:kt.Delete,onClick:()=>{Ve({taskId:I.id,taskName:I.name});}}]})()}),xe&&jsxRuntime.jsx(mn,{isOpen:true,onClose:()=>De(null),task:xe,onSubmit:P=>{Ce(xe.id,P),De(null);},mode:"edit",theme:E}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ee&&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:()=>Ve(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:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:j.bgSecondary,border:`1px solid ${j.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${j.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:j.textPrimary,fontFamily:"Inter, sans-serif"},children:[J.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:j.textSecondary,fontFamily:"Inter, sans-serif"},children:v==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:j.textSecondary,fontFamily:"Inter, sans-serif"},children:[v==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:j.textPrimary},children:['"',Ee.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:j.bgPrimary,borderTop:`1px solid ${j.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Ve(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:j.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=j.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:v==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{ie([Ee.taskId]),Ve(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:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),v==="es"?"Eliminar":"Delete"]})]})]})})}),u?.enabled&&jsxRuntime.jsx(un,{tasks:q,theme:j,config:u,onTasksUpdate:O,onTaskUpdate:Ce,onTaskCreate:P=>{O(I=>[...I,P]);},onTaskDelete:P=>{ie([P]);},onDependencyCreate:(P,I)=>{let K=ne.findTaskById(q,P);K&&Po(K,I);},onDependencyDelete:Ln})]})})})});var Id=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
279
279
 
280
280
  AVAILABLE COMMANDS:
281
281
  1. move_task - Move a task to a different date
@@ -316,19 +316,19 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
316
316
 
317
317
  Always try to match task names case-insensitively and handle partial matches.
318
318
  If you can't find a task by name, search through the provided task list.
319
- If ambiguous, ask for clarification in the message field.`;function Fd(e){return `CURRENT TASKS:
320
- ${Bd(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",l=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${l}`}).join(`
319
+ If ambiguous, ask for clarification in the message field.`;function Ld(e){return `CURRENT TASKS:
320
+ ${Fd(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",l=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${l}`}).join(`
321
321
  `)}
322
322
 
323
- Today's date: ${new Date().toISOString().split("T")[0]}`}function Bd(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Ka(e,t){let a=Bd(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let s=a.find(c=>c.name.toLowerCase().includes(r));if(s)return s;let l=r.split(/\s+/);return a.find(c=>{let p=c.name.toLowerCase();return l.every(n=>p.includes(n))})}function js(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let i=new Date(r);return i.setDate(i.getDate()+1),i}if(a==="yesterday"||a==="ayer"){let i=new Date(r);return i.setDate(i.getDate()-1),i}if(a==="next week"||a==="la pr\xF3xima semana"){let i=new Date(r);return i.setDate(i.getDate()+7),i}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let u={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(u!==void 0){let v=new Date(r),b=v.getDay(),g=u-b;return g<=0&&(g+=7),v.setDate(v.getDate()+g),v}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let i=parseInt(s[1],10),u=s[2].toLowerCase(),v=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?v.setDate(v.getDate()+i):u==="week"||u==="semana"||u==="semanas"?v.setDate(v.getDate()+i*7):(u==="month"||u==="mes"||u==="meses")&&v.setMonth(v.getMonth()+i),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let i=parseInt(c[1],10),u=parseInt(c[2],10)-1,v=parseInt(c[3],10);return new Date(v,u,i)}let p={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},n=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(n&&n[1]&&n[2]){let i=parseInt(n[1],10),u=p[n[2].toLowerCase()],v=n[3]?parseInt(n[3],10):r.getFullYear();if(u!==void 0)return new Date(v,u,i)}let m={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let i=m[d[1].toLowerCase()],u=parseInt(d[2],10),v=d[3]?parseInt(d[3],10):r.getFullYear();if(i!==void 0)return new Date(v,i,u)}return null}function Ks(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 Ys(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 Rd(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 Od(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let n=r[1].trim(),m=r[2].trim(),d=Ka(t,n),i=js(m);if(!d)return {type:"move_task",taskName:n,message:`Could not find a task named "${n}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!i)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(i);return v.setDate(v.getDate()+u),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:i,endDate:v},message:`Moved "${d.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let n=o[1].trim(),m=o[2].trim(),d=Ka(t,n),i=Ks(m);if(!d)return {type:"resize_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"};if(!i||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let u=new Date(d.endDate);return u.setDate(u.getDate()+i),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:u},message:`Extended "${d.name}" by ${i} days. New end date: ${u.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let n=s[1].trim(),m=s[2].trim(),d=Ka(t,n),i=Ys(m);return d?i===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:i},message:`Set "${d.name}" progress to ${i}%.`,success:true}:{type:"set_progress",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let l=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let n=l[1].trim(),m=l[2].trim(),d=Ka(t,n);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:m},message:`Renamed "${d.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let n=c[1].trim(),m=c[2].trim(),d=Ka(t,n),i=Ka(t,m);return d?i?{type:"link_tasks",taskId:i.id,taskName:i.name,dependencyFrom:d.id,dependencyTo:i.id,message:`Linked "${d.name}" \u2192 "${i.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Source task not found"}}let p=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]){let n=p[1].trim(),m=Ka(t,n);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}return null}function zd(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 xf(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 kf(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function fn(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let d=a.find(i=>i.id===m);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>fn(m,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let l=m=>{if(m)return typeof m=="string"?new Date(m):m},c=l(e.startDate),p=l(e.endDate),n=e.metadata?.isMilestone===true||c&&p&&Math.abs(p.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:p,progress:e.progress||0,status:xf(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:n,isCriticalPath:e.metadata?.isCriticalPath===true}}function $d(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:kf(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Ud(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>fn(r,e,t))}var qs={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"}},Xs={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"}},hn={en:qs,es:Xs};function Js(e){return hn[e]||hn.en}function bn(e,t){let a=Js(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}function _d(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(..._d(r.subtasks,t+1));return a}function If({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 Vd({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:l}){let{theme:c="dark",locale:p="en",customTranslations:n,showSearch:m=true,showHierarchy:d=true}=t,i=bn(p,n),u=c==="dark",[v,b]=react.useState(new Set),[g,x]=react.useState("startDate"),[h,f]=react.useState("asc"),[k,T]=react.useState("");react.useMemo(()=>{let D=new Set;function y(M){for(let S of M)S.subtasks?.length&&(D.add(S.id),y(S.subtasks));}y(e),b(D);},[e]);let N=react.useCallback(D=>{b(y=>{let M=new Set(y);return M.has(D)?M.delete(D):M.add(D),M}),a.onTaskToggleExpand?.(D);},[a]),A=react.useCallback(D=>{g===D?f(y=>y==="asc"?"desc":"asc"):(x(D),f("asc")),a.onSortChange?.({column:D,direction:h==="asc"?"desc":"asc"});},[g,h,a]),C=react.useMemo(()=>{let D=_d(e);if(k.trim()){let M=k.toLowerCase();D=D.filter(S=>S.name.toLowerCase().includes(M));}let y=[];for(let M of D){let S=M.level===0;M.level>0&&(S=true),(S||k.trim())&&y.push(M);}return k.trim()&&y.sort((M,S)=>{let H,Y;switch(g){case "name":H=M.name.toLowerCase(),Y=S.name.toLowerCase();break;case "startDate":H=M.startDate?.getTime()||0,Y=S.startDate?.getTime()||0;break;case "endDate":H=M.endDate?.getTime()||0,Y=S.endDate?.getTime()||0;break;case "progress":H=M.progress||0,Y=S.progress||0;break;case "status":H=M.status||"todo",Y=S.status||"todo";break;default:return 0}return H<Y?h==="asc"?-1:1:H>Y?h==="asc"?1:-1:0}),y},[e,k,g,h]),W=D=>D?(D instanceof Date?D:new Date(D)).toLocaleDateString(p==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:w("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:w("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsxRuntime.jsx("p",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:w("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",s),style:l,children:[jsxRuntime.jsx("div",{className:w("flex-shrink-0 px-6 py-4 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[m&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:w("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:k,onChange:D=>T(D.target.value),placeholder:i.toolbar.searchPlaceholder,className:w("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",u?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsxs("div",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[C.length," ",i.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:w("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",u?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>A("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C.map((D,y)=>{let M=v.has(D.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:w("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",u?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+D.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(D),onDoubleClick:()=>a.onTaskDoubleClick?.(D),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&D.hasChildren&&jsxRuntime.jsx("button",{onClick:S=>{S.stopPropagation(),N(D.id);},className:w("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:M?jsxRuntime.jsx(lucideReact.ChevronDown,{className:w("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:w("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),d&&!D.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:S=>{S.stopPropagation(),a.onTaskUpdate?.({...D,progress:D.progress===100?0:100,status:D.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(If,{status:D.status,progress:D.progress})}),jsxRuntime.jsx("span",{className:w("truncate",u?"text-white":"text-gray-900",D.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:D.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:w("px-2 py-1 rounded-full text-xs font-medium",D.progress===100||D.status==="completed"?"bg-green-500/10 text-green-500":D.progress&&D.progress>0||D.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:D.progress===100||D.status==="completed"?i.status.completed:D.progress&&D.progress>0||D.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxRuntime.jsxs("div",{className:w("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),W(D.startDate)]}),jsxRuntime.jsxs("div",{className:w("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),W(D.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:w("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:w("h-full rounded-full transition-all",D.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${D.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:w("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[D.progress||0,"%"]})]})})]},D.id)})}),C.length===0&&k&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:w("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:w(u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var Zs={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"},Qs={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"},ei={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"},vn={dark:Zs,light:Qs,neutral:ei};function jd(e){return vn[e]||vn.dark}var ti={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"}},ai={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"}},xn={en:ti,es:ai};function vo(e){return xn[e]||xn.en}function kn(e,t){let a=vo(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 Kd(e){let t=vo(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 Yd(e,t=0,a=true){let r=vo(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 Vf(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 ii(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 Jd({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 Qd({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:l,style:c}){let{theme:p="dark",locale:n="en",customTranslations:m}=t,d=kn(n,m),i=p==="dark",[u,v]=react.useState(r||new Date),[b,g]=react.useState(null),[x,h]=react.useState(null),[f,k]=react.useState(null),[T,N]=react.useState(new Date),[A,C]=react.useState({}),W=4,D=3,[y,M]=react.useState(false),[S,H]=react.useState(false),[Y,de]=react.useState(false),[he,Ie]=react.useState(null),[Le,R]=react.useState(""),[F,U]=react.useState(void 0),[E,X]=react.useState(null),[ee,z]=react.useState(false),[Me,ve]=react.useState(false),[Xe,ge]=react.useState(null),[et,Te]=react.useState(false),[ot,gt]=react.useState(new Date),ft=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),tt=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),B=react.useCallback(()=>{v(new Date);},[]),se=react.useMemo(()=>{let O=u.getFullYear(),we=u.getMonth(),We=new Date(O,we,1),Ue=new Date(O,we+1,0),ht=We.getDay(),Z=Ue.getDate(),te=Vf(e),ke=new Date;ke.setHours(0,0,0,0);let Pe=[],J=ht,Ae=new Date(O,we,0).getDate();for(let Ne=J-1;Ne>=0;Ne--){let ce=new Date(O,we-1,Ae-Ne);Pe.push({date:ce,isCurrentMonth:false,isToday:false,isWeekend:ce.getDay()===0||ce.getDay()===6,events:te.filter(Re=>ii(ce,Re)).map(Re=>({id:Re.id,title:Re.name,start:Re.startDate,end:Re.endDate,task:Re}))});}for(let Ne=1;Ne<=Z;Ne++){let ce=new Date(O,we,Ne),Re=ce.getTime()===ke.getTime();Pe.push({date:ce,isCurrentMonth:true,isToday:Re,isWeekend:ce.getDay()===0||ce.getDay()===6,events:te.filter(Fe=>ii(ce,Fe)).map(Fe=>({id:Fe.id,title:Fe.name,start:Fe.startDate,end:Fe.endDate,task:Fe}))});}let ye=42-Pe.length;for(let Ne=1;Ne<=ye;Ne++){let ce=new Date(O,we+1,Ne);Pe.push({date:ce,isCurrentMonth:false,isToday:false,isWeekend:ce.getDay()===0||ce.getDay()===6,events:te.filter(Re=>ii(ce,Re)).map(Re=>({id:Re.id,title:Re.name,start:Re.startDate,end:Re.endDate,task:Re}))});}return Pe},[u,e]),xe=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],De=u.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Ee=react.useCallback((O,we)=>{if(!b)return;let We={...b,[O]:we};g(We),a.onTaskUpdate?.(We);},[b,a]),Ve=react.useCallback(O=>{if(!b)return;let we=b.progress||0;O==="completed"?we=100:O==="todo"&&(we=0);let We={...b,status:O,progress:we};g(We),a.onTaskUpdate?.(We),M(false);},[b,a]),Ct=react.useCallback((O,we)=>{if(!b)return;let We={...b,startDate:O,endDate:we};g(We),a.onTaskUpdate?.(We);},[b,a]),q=react.useCallback(()=>{M(false),H(false),k(null);},[]);return o?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[d.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:w("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:w("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:d.labels.noEvents}),jsxRuntime.jsx("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:d.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:w("flex-1 flex flex-col w-full h-full overflow-auto",i?"bg-[#0F1117]":"bg-white",l),style:c,children:[jsxRuntime.jsx("div",{className:w("flex-shrink-0 px-6 py-4 border-b",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:w("text-xl font-semibold capitalize",i?"text-white":"text-gray-900"),children:De}),jsxRuntime.jsx("button",{onClick:B,className:w("px-3 py-1.5 text-sm rounded-lg transition-colors",i?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:d.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:ft,className:w("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:w("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:tt,className:w("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:w("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:xe.map(O=>jsxRuntime.jsx("div",{className:w("py-2 text-center text-xs font-medium uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:O},O))}),jsxRuntime.jsx("div",{className:w("grid grid-cols-7 auto-rows-min gap-px rounded-lg",i?"bg-[#2D2D2D]":"bg-gray-300"),children:se.map((O,we)=>{let We=O.date.getDay()===0||O.date.getDay()===6;return jsxRuntime.jsxs("div",{className:w("min-h-[120px] p-2 transition-colors flex flex-col relative group",i?We?"bg-[#1C1F26]":O.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":We?"bg-gray-100":O.isCurrentMonth?"bg-white":"bg-gray-50",O.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ue=A[we]||W,ht=O.events.slice(0,Ue),Z=O.events.length-Ue;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[ht.map(te=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{g(te.task),a.onEventClick?.(te);},whileHover:{scale:1.02},className:w("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",te.task.progress===100?i?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":i?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Jd,{task:te.task}),jsxRuntime.jsx("span",{className:"truncate",children:te.title})]})},te.id)),Z>0&&jsxRuntime.jsxs("button",{onClick:te=>{te.stopPropagation(),C(ke=>({...ke,[we]:Ue+D}));},className:w("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",Z," ",n==="es"?"M\xC1S":"MORE"]}),Ue>W&&O.events.length>W&&jsxRuntime.jsx("button",{onClick:te=>{te.stopPropagation(),C(ke=>({...ke,[we]:W}));},className:w("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ue=we>=28,ht=we%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Z=>{Z.stopPropagation(),he===we?Ie(null):(Ie(we),R(""),U(void 0),X(null),ge(null),z(false),ve(false),Te(false),gt(O.date));},className:w("w-5 h-5 rounded flex items-center justify-center transition-all",he===we?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",i?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:w("w-3.5 h-3.5 transition-transform",he===we&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:he===we&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ie(null),R(""),U(void 0),X(null),ge(null),z(false),ve(false),Te(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Ue?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ue?-5:5,scale:.95},transition:{duration:.12},className:w("absolute w-[320px] rounded-lg shadow-2xl z-50",Ue?"bottom-full mb-1":"top-full mt-1",ht?"right-0":"left-0",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>{Z.stopPropagation(),z(false),ve(false),Te(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Le,onChange:Z=>R(Z.target.value),placeholder:n==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:w("w-full bg-transparent text-sm outline-none placeholder:opacity-40",i?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:Z=>{if(Z.key==="Enter"&&Le.trim()){let te=t.availableUsers?.find(Pe=>Pe.id===E),ke=Xe||O.date;a.onTaskCreate?.({name:Le.trim(),startDate:ke,endDate:ke,priority:F,assignees:te?[te]:void 0}),R(""),U(void 0),X(null),ge(null),Ie(null);}Z.key==="Escape"&&(Ie(null),R(""),U(void 0),X(null),ge(null));}})}),jsxRuntime.jsxs("div",{className:w("px-2.5 py-2 flex items-center justify-between border-t",i?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Z=>{Z.stopPropagation(),z(!ee),ve(false);},className:w("p-1 rounded transition-colors",F?F==="urgent"||F==="high"?"text-red-400 bg-red-500/20":F==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ee&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(Z=>jsxRuntime.jsxs("button",{onClick:()=>{U(Z.id),z(false);},className:w("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",F===Z.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:w("w-2 h-2 rounded-full",Z.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:Z.label})]},Z.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:Z=>{Z.stopPropagation(),Te(!et),z(false),ve(false),gt(Xe||O.date);},className:w("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Xe?"bg-[#7C3AED]/20 text-[#7C3AED]":i?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(Xe||O.date).toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:et&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[jsxRuntime.jsx("div",{className:w("w-40 py-2 border-r",i?"border-white/10":"border-gray-200"),children:(()=>{let Z=new Date,te=new Date(Z);te.setDate(Z.getDate()+1);let ke=new Date(Z);ke.setDate(Z.getDate()+((6-Z.getDay()+7)%7||7));let Pe=new Date(Z);Pe.setDate(Z.getDate()+((1-Z.getDay()+7)%7||7));let J=new Date(Z);J.setDate(Z.getDate()+14);let Ae=new Date(Z);return Ae.setDate(Z.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:Z,display:Z.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:te,display:te.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:ke,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Pe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"2 semanas":"2 weeks",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ae,display:Ae.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ne,ce)=>jsxRuntime.jsxs("button",{className:w("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{ge(Ne.date),Te(false);},children:[jsxRuntime.jsx("span",{children:Ne.label}),jsxRuntime.jsx("span",{className:w("text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:Ne.display})]},ce))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:w("text-xs font-medium",i?"text-white":"text-gray-900"),children:ot.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>gt(new Date),className:w("px-1.5 py-0.5 rounded text-[10px] transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>gt(new Date(ot.getFullYear(),ot.getMonth()-1)),className:w("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>gt(new Date(ot.getFullYear(),ot.getMonth()+1)),className:w("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(Z=>jsxRuntime.jsx("div",{className:w("w-6 h-6 flex items-center justify-center text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:Z},Z))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Z=ot.getFullYear(),te=ot.getMonth(),ke=new Date(Z,te,1).getDay(),Pe=new Date(Z,te+1,0).getDate(),J=new Date(Z,te,0).getDate(),Ae=new Date,ye=[];for(let ce=ke-1;ce>=0;ce--)ye.push({dayNum:J-ce,isCurrentMonth:false,date:new Date(Z,te-1,J-ce)});for(let ce=1;ce<=Pe;ce++)ye.push({dayNum:ce,isCurrentMonth:true,date:new Date(Z,te,ce)});let Ne=42-ye.length;for(let ce=1;ce<=Ne;ce++)ye.push({dayNum:ce,isCurrentMonth:false,date:new Date(Z,te+1,ce)});return ye.map((ce,Re)=>{let Fe=ce.date.toDateString()===Ae.toDateString(),Oe=(Xe||O.date).toDateString()===ce.date.toDateString();return jsxRuntime.jsx("button",{className:w("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!ce.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),ce.isCurrentMonth&&(i?"text-white":"text-gray-900"),Fe&&"ring-1 ring-[#3B82F6]",Oe&&"bg-[#7C3AED] text-white",!Oe&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{ge(ce.date),Te(false);},children:ce.dayNum},Re)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Z=>{Z.stopPropagation(),ve(!Me),z(false);},className:w("p-1 rounded transition-colors",E?"text-[#7C3AED] bg-[#7C3AED]/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:E?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(Z=>Z.id===E)?.color||"#7C3AED"},children:t.availableUsers?.find(Z=>Z.id===E)?.initials||t.availableUsers?.find(Z=>Z.id===E)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Me&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{X(null),ve(false);},className:w("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",!E&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:w("w-5 h-5 rounded-full flex items-center justify-center",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:i?"text-[#9CA3AF]":"text-gray-500",children:n==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(Z=>jsxRuntime.jsxs("button",{onClick:()=>{X(Z.id),ve(false);},className:w("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",E===Z.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:Z.color||"#7C3AED"},children:Z.initials||Z.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:Z.name})]},Z.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:w("px-3 py-2 text-xs",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Le.trim()){let Z=t.availableUsers?.find(ke=>ke.id===E),te=Xe||O.date;a.onTaskCreate?.({name:Le.trim(),startDate:te,endDate:te,priority:F,assignees:Z?[Z]:void 0}),R(""),U(void 0),X(null),ge(null),Ie(null);}},disabled:!Le.trim(),className:w("px-2.5 py-1 rounded text-xs font-medium transition-colors",Le.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":i?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:n==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:w("text-sm font-medium",O.isToday?"text-[#3B82F6]":O.isCurrentMonth?i?"text-white":"text-gray-900":i?"text-[#6B7280]":"text-gray-400"),children:O.date.getDate()})]})]},we)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>g(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:w("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:w("px-6 py-3 border-b flex items-center gap-3",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:w("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:w("text-xs px-2 py-0.5 rounded",i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:w("text-xs font-mono",i?"text-[#6B7280]":"text-gray-400"),children:b.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:w("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",i?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:w("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:w("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>g(null),className:w("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let O=b.progress===100?0:100,We={...b,progress:O,status:O===100?"completed":"todo"};g(We),a.onTaskUpdate?.(We);},className:w("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",b.progress===100?"bg-green-500 border-green-500":i?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:b.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:w("text-xl font-semibold flex-1",b.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:b.name})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{q(),M(!y);},className:w("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",b.progress===100||b.status==="completed"?"bg-green-500/20 text-green-400":b.progress&&b.progress>0||b.status==="in-progress"?"bg-blue-500/20 text-blue-400":i?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:b.progress===100||b.status==="completed"?n==="es"?"COMPLETADO":"DONE":b.progress&&b.progress>0||b.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>M(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(O=>jsxRuntime.jsxs("button",{onClick:()=>Ve(O.id),className:w("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",(b.status===O.id||O.id==="completed"&&b.progress===100||O.id==="in-progress"&&b.progress&&b.progress>0&&b.progress<100||O.id==="todo"&&(!b.progress||b.progress===0)&&b.status!=="in-progress"&&b.status!=="completed")&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:w("w-2 h-2 rounded-full",O.id==="completed"?"bg-green-500":O.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),b.assignees&&b.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[b.assignees.slice(0,3).map((O,we)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:O.color||"#8B5CF6"},title:O.name,children:O.initials||O.name.slice(0,2).toUpperCase()},we)),b.assignees.length>3&&jsxRuntime.jsxs("span",{className:w("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:["+",b.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:w("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{k(f?null:"start"),N(b.startDate||new Date);},className:w("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[b.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:w("mx-1",i?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),b.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(b.startDate||b.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:O=>{O.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>k(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:w("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:w("w-44 py-2 border-r",i?"border-white/10":"border-gray-200"),children:[(()=>{let O=new Date,we=new Date(O);we.setDate(O.getDate()+1);let We=new Date(O);We.setDate(O.getDate()+((6-O.getDay()+7)%7||7));let Ue=new Date(O);Ue.setDate(O.getDate()+((1-O.getDay()+7)%7||7));let ht=new Date(O);ht.setDate(O.getDate()+(6-O.getDay()+7)%7+7);let Z=new Date(O);Z.setDate(O.getDate()+14);let te=new Date(O);return te.setDate(O.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:we,display:we.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:We,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ue,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ht,display:ht.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Z,display:Z.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:te,display:te.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Pe,J)=>jsxRuntime.jsxs("button",{className:w("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(f==="start"){let Ae=b.endDate&&Pe.date>b.endDate?Pe.date:b.endDate;Ct(Pe.date,Ae),k("end");}else {let Ae=b.startDate&&Pe.date<b.startDate?Pe.date:b.startDate;Ct(Ae,Pe.date),k(null);}},children:[jsxRuntime.jsx("span",{children:Pe.label}),jsxRuntime.jsx("span",{className:w("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:Pe.display})]},J))})(),jsxRuntime.jsx("div",{className:w("border-t mt-2 pt-2",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Ct(void 0,void 0),k(null);},className:w("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:w("text-xs mb-3 px-2 py-1 rounded",i?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f==="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:w("font-medium",i?"text-white":"text-gray-900"),children:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>N(new Date),className:w("p-1 rounded text-sm transition-colors",i?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>N(new Date(T.getFullYear(),T.getMonth()-1)),className:w("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>N(new Date(T.getFullYear(),T.getMonth()+1)),className:w("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(O=>jsxRuntime.jsx("div",{className:w("w-8 h-8 flex items-center justify-center text-xs",i?"text-[#6B7280]":"text-gray-400"),children:O},O))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=T.getFullYear(),we=T.getMonth(),We=new Date(O,we,1).getDay(),Ue=new Date(O,we+1,0).getDate(),ht=new Date(O,we,0).getDate(),Z=new Date,te=[];for(let Pe=We-1;Pe>=0;Pe--)te.push({day:ht-Pe,isCurrentMonth:false,date:new Date(O,we-1,ht-Pe)});for(let Pe=1;Pe<=Ue;Pe++)te.push({day:Pe,isCurrentMonth:true,date:new Date(O,we,Pe)});let ke=42-te.length;for(let Pe=1;Pe<=ke;Pe++)te.push({day:Pe,isCurrentMonth:false,date:new Date(O,we+1,Pe)});return te.map((Pe,J)=>{let Ae=Pe.date.toDateString()===Z.toDateString(),ye=b.startDate?.toDateString()===Pe.date.toDateString(),Ne=b.endDate?.toDateString()===Pe.date.toDateString(),ce=ye||Ne,Re=b.startDate&&b.endDate&&Pe.date>=b.startDate&&Pe.date<=b.endDate;return jsxRuntime.jsx("button",{className:w("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Pe.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),Pe.isCurrentMonth&&(i?"text-white":"text-gray-900"),Ae&&"ring-2 ring-[#3B82F6]",ye&&"bg-[#3B82F6] text-white",Ne&&!ye&&"bg-[#7C3AED] text-white",Re&&!ce&&(i?"bg-[#7C3AED]/20":"bg-purple-100"),!ce&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let Fe=new Date(Pe.date);if(f==="start"){let Oe=b.endDate&&Fe>b.endDate?Fe:b.endDate;Ct(Fe,Oe),k("end");}else {let Oe=b.startDate&&Fe<b.startDate?Fe:b.startDate;Ct(Oe,Fe),k(null);}},children:Pe.day},J)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{q(),H(!S);},className:w("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",b.priority==="high"||b.priority==="urgent"?"bg-red-500/20 text-red-400":b.priority==="medium"?"bg-yellow-500/20 text-yellow-400":b.priority==="low"?"bg-green-500/20 text-green-400":i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:b.priority?b.priority==="high"||b.priority==="urgent"?n==="es"?"Urgente":"Urgent":b.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:S&&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:w("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(O=>jsxRuntime.jsxs("button",{onClick:()=>{Ee("priority",O.id),H(false);},className:w("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",b.priority===O.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:w("w-2 h-2 rounded-full",O.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:w("text-sm",i?"text-white":"text-gray-900"),children:b.startDate&&b.endDate?`${Math.ceil((b.endDate.getTime()-b.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:w("w-4 h-4 rounded-full border-2",i?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Y?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:b.progress||0,onChange:O=>{let we=parseInt(O.target.value),We=b.status;we===100?We="completed":we>0?We="in-progress":We="todo";let Ue={...b,progress:we,status:We};g(Ue),a.onTaskUpdate?.(Ue);},onBlur:()=>de(false),className:w("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",i?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>de(true),className:w("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:w("h-full rounded-full transition-all",b.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${b.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:w("text-sm font-medium min-w-[40px]",i?"text-white":"text-gray-900"),children:[b.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:w("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Vac\xEDo":"Empty"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:w("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:b.dependencies&&b.dependencies.length>0?`${b.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:w("flex items-center gap-2 text-sm transition-colors",i?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),n==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:w("flex items-center gap-2 text-sm mt-2 transition-colors",i?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:w("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:w("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Agregar subtarea":"Add subtask"}),b.subtasks&&b.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:b.subtasks.map(O=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:w("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",O.progress===100?"bg-green-500 border-green-500":i?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:O.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:w("text-sm",O.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:O.name})]},O.id))}),jsxRuntime.jsxs("button",{className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:w("text-sm font-semibold",i?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:w("p-1 rounded transition-colors",i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:w("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:w("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",i?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:w("w-6 h-6 mx-auto mb-2",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Suelta tus archivos aqu\xED para ":"Drop your files here to ",jsxRuntime.jsx("span",{className:w("underline",i?"text-white":"text-gray-700"),children:n==="es"?"subir":"upload"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:w("w-[280px] border-l flex flex-col",i?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:w("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:w("font-medium",i?"text-white":"text-gray-900"),children:n==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:w("text-sm text-center py-8",i?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),n==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:w("p-3 border-t",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:w("flex items-center gap-2 px-3 py-2 rounded-lg",i?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",className:w("flex-1 bg-transparent text-sm outline-none",i?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>h(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:w("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:w("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:w("font-medium",i?"text-white":"text-gray-900"),children:x.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>h(null),className:w("p-1 rounded",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:x.events.map(O=>jsxRuntime.jsxs("button",{onClick:()=>{h(null),g(O.task);},className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",i?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Jd,{task:O.task}),jsxRuntime.jsx("span",{className:w("text-sm truncate flex-1",i?"text-white":"text-gray-900"),children:O.title}),O.task.priority==="high"||O.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},O.id))})]})]})})]})}var li={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"},di={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"},ci={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"},Dn={dark:li,light:di,neutral:ci};function ec(e){return Dn[e]||Dn.dark}function Kf({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:l,className:c}){let[p,n]=react.useState(false),m=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),d=react.useMemo(()=>{let u=m.length,v=new Set(m.flatMap(x=>x.assignedUserIds||[])).size,b=m.map(x=>x.priority).filter(Boolean),g=new Set(m.flatMap(x=>x.labels||[])).size;return {totalCards:u,uniqueAssignees:v,priorities:b,labels:g}},[m]),i=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:w("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:i,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:w("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),p&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:u=>{u.stopPropagation(),l?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:m.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:m.map(u=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(u),children:a(u)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(u),children:[jsxRuntime.jsx("h4",{children:u.title}),u.description&&jsxRuntime.jsxs("p",{children:[u.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,u.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},u.id))})})]})}var ac={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function xo(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 ko(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 rc(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 oc({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:l,className:c}){let p=react.useMemo(()=>({...ac,...l}),[l]),[n,m]=react.useState(new Set),d=react.useRef(null),i=react.useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(f=>{let k=f.timestamp.toISOString().split("T")[0],T=h.get(k);T?T.push(f):h.set(k,[f]);}),Array.from(h.entries()).sort((f,k)=>k[0].localeCompare(f[0])).map(([f,k])=>({date:new Date(f),events:k.sort((T,N)=>N.timestamp.getTime()-T.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:u,uniqueTypes:v}=react.useMemo(()=>{let h=new Set,f=new Set;return e.forEach(k=>{h.add(k.userId),f.add(k.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(f)}},[e]),b=h=>{m(f=>{let k=new Set(f);return k.has(h)?k.delete(h):k.add(h),k});},g=h=>{let k=new Date().getTime()-h.getTime(),T=Math.floor(k/6e4),N=Math.floor(k/36e5),A=Math.floor(k/864e5);return T<1?"just now":T<60?`${T}m ago`:N<24?`${N}h ago`:A<7?`${A}d ago`:h.toLocaleDateString()},x=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&&d.current){let h=d.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:w("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:w("history-timeline",p.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let f=h.target.value;a({...t,types:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),v.map(h=>jsxRuntime.jsxs("option",{value:h,children:[ko(h)," ",h.replace("_"," ")]},h))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let f=h.target.value;a({...t,users:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),u.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})})]}),x>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",x,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:i.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[p.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((f,k)=>{let T=n.has(f.id),N=s===f.id,A=rc(f.type);return jsxRuntime.jsxs("div",{"data-event-id":f.id,className:w("history-timeline-event",T&&"expanded",N&&"selected"),onClick:()=>o?.(f),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:A},children:p.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:ko(f.type)})}),k<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:A}})]}),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:[p.showAvatars&&f.userAvatar&&jsxRuntime.jsx("img",{src:f.userAvatar,alt:f.userName||f.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:f.userName||f.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:xo(f)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?g(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),b(f.id);},children:[T?"\u25BC":"\u25B6"," Show changes"]}),T&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([C,W])=>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(W.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(W.to)})]})]},C)),f.metadata&&Object.keys(f.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(f.metadata).map(([C,W])=>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(W)})]},C))]})]})]})]},f.id)})})]},h.date?.toISOString()||"all"))})]})}function sc({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:l,onGoToEvent:c,onSpeedChange:p,className:n}){let m=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),i=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:w("history-replay-empty",n),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:w("history-replay",n),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&ko(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&xo(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:u=>c(parseInt(u.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,v)=>jsxRuntime.jsx("div",{className:w("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>c(v),title:xo(u)},u.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:l,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:m.map(u=>jsxRuntime.jsxs("button",{className:w("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>p(u),children:[u,"x"]},u))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(u=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:u},u))})]})]})]})]}):jsxRuntime.jsxs("div",{className:w("history-replay-start",n),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function pi(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 mi(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 ic(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 lc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Qf(e,t,a,r,o,s=100){let l=e.map(p=>({...p,x:p.x??a/2+Math.random()*100-50,y:p.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(l.map(p=>[p.id,p]));for(let p=0;p<s;p++){let n=1-p/s;l.forEach(m=>{let d=a/2,i=r/2;m.vx+=(d-m.x)*o.centerForce*n,m.vy+=(i-m.y)*o.centerForce*n,l.forEach(u=>{if(m.id===u.id)return;let v=m.x-u.x,b=m.y-u.y,g=Math.sqrt(v*v+b*b)||1,x=o.chargeStrength*n/(g*g);m.vx+=v/g*x,m.vy+=b/g*x;});}),t.forEach(m=>{let d=c.get(typeof m.source=="string"?m.source:m.source.id),i=c.get(typeof m.target=="string"?m.target:m.target.id);if(!d||!i)return;let u=i.x-d.x,v=i.y-d.y,b=Math.sqrt(u*u+v*v)||1,g=(b-o.linkDistance)/b*o.forceStrength*n;d.vx+=u*g,d.vy+=v*g,i.vx-=u*g,i.vy-=v*g;}),l.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return l}function dc({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:l,onInteraction:c,className:p}){let n=react.useRef(null),[m,d]=react.useState([]),[i,u]=react.useState(null),[v,b]=react.useState(null),[g,x]=react.useState(null),[h,f]=react.useState(1),[k,T]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let S=Qf(e,t,a.width,a.height,a,150);d(S);},[e,t,a]);let N=react.useCallback((S,H)=>{a.enableDragging&&(H.stopPropagation(),u(S));},[a.enableDragging]),A=react.useCallback(S=>{if(!i||!n.current)return;let Y=n.current.getBoundingClientRect(),de=(S.clientX-Y.left-k.x)/h,he=(S.clientY-Y.top-k.y)/h;d(Ie=>Ie.map(Le=>Le.id===i?{...Le,x:de,y:he,fx:de,fy:he}:Le));},[i,h,k]),C=react.useCallback(()=>{u(null);},[]),W=react.useCallback((S,H)=>{H.stopPropagation(),c?.({type:"node-click",node:S,position:{x:H.clientX,y:H.clientY}});},[c]),D=react.useCallback((S,H)=>{H.stopPropagation(),c?.({type:"edge-click",edge:S,position:{x:H.clientX,y:H.clientY}});},[c]),y=react.useCallback(S=>{let H=m.find(Y=>Y.id===S);return H?{x:H.x,y:H.y}:{x:0,y:0}},[m]),M=react.useCallback(S=>{if(S.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return S.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let H=S.card.priority;return H==="URGENT"?"#ef4444":H==="HIGH"?"#f59e0b":H==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return S.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:w("relationships-graph-empty",p),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:w("relationships-graph",p),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:l.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:l.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(S=>Math.min(S+.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:()=>f(S=>Math.max(S-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),T({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(S=>S.type))).map(S=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:pi(S)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[ic(S)," ",mi(S)]})]},S))}),jsxRuntime.jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:A,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(S=>{let H=y(typeof S.source=="string"?S.source:S.source.id),Y=y(typeof S.target=="string"?S.target:S.target.id),de=lc(S.type),he=g===S.id,Ie=S.onCriticalPath;return jsxRuntime.jsxs("g",{className:w("relationships-graph-edge",he&&"hovered",Ie&&"critical"),onMouseEnter:()=>x(S.id),onMouseLeave:()=>x(null),onClick:Le=>D(S,Le),children:[jsxRuntime.jsx("line",{x1:H.x,y1:H.y,x2:Y.x,y2:Y.y,stroke:pi(S.type),strokeWidth:Ie?a.edgeWidth*2:a.edgeWidth,strokeOpacity:he?1:.6,markerEnd:de?"url(#arrowhead)":void 0}),a.showEdgeLabels&&he&&jsxRuntime.jsx("text",{x:(H.x+Y.x)/2,y:(H.y+Y.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:mi(S.type)})]},S.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(S=>{let H=v===S.id,Y=S.onCriticalPath;return jsxRuntime.jsxs("g",{className:w("relationships-graph-node",H&&"hovered",Y&&"critical"),transform:`translate(${S.x}, ${S.y})`,onMouseDown:de=>N(S.id,de),onMouseEnter:()=>b(S.id),onMouseLeave:()=>b(null),onClick:de=>W(S,de),children:[jsxRuntime.jsx("circle",{r:Y?a.nodeSize*1.2:a.nodeSize,fill:M(S),stroke:Y?"#fbbf24":"#ffffff",strokeWidth:Y?3:2,opacity:H?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:S.card.title.length>20?S.card.title.substring(0,20)+"...":S.card.title})]},S.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 mc({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,l]=react.useState(""),[c,p]=react.useState(false),[n,m]=react.useState(null),[d,i]=react.useState(null),u=react.useRef(null),v=c||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&!v&&b();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,v]);let b=()=>{v||(l(""),m(null),i(null),t());},g=async()=>{if(!(!s.trim()||v)){p(true),m(null),i(null);try{let h=await r(s.trim());i(h);}catch(h){m(h instanceof Error?h.message:"Failed to generate plan");}finally{p(false);}}},x=()=>{d&&(a(d),b());};return e?jsxRuntime.jsxs(at,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),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:b,disabled:v,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((h,f)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},f))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((h,f)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children: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})]})},f)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:u,value:s,onChange:h=>l(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:v}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),n&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:n}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,f)=>jsxRuntime.jsx("button",{onClick:()=>l(h),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},f))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:v&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:b,disabled:v,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:g,disabled:!s.trim()||v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var ui={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var th={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},ah={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 rh(e,t,a){let r=ui[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function wo(e){return `$${e.toFixed(4)}`}var gi=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=rh(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,i)=>d+i.cost,0),s=a.reduce((d,i)=>d+i.inputTokens,0),l=a.reduce((d,i)=>d+i.outputTokens,0),c=a.filter(d=>d.success),p=a.reduce((d,i)=>d+i.duration,0),n={},m={};return a.forEach(d=>{n[d.feature]=(n[d.feature]||0)+1,m[d.feature]=(m[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:l,operationsByFeature:n,costsByFeature:m,averageDuration:r>0?p/r:0,successRate:r>0?c.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,l=new Date;a==="month"?l.setMonth(s.getMonth()-1):l.setDate(s.getDate()-1);let c=this.operations.filter(m=>m.timestamp>=l).length,p=Math.max(0,o-c),n=c/o*100;return {used:c,limit:o,remaining:p,percentUsed:n,isExceeded:c>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Cr=new gi;function fc({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Cr.getStats()),[s,l]=react.useState(Cr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(Cr.getStats()),l(Cr.checkLimit(a));},1e3);return ()=>clearInterval(p)},[e,a]),react.useEffect(()=>{let p=n=>{n.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),!e)return null;let c=Cr.getRecentOperations(5);return jsxRuntime.jsxs(at,{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:p=>p.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:wo(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(([p,n])=>{let m=r.costsByFeature[p]||0,d=r.totalOperations>0?n/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:p.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[n," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:wo(m)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},p)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(p=>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:p.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(p.timestamp).toLocaleTimeString()," \u2022"," ",p.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[p.inputTokens+p.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:wo(p.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${p.success?"bg-green-400":"bg-red-400"}`})]})]},p.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 yc({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[l,c]=react.useState(""),[p,n]=react.useState(""),[m,d]=react.useState(""),[i,u]=react.useState(false),[v,b]=react.useState(null),[g,x]=react.useState(null),[h,f]=react.useState(null),k=react.useRef(null),T=i||o;react.useEffect(()=>{e&&k.current&&k.current.focus();},[e]),react.useEffect(()=>{let D=y=>{y.key==="Escape"&&!T&&N();};if(e)return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[e,T]);let N=()=>{T||(c(""),n(""),d(""),b(null),x(null),f(null),t());},A=async()=>{if(!(!l.trim()||T)){u(true),b(null),x(null),f(null);try{let D=await r({prompt:l.trim(),projectName:s||"Mi Proyecto",startDate:p||void 0,endDate:m||void 0});x(D.tasks.tasks),f({from_cache:D.from_cache,tokens_used:D.tokens_used,mock_mode:D.mock_mode,similarity:D.similarity,tokens_saved:D.tokens_saved});}catch(D){b(D instanceof Error?D.message:"Failed to generate tasks");}finally{u(false);}}},C=()=>{g&&(a(g),N());};if(!e)return null;let W=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(at,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:N}),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:D=>D.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:N,disabled:T,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:g?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[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 (",W,"% 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((D,y)=>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:["#",y+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:D.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"})]}),D.start," \u2192 ",D.end]}),jsxRuntime.jsxs("span",{children:[D.duration," days"]}),D.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",D.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${D.priority==="high"?"bg-red-500/20 text-red-400":D.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:D.priority})]})},D.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:l,onChange:D=>c(D.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:T}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:D=>n(D.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:T})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:D=>d(D.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:T})]})]}),v&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),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((D,y)=>jsxRuntime.jsx("button",{onClick:()=>c(D),disabled:T,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:D},y))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:T&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:N,disabled:T,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?jsxRuntime.jsx("button",{onClick: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:A,disabled:!l.trim()||T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:T?"Generating...":"Generate Tasks"})]})]})]})})]})}function En({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(g=>{t&&Io(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(x,h,f)=>{console.warn(`Retry attempt ${h} after ${f}ms: ${x.message}`);}}).then(x=>{x.success||console.error(`Failed to persist board after ${x.attempts} attempts:`,x.error);});},[t]),s=react.useCallback(async(g,x,h)=>{r(f=>{let k=f.cards.find(D=>D.id===g);if(!k)return f;let T=k.columnId,N={...k,columnId:x,position:h},A=f.cards.map(D=>D.id===g?N:D),C=f.columns.map(D=>{if(D.id===T)return {...D,cardIds:D.cardIds.filter(y=>y!==g)};if(D.id===x){let y=A.filter(M=>M.columnId===x).sort((M,S)=>M.position-S.position);return {...D,cardIds:y.map(M=>M.id)}}return D}),W={...f,cards:A,columns:C};return o(W),W});},[o]),l=react.useCallback(async(g,x)=>{r(h=>{let f=h.cards.map(T=>T.id===g?{...T,...x}:T),k={...h,cards:f};return o(k),k});},[o]),c=react.useCallback(async g=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let f={...g,id:x},k=h.columns.map(N=>N.id===g.columnId?{...N,cardIds:[...N.cardIds,x]}:N),T={...h,cards:[...h.cards,f],columns:k};return o(T),T});},[o]),p=react.useCallback(async g=>{r(x=>{let h=x.cards.find(N=>N.id===g);if(!h)return x;let f=x.cards.filter(N=>N.id!==g),k=x.columns.map(N=>N.id===h.columnId?{...N,cardIds:N.cardIds.filter(A=>A!==g)}:N),T={...x,cards:f,columns:k};return o(T),T});},[o]),n=react.useCallback(async g=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let f={...g,id:x,cardIds:[]},k={...h,columns:[...h.columns,f]};return o(k),k});},[o]),m=react.useCallback(async(g,x)=>{r(h=>{let f=h.columns.map(T=>T.id===g?{...T,...x}:T),k={...h,columns:f};return o(k),k});},[o]),d=react.useCallback(async g=>{r(x=>{let h=x.cards.filter(T=>T.columnId!==g),f=x.columns.filter(T=>T.id!==g),k={...x,cards:h,columns:f};return o(k),k});},[o]),i=react.useCallback(g=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(g),x},[c]),u=react.useCallback(g=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(g),x},[n]),v=react.useCallback(()=>{r(g=>{let x={...g,cards:[],columns:[]};return o(x),x});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:l,onCardCreate:c,onCardDelete:p,onColumnCreate:n,onColumnUpdate:m,onColumnDelete:d},setBoard:r,helpers:{addCard:i,addColumn:u,deleteCard:p,deleteColumn:d,clearBoard:v}}}function xc({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=En({initialBoard:e,onPersist:a}),l=react.useMemo(()=>({addCard:(p,n,m={})=>{s.addCard({title:n,columnId:p,position:r.cards.filter(d=>d.columnId===p).length,...m});},addColumn:(p,n)=>{let m=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:p,position:n??m+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:l}}var Co={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},wc={by:"none",order:"asc"};function Cc({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Co,...e}),[s,l]=react.useState({...wc,...t}),c=react.useCallback(b=>{o(g=>({...g,...b}));},[]),p=react.useCallback(b=>{l(g=>({...g,...b}));},[]),n=react.useCallback(()=>{o(Co),l(wc);},[]),m=react.useCallback(()=>{a&&o({...Co,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Co,dateFilter:"overdue"});},[]),i=react.useCallback(()=>{o({...Co,priorities:["HIGH","URGENT"]});},[]),u=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),v=react.useCallback(b=>{let g=[...b];if(r.search){let x=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(x)||h.description?.toLowerCase().includes(x));}if(r.dateFilter!=="all"){let x=new Date,h=x.getFullYear(),f=String(x.getMonth()+1).padStart(2,"0"),k=String(x.getDate()).padStart(2,"0"),T=`${h}-${f}-${k}`;g=g.filter(N=>{if(!N.endDate&&!N.dueDate)return false;let A=N.endDate||N.dueDate;if(!A)return false;let C;if(typeof A=="string")C=A.split("T")[0]||A;else {let W=A.getUTCFullYear(),D=String(A.getUTCMonth()+1).padStart(2,"0"),y=String(A.getUTCDate()).padStart(2,"0");C=`${W}-${D}-${y}`;}switch(r.dateFilter){case "overdue":return C<T;case "today":return C===T;case "this-week":let W=new Date(T+"T00:00:00"),D=new Date(C+"T00:00:00"),y=new Date(W);return y.setDate(y.getDate()+7),D>=W&&D<=y;case "custom":if(r.dateRange){let M=typeof A=="string"?new Date(A):A;return M>=r.dateRange.start&&M<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(x=>x.priority&&r.priorities.includes(x.priority))),r.assignees.length>0&&(g=g.filter(x=>(x.assignedUserIds||(x.assigneeId?[x.assigneeId]:[])).some(f=>r.assignees.includes(f)))),r.labels.length>0&&(g=g.filter(x=>x.labels&&x.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(x=>r.columns.includes(x.columnId))),s.by!=="none"&&g.sort((x,h)=>{let f=0;switch(s.by){case "created":let k=x.createdAt?new Date(x.createdAt).getTime():0,T=h.createdAt?new Date(h.createdAt).getTime():0;f=k-T;break;case "priority":let N={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},A=N[x.priority||"LOW"],C=N[h.priority||"LOW"];f=A-C;break;case "dueDate":let W=x.endDate||x.dueDate,D=h.endDate||h.dueDate;if(!W)return 1;if(!D)return -1;let y=typeof W=="string"?new Date(W).getTime():W.getTime(),M=typeof D=="string"?new Date(D).getTime():D.getTime();f=y-M;break;case "title":f=x.title.localeCompare(h.title);break;case "estimate":let S=x.estimatedTime||0,H=h.estimatedTime||0;f=S-H;break;default:f=0;}return s.order==="asc"?f:-f}),g},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:p,resetFilters:n,filterMyTasks:m,filterOverdue:d,filterHighPriority:i,applyFilters:v,hasActiveFilters:u}}var Dc,Nc;if(typeof window<"u")try{let e=Po("ai");Dc=e.generateObject,Nc=e.generateText;}catch{}function Sc(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Dc&&Nc&&e.apiKey),l=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(i){let u=i instanceof Error?i:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(i){let u=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[s]),p=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(i){let u=i instanceof Error?i:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[s]),n=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(i){let u=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[s]),m=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(i){let u=i instanceof Error?i:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[s]);return {onGeneratePlan:l,onSuggestAssignee:c,onPredictRisks:p,onGenerateSubtasks:n,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function hi(){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 Ec(e){let{cards:t}=e,[a,r]=hi(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,i)=>{if(!i){r({selectedCardIds:[d],lastSelectedCardId:d});return}let u=i.ctrlKey||i.metaKey,v=i.shiftKey;if(u)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(b=>b!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(v&&a.lastSelectedCardId){let b=t.find(x=>x.id===d),g=t.find(x=>x.id===a.lastSelectedCardId);if(b&&g&&b.columnId===g.columnId){let x=t.filter(C=>C.columnId===b.columnId).sort((C,W)=>C.position-W.position),h=x.findIndex(C=>C.id===a.lastSelectedCardId),f=x.findIndex(C=>C.id===d),[k,T]=h<f?[h,f]:[f,h],N=x.slice(k,T+1).map(C=>C.id),A=Array.from(new Set([...a.selectedCardIds,...N]));r({selectedCardIds:A,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),l=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),n=react.useCallback(d=>{a.selectedCardIds.includes(d)?l(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,l,r]),m=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:l,clearSelection:c,selectAll:p,toggleCard:n,getSelectedCards:m}}var Pc={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Mc(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Pc,...a}),[a]),[s,l]=react.useState([]),c=react.useCallback((b,g,x,h,f)=>{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:b,cardIds:g,columnId:x,strategy:h,color:f,isExpanded:true,position:s.filter(T=>T.columnId===x).length,createdAt:new Date};l(T=>[...T,k]);},[o.minCardsPerStack,s]),p=react.useCallback(b=>{l(g=>g.filter(x=>x.id!==b));},[]),n=react.useCallback(b=>{l(g=>g.map(x=>x.id===b?{...x,isExpanded:!x.isExpanded}:x));},[]),m=react.useCallback((b,g)=>{l(x=>x.map(h=>h.id===b&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),d=react.useCallback((b,g)=>{l(x=>x.map(h=>{if(h.id===b){let f=h.cardIds.filter(k=>k!==g);return f.length<o.minCardsPerStack?null:{...h,cardIds:f}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),i=react.useCallback(b=>s.filter(g=>g.columnId===b).sort((g,x)=>g.position-x.position),[s]),u=react.useCallback(async b=>{let g=t.filter(T=>T.columnId===b);if(g.length<o.minCardsPerStack*2)return [];let x=[],h=new Map;g.forEach(T=>{T.labels&&T.labels.length>0&&T.labels.forEach(N=>{h.has(N)||h.set(N,[]),h.get(N).push(T);});}),h.forEach((T,N)=>{T.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F4CC} ${N}`,cardIds:T.map(A=>A.id),columnId:b,strategy:"labels",color:"#3b82f6"},reason:`${T.length} cards with label "${N}"`,confidence:.85});});let f=new Map;g.forEach(T=>{T.assignedUserIds&&T.assignedUserIds.length>0&&T.assignedUserIds.forEach(N=>{f.has(N)||f.set(N,[]),f.get(N).push(T);});}),f.forEach((T,N)=>{T.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F464} Assigned to user-${N.slice(-4)}`,cardIds:T.map(A=>A.id),columnId:b,strategy:"assignee",color:"#8b5cf6"},reason:`${T.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(g.forEach(T=>{T.priority&&(k.has(T.priority)||k.set(T.priority,[]),k.get(T.priority).push(T));}),k.forEach((T,N)=>{if(T.length>=o.minCardsPerStack){let A={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[N.toLowerCase()]||"\u26AA";x.push({stack:{title:`${A} ${N} Priority`,cardIds:T.map(C=>C.id),columnId:b,strategy:"priority",color:N==="high"||N==="urgent"?"#ef4444":"#10b981"},reason:`${T.length} cards with ${N} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let T of g){let A=(await r.findSimilar(T,g)).filter(C=>C.similarity>=o.autoStackConfidenceThreshold);if(A.length>=o.minCardsPerStack-1){let C=[T.id,...A.map(D=>D.card.id)],W=A.reduce((D,y)=>D+y.similarity,0)/A.length;x.push({stack:{title:`\u2728 Similar to "${T.title.substring(0,30)}${T.title.length>30?"...":""}"`,cardIds:C,columnId:b,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${A.length+1} similar tasks`,confidence:W});}}return x.filter(T=>T.confidence>=o.autoStackConfidenceThreshold).sort((T,N)=>N.confidence-T.confidence).slice(0,5)},[t,o,r]),v=react.useCallback(b=>{c(b.stack.title,b.stack.cardIds,b.stack.columnId,b.stack.strategy,b.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let x=await u(g),h=x[0];x.length>0&&h&&h.confidence>=.9&&v(h);});},[]),{stacks:s,createStack:c,deleteStack:p,toggleStack:n,addToStack:m,removeFromStack:d,getStacksForColumn:i,getSuggestions:u,applySuggestion:v,config:o}}var Ac=react.createContext(null);function Ic({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,l=new Map;t?.columns?.forEach(p=>{let{Column:n}=Po("@libxai/core");s.set(p.id,new n(p));}),t?.cards?.forEach(p=>{let{Card:n}=Po("@libxai/core");l.set(p.id,new n(p));});let c=null;if(t?.board){let{Board:p}=Po("@libxai/core");c=new p(t.board);}r.current=new core.BoardStore({board:c,columns:s,cards:l});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Ac.Provider,{value:{store:o},children:e})}function Pn(){let e=react.useContext(Ac);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Do(){let e=Pn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,l]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),l(e.getAllCards());}),[e]);let c=react.useCallback(h=>{e.updateBoard(h);},[e]),p=react.useCallback(h=>{e.addColumn(h);},[e]),n=react.useCallback((h,f)=>{e.updateColumn(h,f);},[e]),m=react.useCallback(h=>{e.deleteColumn(h);},[e]),d=react.useCallback(h=>e.getColumn(h),[e]),i=react.useCallback(h=>{e.addCard(h);},[e]),u=react.useCallback((h,f)=>{e.updateCard(h,f);},[e]),v=react.useCallback(h=>{e.deleteCard(h);},[e]),b=react.useCallback((h,f,k)=>{e.moveCard(h,f,k);},[e]),g=react.useCallback(h=>e.getCard(h),[e]),x=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:p,updateColumn:n,deleteColumn:m,getColumn:d,addCard:i,updateCard:u,deleteCard:v,moveCard:b,getCard:g,getCardsByColumn:x}}function Fc(e){let{cards:t}=Do();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 Bc(e="position",t="asc"){let{cards:a}=Do();return react.useMemo(()=>[...a].sort((o,s)=>{let l=0;switch(e){case "title":l=o.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},p=o.priority?c[o.priority]:0,n=s.priority?c[s.priority]:0;l=p-n;break}case "createdAt":l=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":l=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":l=o.position-s.position;break}return t==="asc"?l:-l}),[a,e,t])}var Mn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Ui.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let l=s[t];if(typeof l=="function")try{let c=await Promise.resolve(l.apply(s,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(l=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,l,{plugin:o.id,hook:t});}));}await Promise.all(r);}},xh=new Mn;function Oc({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:l=false,gap:c=0,getItemKey:p}){let n=react.useRef(null),m=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>a,overscan:s,horizontal:l,gap:c}),d=m.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=l?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:n,style:i,className:o,children:jsxRuntime.jsx("div",{style:u,children:d.map(v=>{let b=e[v.index];if(!b)return null;let g=p?p(b,v.index):v.index,x={position:"absolute",top:l?0:v.start,left:l?v.start:0,width:l?v.size:"100%",height:l?"100%":v.size};return jsxRuntime.jsx("div",{style:x,"data-index":v.index,children:r(b,v.index)},g)})})})}function zc(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 Uc({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:l=3,gap:c=16,getItemKey:p,horizontal:n=true}){let m=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:l,gap:c}),i=d.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:m,style:u,className:s,children:jsxRuntime.jsx("div",{style:v,children:i.map(b=>{let g=e[b.index];if(!g)return null;let x=p?p(g,b.index):b.index,h={position:"absolute",top:0,left:b.start,width:b.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":b.index,children:o(g,b.index)},x)})})})}function Wc(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 Hc(e,t=10){return e>t}var xi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ki={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},wi={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Ci={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ti={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Di={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Ni={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Si={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)"},Ei={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)"},Pi={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Mi={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}},Ai={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}},An={spacing:xi,borderRadius:ki,fontSize:wi,fontWeight:Ci,lineHeight:Ti,zIndex:Di,duration:Ni,easing:Si,shadows:Ei,opacity:Pi,kanban:Mi,gantt:Ai};function Gc(e,t,a){return e[t]??a}function Ii(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)?Ii(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Ch(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Li(e="asakaa"){let t=Ii(An),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,l=Ch(o);a.push(` ${s}: ${l};`);}return `:root {
323
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function Fd(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Ka(e,t){let a=Fd(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let s=a.find(c=>c.name.toLowerCase().includes(r));if(s)return s;let l=r.split(/\s+/);return a.find(c=>{let p=c.name.toLowerCase();return l.every(n=>p.includes(n))})}function js(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let i=new Date(r);return i.setDate(i.getDate()+1),i}if(a==="yesterday"||a==="ayer"){let i=new Date(r);return i.setDate(i.getDate()-1),i}if(a==="next week"||a==="la pr\xF3xima semana"){let i=new Date(r);return i.setDate(i.getDate()+7),i}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let u={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(u!==void 0){let v=new Date(r),b=v.getDay(),g=u-b;return g<=0&&(g+=7),v.setDate(v.getDate()+g),v}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let i=parseInt(s[1],10),u=s[2].toLowerCase(),v=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?v.setDate(v.getDate()+i):u==="week"||u==="semana"||u==="semanas"?v.setDate(v.getDate()+i*7):(u==="month"||u==="mes"||u==="meses")&&v.setMonth(v.getMonth()+i),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let i=parseInt(c[1],10),u=parseInt(c[2],10)-1,v=parseInt(c[3],10);return new Date(v,u,i)}let p={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},n=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(n&&n[1]&&n[2]){let i=parseInt(n[1],10),u=p[n[2].toLowerCase()],v=n[3]?parseInt(n[3],10):r.getFullYear();if(u!==void 0)return new Date(v,u,i)}let m={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let i=m[d[1].toLowerCase()],u=parseInt(d[2],10),v=d[3]?parseInt(d[3],10):r.getFullYear();if(i!==void 0)return new Date(v,i,u)}return null}function Ks(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 Ys(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 Bd(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 Rd(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let n=r[1].trim(),m=r[2].trim(),d=Ka(t,n),i=js(m);if(!d)return {type:"move_task",taskName:n,message:`Could not find a task named "${n}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!i)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(i);return v.setDate(v.getDate()+u),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:i,endDate:v},message:`Moved "${d.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let n=o[1].trim(),m=o[2].trim(),d=Ka(t,n),i=Ks(m);if(!d)return {type:"resize_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"};if(!i||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let u=new Date(d.endDate);return u.setDate(u.getDate()+i),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:u},message:`Extended "${d.name}" by ${i} days. New end date: ${u.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let n=s[1].trim(),m=s[2].trim(),d=Ka(t,n),i=Ys(m);return d?i===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:i},message:`Set "${d.name}" progress to ${i}%.`,success:true}:{type:"set_progress",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let l=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let n=l[1].trim(),m=l[2].trim(),d=Ka(t,n);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:m},message:`Renamed "${d.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let n=c[1].trim(),m=c[2].trim(),d=Ka(t,n),i=Ka(t,m);return d?i?{type:"link_tasks",taskId:i.id,taskName:i.name,dependencyFrom:d.id,dependencyTo:i.id,message:`Linked "${d.name}" \u2192 "${i.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Source task not found"}}let p=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]){let n=p[1].trim(),m=Ka(t,n);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}return null}function Od(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 kf(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 wf(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function fn(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let d=a.find(i=>i.id===m);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>fn(m,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let l=m=>{if(m)return typeof m=="string"?new Date(m):m},c=l(e.startDate),p=l(e.endDate),n=e.metadata?.isMilestone===true||c&&p&&Math.abs(p.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:p,progress:e.progress||0,status:kf(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:n,isCriticalPath:e.metadata?.isCriticalPath===true}}function $d(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:wf(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function zd(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>fn(r,e,t))}var qs={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"}},Xs={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"}},hn={en:qs,es:Xs};function Js(e){return hn[e]||hn.en}function bn(e,t){let a=Js(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}function Gd(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(...Gd(r.subtasks,t+1));return a}function Lf({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 _d({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:l}){let{theme:c="dark",locale:p="en",customTranslations:n,showSearch:m=true,showHierarchy:d=true}=t,i=bn(p,n),u=c==="dark",[v,b]=react.useState(new Set),[g,x]=react.useState("startDate"),[h,f]=react.useState("asc"),[k,T]=react.useState("");react.useMemo(()=>{let D=new Set;function y(M){for(let S of M)S.subtasks?.length&&(D.add(S.id),y(S.subtasks));}y(e),b(D);},[e]);let N=react.useCallback(D=>{b(y=>{let M=new Set(y);return M.has(D)?M.delete(D):M.add(D),M}),a.onTaskToggleExpand?.(D);},[a]),A=react.useCallback(D=>{g===D?f(y=>y==="asc"?"desc":"asc"):(x(D),f("asc")),a.onSortChange?.({column:D,direction:h==="asc"?"desc":"asc"});},[g,h,a]),C=react.useMemo(()=>{let D=Gd(e);if(k.trim()){let M=k.toLowerCase();D=D.filter(S=>S.name.toLowerCase().includes(M));}let y=[];for(let M of D){let S=M.level===0;M.level>0&&(S=true),(S||k.trim())&&y.push(M);}return k.trim()&&y.sort((M,S)=>{let H,Y;switch(g){case "name":H=M.name.toLowerCase(),Y=S.name.toLowerCase();break;case "startDate":H=M.startDate?.getTime()||0,Y=S.startDate?.getTime()||0;break;case "endDate":H=M.endDate?.getTime()||0,Y=S.endDate?.getTime()||0;break;case "progress":H=M.progress||0,Y=S.progress||0;break;case "status":H=M.status||"todo",Y=S.status||"todo";break;default:return 0}return H<Y?h==="asc"?-1:1:H>Y?h==="asc"?1:-1:0}),y},[e,k,g,h]),W=D=>D?(D instanceof Date?D:new Date(D)).toLocaleDateString(p==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:w("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:w("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsxRuntime.jsx("p",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:w("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",s),style:l,children:[jsxRuntime.jsx("div",{className:w("flex-shrink-0 px-6 py-4 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[m&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:w("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:k,onChange:D=>T(D.target.value),placeholder:i.toolbar.searchPlaceholder,className:w("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",u?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsxs("div",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[C.length," ",i.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:w("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",u?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>A("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C.map((D,y)=>{let M=v.has(D.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:w("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",u?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+D.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(D),onDoubleClick:()=>a.onTaskDoubleClick?.(D),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&D.hasChildren&&jsxRuntime.jsx("button",{onClick:S=>{S.stopPropagation(),N(D.id);},className:w("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:M?jsxRuntime.jsx(lucideReact.ChevronDown,{className:w("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:w("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),d&&!D.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:S=>{S.stopPropagation(),a.onTaskUpdate?.({...D,progress:D.progress===100?0:100,status:D.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(Lf,{status:D.status,progress:D.progress})}),jsxRuntime.jsx("span",{className:w("truncate",u?"text-white":"text-gray-900",D.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:D.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:w("px-2 py-1 rounded-full text-xs font-medium",D.progress===100||D.status==="completed"?"bg-green-500/10 text-green-500":D.progress&&D.progress>0||D.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:D.progress===100||D.status==="completed"?i.status.completed:D.progress&&D.progress>0||D.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxRuntime.jsxs("div",{className:w("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),W(D.startDate)]}),jsxRuntime.jsxs("div",{className:w("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),W(D.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:w("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:w("h-full rounded-full transition-all",D.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${D.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:w("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[D.progress||0,"%"]})]})})]},D.id)})}),C.length===0&&k&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:w("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:w(u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var Zs={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"},Qs={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"},ei={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"},vn={dark:Zs,light:Qs,neutral:ei};function Vd(e){return vn[e]||vn.dark}var ti={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"}},ai={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"}},xn={en:ti,es:ai};function xo(e){return xn[e]||xn.en}function kn(e,t){let a=xo(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 jd(e){let t=xo(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 Kd(e,t=0,a=true){let r=xo(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 jf(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 ii(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 Xd({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 Zd({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:l,style:c}){let{theme:p="dark",locale:n="en",customTranslations:m}=t,d=kn(n,m),i=p==="dark",[u,v]=react.useState(r||new Date),[b,g]=react.useState(null),[x,h]=react.useState(null),[f,k]=react.useState(null),[T,N]=react.useState(new Date),[A,C]=react.useState({}),W=4,D=3,[y,M]=react.useState(false),[S,H]=react.useState(false),[Y,de]=react.useState(false),[he,Ie]=react.useState(null),[Le,R]=react.useState(""),[F,U]=react.useState(void 0),[E,X]=react.useState(null),[ee,$]=react.useState(false),[Me,ve]=react.useState(false),[qe,ge]=react.useState(null),[et,Te]=react.useState(false),[ot,gt]=react.useState(new Date),ft=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),tt=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),B=react.useCallback(()=>{v(new Date);},[]),se=react.useMemo(()=>{let O=u.getFullYear(),we=u.getMonth(),We=new Date(O,we,1),Ue=new Date(O,we+1,0),ht=We.getDay(),Z=Ue.getDate(),te=jf(e),ke=new Date;ke.setHours(0,0,0,0);let Pe=[],J=ht,Ae=new Date(O,we,0).getDate();for(let Ne=J-1;Ne>=0;Ne--){let ce=new Date(O,we-1,Ae-Ne);Pe.push({date:ce,isCurrentMonth:false,isToday:false,isWeekend:ce.getDay()===0||ce.getDay()===6,events:te.filter(Re=>ii(ce,Re)).map(Re=>({id:Re.id,title:Re.name,start:Re.startDate,end:Re.endDate,task:Re}))});}for(let Ne=1;Ne<=Z;Ne++){let ce=new Date(O,we,Ne),Re=ce.getTime()===ke.getTime();Pe.push({date:ce,isCurrentMonth:true,isToday:Re,isWeekend:ce.getDay()===0||ce.getDay()===6,events:te.filter(Fe=>ii(ce,Fe)).map(Fe=>({id:Fe.id,title:Fe.name,start:Fe.startDate,end:Fe.endDate,task:Fe}))});}let ye=42-Pe.length;for(let Ne=1;Ne<=ye;Ne++){let ce=new Date(O,we+1,Ne);Pe.push({date:ce,isCurrentMonth:false,isToday:false,isWeekend:ce.getDay()===0||ce.getDay()===6,events:te.filter(Re=>ii(ce,Re)).map(Re=>({id:Re.id,title:Re.name,start:Re.startDate,end:Re.endDate,task:Re}))});}return Pe},[u,e]),xe=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],De=u.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Ee=react.useCallback((O,we)=>{if(!b)return;let We={...b,[O]:we};g(We),a.onTaskUpdate?.(We);},[b,a]),Ve=react.useCallback(O=>{if(!b)return;let we=b.progress||0;O==="completed"?we=100:O==="todo"&&(we=0);let We={...b,status:O,progress:we};g(We),a.onTaskUpdate?.(We),M(false);},[b,a]),Ct=react.useCallback((O,we)=>{if(!b)return;let We={...b,startDate:O,endDate:we};g(We),a.onTaskUpdate?.(We);},[b,a]),q=react.useCallback(()=>{M(false),H(false),k(null);},[]);return o?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[d.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:w("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:w("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:w("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:d.labels.noEvents}),jsxRuntime.jsx("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:d.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:w("flex-1 flex flex-col w-full h-full overflow-auto",i?"bg-[#0F1117]":"bg-white",l),style:c,children:[jsxRuntime.jsx("div",{className:w("flex-shrink-0 px-6 py-4 border-b",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:w("text-xl font-semibold capitalize",i?"text-white":"text-gray-900"),children:De}),jsxRuntime.jsx("button",{onClick:B,className:w("px-3 py-1.5 text-sm rounded-lg transition-colors",i?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:d.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:ft,className:w("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:w("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:tt,className:w("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:w("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:xe.map(O=>jsxRuntime.jsx("div",{className:w("py-2 text-center text-xs font-medium uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:O},O))}),jsxRuntime.jsx("div",{className:w("grid grid-cols-7 auto-rows-min gap-px rounded-lg",i?"bg-[#2D2D2D]":"bg-gray-300"),children:se.map((O,we)=>{let We=O.date.getDay()===0||O.date.getDay()===6;return jsxRuntime.jsxs("div",{className:w("min-h-[120px] p-2 transition-colors flex flex-col relative group",i?We?"bg-[#1C1F26]":O.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":We?"bg-gray-100":O.isCurrentMonth?"bg-white":"bg-gray-50",O.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ue=A[we]||W,ht=O.events.slice(0,Ue),Z=O.events.length-Ue;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[ht.map(te=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{g(te.task),a.onEventClick?.(te);},whileHover:{scale:1.02},className:w("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",te.task.progress===100?i?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":i?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Xd,{task:te.task}),jsxRuntime.jsx("span",{className:"truncate",children:te.title})]})},te.id)),Z>0&&jsxRuntime.jsxs("button",{onClick:te=>{te.stopPropagation(),C(ke=>({...ke,[we]:Ue+D}));},className:w("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",Z," ",n==="es"?"M\xC1S":"MORE"]}),Ue>W&&O.events.length>W&&jsxRuntime.jsx("button",{onClick:te=>{te.stopPropagation(),C(ke=>({...ke,[we]:W}));},className:w("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ue=we>=28,ht=we%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Z=>{Z.stopPropagation(),he===we?Ie(null):(Ie(we),R(""),U(void 0),X(null),ge(null),$(false),ve(false),Te(false),gt(O.date));},className:w("w-5 h-5 rounded flex items-center justify-center transition-all",he===we?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",i?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:w("w-3.5 h-3.5 transition-transform",he===we&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:he===we&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ie(null),R(""),U(void 0),X(null),ge(null),$(false),ve(false),Te(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Ue?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ue?-5:5,scale:.95},transition:{duration:.12},className:w("absolute w-[320px] rounded-lg shadow-2xl z-50",Ue?"bottom-full mb-1":"top-full mt-1",ht?"right-0":"left-0",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>{Z.stopPropagation(),$(false),ve(false),Te(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Le,onChange:Z=>R(Z.target.value),placeholder:n==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:w("w-full bg-transparent text-sm outline-none placeholder:opacity-40",i?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:Z=>{if(Z.key==="Enter"&&Le.trim()){let te=t.availableUsers?.find(Pe=>Pe.id===E),ke=qe||O.date;a.onTaskCreate?.({name:Le.trim(),startDate:ke,endDate:ke,priority:F,assignees:te?[te]:void 0}),R(""),U(void 0),X(null),ge(null),Ie(null);}Z.key==="Escape"&&(Ie(null),R(""),U(void 0),X(null),ge(null));}})}),jsxRuntime.jsxs("div",{className:w("px-2.5 py-2 flex items-center justify-between border-t",i?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Z=>{Z.stopPropagation(),$(!ee),ve(false);},className:w("p-1 rounded transition-colors",F?F==="urgent"||F==="high"?"text-red-400 bg-red-500/20":F==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ee&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(Z=>jsxRuntime.jsxs("button",{onClick:()=>{U(Z.id),$(false);},className:w("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",F===Z.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:w("w-2 h-2 rounded-full",Z.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:Z.label})]},Z.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:Z=>{Z.stopPropagation(),Te(!et),$(false),ve(false),gt(qe||O.date);},className:w("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",qe?"bg-[#7C3AED]/20 text-[#7C3AED]":i?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(qe||O.date).toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:et&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[jsxRuntime.jsx("div",{className:w("w-40 py-2 border-r",i?"border-white/10":"border-gray-200"),children:(()=>{let Z=new Date,te=new Date(Z);te.setDate(Z.getDate()+1);let ke=new Date(Z);ke.setDate(Z.getDate()+((6-Z.getDay()+7)%7||7));let Pe=new Date(Z);Pe.setDate(Z.getDate()+((1-Z.getDay()+7)%7||7));let J=new Date(Z);J.setDate(Z.getDate()+14);let Ae=new Date(Z);return Ae.setDate(Z.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:Z,display:Z.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:te,display:te.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:ke,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Pe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"2 semanas":"2 weeks",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ae,display:Ae.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ne,ce)=>jsxRuntime.jsxs("button",{className:w("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{ge(Ne.date),Te(false);},children:[jsxRuntime.jsx("span",{children:Ne.label}),jsxRuntime.jsx("span",{className:w("text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:Ne.display})]},ce))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:w("text-xs font-medium",i?"text-white":"text-gray-900"),children:ot.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>gt(new Date),className:w("px-1.5 py-0.5 rounded text-[10px] transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>gt(new Date(ot.getFullYear(),ot.getMonth()-1)),className:w("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>gt(new Date(ot.getFullYear(),ot.getMonth()+1)),className:w("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(Z=>jsxRuntime.jsx("div",{className:w("w-6 h-6 flex items-center justify-center text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:Z},Z))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Z=ot.getFullYear(),te=ot.getMonth(),ke=new Date(Z,te,1).getDay(),Pe=new Date(Z,te+1,0).getDate(),J=new Date(Z,te,0).getDate(),Ae=new Date,ye=[];for(let ce=ke-1;ce>=0;ce--)ye.push({dayNum:J-ce,isCurrentMonth:false,date:new Date(Z,te-1,J-ce)});for(let ce=1;ce<=Pe;ce++)ye.push({dayNum:ce,isCurrentMonth:true,date:new Date(Z,te,ce)});let Ne=42-ye.length;for(let ce=1;ce<=Ne;ce++)ye.push({dayNum:ce,isCurrentMonth:false,date:new Date(Z,te+1,ce)});return ye.map((ce,Re)=>{let Fe=ce.date.toDateString()===Ae.toDateString(),Oe=(qe||O.date).toDateString()===ce.date.toDateString();return jsxRuntime.jsx("button",{className:w("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!ce.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),ce.isCurrentMonth&&(i?"text-white":"text-gray-900"),Fe&&"ring-1 ring-[#3B82F6]",Oe&&"bg-[#7C3AED] text-white",!Oe&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{ge(ce.date),Te(false);},children:ce.dayNum},Re)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Z=>{Z.stopPropagation(),ve(!Me),$(false);},className:w("p-1 rounded transition-colors",E?"text-[#7C3AED] bg-[#7C3AED]/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:E?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(Z=>Z.id===E)?.color||"#7C3AED"},children:t.availableUsers?.find(Z=>Z.id===E)?.initials||t.availableUsers?.find(Z=>Z.id===E)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Me&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{X(null),ve(false);},className:w("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",!E&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:w("w-5 h-5 rounded-full flex items-center justify-center",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:i?"text-[#9CA3AF]":"text-gray-500",children:n==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(Z=>jsxRuntime.jsxs("button",{onClick:()=>{X(Z.id),ve(false);},className:w("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",E===Z.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:Z.color||"#7C3AED"},children:Z.initials||Z.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:Z.name})]},Z.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:w("px-3 py-2 text-xs",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Le.trim()){let Z=t.availableUsers?.find(ke=>ke.id===E),te=qe||O.date;a.onTaskCreate?.({name:Le.trim(),startDate:te,endDate:te,priority:F,assignees:Z?[Z]:void 0}),R(""),U(void 0),X(null),ge(null),Ie(null);}},disabled:!Le.trim(),className:w("px-2.5 py-1 rounded text-xs font-medium transition-colors",Le.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":i?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:n==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:w("text-sm font-medium",O.isToday?"text-[#3B82F6]":O.isCurrentMonth?i?"text-white":"text-gray-900":i?"text-[#6B7280]":"text-gray-400"),children:O.date.getDate()})]})]},we)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>g(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:w("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:w("px-6 py-3 border-b flex items-center gap-3",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:w("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:w("text-xs px-2 py-0.5 rounded",i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:w("text-xs font-mono",i?"text-[#6B7280]":"text-gray-400"),children:b.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:w("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",i?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:w("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:w("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>g(null),className:w("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let O=b.progress===100?0:100,We={...b,progress:O,status:O===100?"completed":"todo"};g(We),a.onTaskUpdate?.(We);},className:w("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",b.progress===100?"bg-green-500 border-green-500":i?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:b.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:w("text-xl font-semibold flex-1",b.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:b.name})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{q(),M(!y);},className:w("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",b.progress===100||b.status==="completed"?"bg-green-500/20 text-green-400":b.progress&&b.progress>0||b.status==="in-progress"?"bg-blue-500/20 text-blue-400":i?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:b.progress===100||b.status==="completed"?n==="es"?"COMPLETADO":"DONE":b.progress&&b.progress>0||b.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>M(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(O=>jsxRuntime.jsxs("button",{onClick:()=>Ve(O.id),className:w("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",(b.status===O.id||O.id==="completed"&&b.progress===100||O.id==="in-progress"&&b.progress&&b.progress>0&&b.progress<100||O.id==="todo"&&(!b.progress||b.progress===0)&&b.status!=="in-progress"&&b.status!=="completed")&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:w("w-2 h-2 rounded-full",O.id==="completed"?"bg-green-500":O.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),b.assignees&&b.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[b.assignees.slice(0,3).map((O,we)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:O.color||"#8B5CF6"},title:O.name,children:O.initials||O.name.slice(0,2).toUpperCase()},we)),b.assignees.length>3&&jsxRuntime.jsxs("span",{className:w("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:["+",b.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:w("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{k(f?null:"start"),N(b.startDate||new Date);},className:w("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[b.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:w("mx-1",i?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),b.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(b.startDate||b.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:O=>{O.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>k(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:w("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:w("w-44 py-2 border-r",i?"border-white/10":"border-gray-200"),children:[(()=>{let O=new Date,we=new Date(O);we.setDate(O.getDate()+1);let We=new Date(O);We.setDate(O.getDate()+((6-O.getDay()+7)%7||7));let Ue=new Date(O);Ue.setDate(O.getDate()+((1-O.getDay()+7)%7||7));let ht=new Date(O);ht.setDate(O.getDate()+(6-O.getDay()+7)%7+7);let Z=new Date(O);Z.setDate(O.getDate()+14);let te=new Date(O);return te.setDate(O.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:we,display:we.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:We,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ue,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ht,display:ht.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Z,display:Z.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:te,display:te.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Pe,J)=>jsxRuntime.jsxs("button",{className:w("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(f==="start"){let Ae=b.endDate&&Pe.date>b.endDate?Pe.date:b.endDate;Ct(Pe.date,Ae),k("end");}else {let Ae=b.startDate&&Pe.date<b.startDate?Pe.date:b.startDate;Ct(Ae,Pe.date),k(null);}},children:[jsxRuntime.jsx("span",{children:Pe.label}),jsxRuntime.jsx("span",{className:w("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:Pe.display})]},J))})(),jsxRuntime.jsx("div",{className:w("border-t mt-2 pt-2",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Ct(void 0,void 0),k(null);},className:w("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:w("text-xs mb-3 px-2 py-1 rounded",i?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f==="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:w("font-medium",i?"text-white":"text-gray-900"),children:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>N(new Date),className:w("p-1 rounded text-sm transition-colors",i?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>N(new Date(T.getFullYear(),T.getMonth()-1)),className:w("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>N(new Date(T.getFullYear(),T.getMonth()+1)),className:w("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(O=>jsxRuntime.jsx("div",{className:w("w-8 h-8 flex items-center justify-center text-xs",i?"text-[#6B7280]":"text-gray-400"),children:O},O))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=T.getFullYear(),we=T.getMonth(),We=new Date(O,we,1).getDay(),Ue=new Date(O,we+1,0).getDate(),ht=new Date(O,we,0).getDate(),Z=new Date,te=[];for(let Pe=We-1;Pe>=0;Pe--)te.push({day:ht-Pe,isCurrentMonth:false,date:new Date(O,we-1,ht-Pe)});for(let Pe=1;Pe<=Ue;Pe++)te.push({day:Pe,isCurrentMonth:true,date:new Date(O,we,Pe)});let ke=42-te.length;for(let Pe=1;Pe<=ke;Pe++)te.push({day:Pe,isCurrentMonth:false,date:new Date(O,we+1,Pe)});return te.map((Pe,J)=>{let Ae=Pe.date.toDateString()===Z.toDateString(),ye=b.startDate?.toDateString()===Pe.date.toDateString(),Ne=b.endDate?.toDateString()===Pe.date.toDateString(),ce=ye||Ne,Re=b.startDate&&b.endDate&&Pe.date>=b.startDate&&Pe.date<=b.endDate;return jsxRuntime.jsx("button",{className:w("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Pe.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),Pe.isCurrentMonth&&(i?"text-white":"text-gray-900"),Ae&&"ring-2 ring-[#3B82F6]",ye&&"bg-[#3B82F6] text-white",Ne&&!ye&&"bg-[#7C3AED] text-white",Re&&!ce&&(i?"bg-[#7C3AED]/20":"bg-purple-100"),!ce&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let Fe=new Date(Pe.date);if(f==="start"){let Oe=b.endDate&&Fe>b.endDate?Fe:b.endDate;Ct(Fe,Oe),k("end");}else {let Oe=b.startDate&&Fe<b.startDate?Fe:b.startDate;Ct(Oe,Fe),k(null);}},children:Pe.day},J)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{q(),H(!S);},className:w("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",b.priority==="high"||b.priority==="urgent"?"bg-red-500/20 text-red-400":b.priority==="medium"?"bg-yellow-500/20 text-yellow-400":b.priority==="low"?"bg-green-500/20 text-green-400":i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:b.priority?b.priority==="high"||b.priority==="urgent"?n==="es"?"Urgente":"Urgent":b.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:S&&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:w("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(O=>jsxRuntime.jsxs("button",{onClick:()=>{Ee("priority",O.id),H(false);},className:w("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",b.priority===O.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:w("w-2 h-2 rounded-full",O.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:w("text-sm",i?"text-white":"text-gray-900"),children:b.startDate&&b.endDate?`${Math.ceil((b.endDate.getTime()-b.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:w("w-4 h-4 rounded-full border-2",i?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Y?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:b.progress||0,onChange:O=>{let we=parseInt(O.target.value),We=b.status;we===100?We="completed":we>0?We="in-progress":We="todo";let Ue={...b,progress:we,status:We};g(Ue),a.onTaskUpdate?.(Ue);},onBlur:()=>de(false),className:w("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",i?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>de(true),className:w("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:w("h-full rounded-full transition-all",b.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${b.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:w("text-sm font-medium min-w-[40px]",i?"text-white":"text-gray-900"),children:[b.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:w("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Vac\xEDo":"Empty"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:w("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:b.dependencies&&b.dependencies.length>0?`${b.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:w("flex items-center gap-2 text-sm transition-colors",i?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),n==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:w("flex items-center gap-2 text-sm mt-2 transition-colors",i?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:w("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:w("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Agregar subtarea":"Add subtask"}),b.subtasks&&b.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:b.subtasks.map(O=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:w("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",O.progress===100?"bg-green-500 border-green-500":i?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:O.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:w("text-sm",O.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:O.name})]},O.id))}),jsxRuntime.jsxs("button",{className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:w("text-sm font-semibold",i?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:w("p-1 rounded transition-colors",i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:w("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:w("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",i?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:w("w-6 h-6 mx-auto mb-2",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Suelta tus archivos aqu\xED para ":"Drop your files here to ",jsxRuntime.jsx("span",{className:w("underline",i?"text-white":"text-gray-700"),children:n==="es"?"subir":"upload"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:w("w-[280px] border-l flex flex-col",i?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:w("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:w("font-medium",i?"text-white":"text-gray-900"),children:n==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:w("text-sm text-center py-8",i?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),n==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:w("p-3 border-t",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:w("flex items-center gap-2 px-3 py-2 rounded-lg",i?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",className:w("flex-1 bg-transparent text-sm outline-none",i?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>h(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:w("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:w("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:w("font-medium",i?"text-white":"text-gray-900"),children:x.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>h(null),className:w("p-1 rounded",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:x.events.map(O=>jsxRuntime.jsxs("button",{onClick:()=>{h(null),g(O.task);},className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",i?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Xd,{task:O.task}),jsxRuntime.jsx("span",{className:w("text-sm truncate flex-1",i?"text-white":"text-gray-900"),children:O.title}),O.task.priority==="high"||O.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},O.id))})]})]})})]})}var li={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"},di={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"},ci={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"},Dn={dark:li,light:di,neutral:ci};function Qd(e){return Dn[e]||Dn.dark}function Yf({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:l,className:c}){let[p,n]=react.useState(false),m=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),d=react.useMemo(()=>{let u=m.length,v=new Set(m.flatMap(x=>x.assignedUserIds||[])).size,b=m.map(x=>x.priority).filter(Boolean),g=new Set(m.flatMap(x=>x.labels||[])).size;return {totalCards:u,uniqueAssignees:v,priorities:b,labels:g}},[m]),i=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:w("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:i,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:w("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),p&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:u=>{u.stopPropagation(),l?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:m.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:m.map(u=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(u),children:a(u)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(u),children:[jsxRuntime.jsx("h4",{children:u.title}),u.description&&jsxRuntime.jsxs("p",{children:[u.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,u.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},u.id))})})]})}var tc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function ko(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 wo(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 ac(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 rc({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:l,className:c}){let p=react.useMemo(()=>({...tc,...l}),[l]),[n,m]=react.useState(new Set),d=react.useRef(null),i=react.useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(f=>{let k=f.timestamp.toISOString().split("T")[0],T=h.get(k);T?T.push(f):h.set(k,[f]);}),Array.from(h.entries()).sort((f,k)=>k[0].localeCompare(f[0])).map(([f,k])=>({date:new Date(f),events:k.sort((T,N)=>N.timestamp.getTime()-T.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:u,uniqueTypes:v}=react.useMemo(()=>{let h=new Set,f=new Set;return e.forEach(k=>{h.add(k.userId),f.add(k.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(f)}},[e]),b=h=>{m(f=>{let k=new Set(f);return k.has(h)?k.delete(h):k.add(h),k});},g=h=>{let k=new Date().getTime()-h.getTime(),T=Math.floor(k/6e4),N=Math.floor(k/36e5),A=Math.floor(k/864e5);return T<1?"just now":T<60?`${T}m ago`:N<24?`${N}h ago`:A<7?`${A}d ago`:h.toLocaleDateString()},x=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&&d.current){let h=d.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:w("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:w("history-timeline",p.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let f=h.target.value;a({...t,types:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),v.map(h=>jsxRuntime.jsxs("option",{value:h,children:[wo(h)," ",h.replace("_"," ")]},h))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let f=h.target.value;a({...t,users:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),u.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})})]}),x>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",x,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:i.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[p.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((f,k)=>{let T=n.has(f.id),N=s===f.id,A=ac(f.type);return jsxRuntime.jsxs("div",{"data-event-id":f.id,className:w("history-timeline-event",T&&"expanded",N&&"selected"),onClick:()=>o?.(f),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:A},children:p.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:wo(f.type)})}),k<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:A}})]}),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:[p.showAvatars&&f.userAvatar&&jsxRuntime.jsx("img",{src:f.userAvatar,alt:f.userName||f.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:f.userName||f.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:ko(f)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?g(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),b(f.id);},children:[T?"\u25BC":"\u25B6"," Show changes"]}),T&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([C,W])=>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(W.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(W.to)})]})]},C)),f.metadata&&Object.keys(f.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(f.metadata).map(([C,W])=>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(W)})]},C))]})]})]})]},f.id)})})]},h.date?.toISOString()||"all"))})]})}function nc({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:l,onGoToEvent:c,onSpeedChange:p,className:n}){let m=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),i=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:w("history-replay-empty",n),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:w("history-replay",n),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&wo(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&ko(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:u=>c(parseInt(u.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,v)=>jsxRuntime.jsx("div",{className:w("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>c(v),title:ko(u)},u.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:l,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:m.map(u=>jsxRuntime.jsxs("button",{className:w("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>p(u),children:[u,"x"]},u))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(u=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:u},u))})]})]})]})]}):jsxRuntime.jsxs("div",{className:w("history-replay-start",n),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function pi(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 mi(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 sc(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 ic(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function eh(e,t,a,r,o,s=100){let l=e.map(p=>({...p,x:p.x??a/2+Math.random()*100-50,y:p.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(l.map(p=>[p.id,p]));for(let p=0;p<s;p++){let n=1-p/s;l.forEach(m=>{let d=a/2,i=r/2;m.vx+=(d-m.x)*o.centerForce*n,m.vy+=(i-m.y)*o.centerForce*n,l.forEach(u=>{if(m.id===u.id)return;let v=m.x-u.x,b=m.y-u.y,g=Math.sqrt(v*v+b*b)||1,x=o.chargeStrength*n/(g*g);m.vx+=v/g*x,m.vy+=b/g*x;});}),t.forEach(m=>{let d=c.get(typeof m.source=="string"?m.source:m.source.id),i=c.get(typeof m.target=="string"?m.target:m.target.id);if(!d||!i)return;let u=i.x-d.x,v=i.y-d.y,b=Math.sqrt(u*u+v*v)||1,g=(b-o.linkDistance)/b*o.forceStrength*n;d.vx+=u*g,d.vy+=v*g,i.vx-=u*g,i.vy-=v*g;}),l.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return l}function lc({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:l,onInteraction:c,className:p}){let n=react.useRef(null),[m,d]=react.useState([]),[i,u]=react.useState(null),[v,b]=react.useState(null),[g,x]=react.useState(null),[h,f]=react.useState(1),[k,T]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let S=eh(e,t,a.width,a.height,a,150);d(S);},[e,t,a]);let N=react.useCallback((S,H)=>{a.enableDragging&&(H.stopPropagation(),u(S));},[a.enableDragging]),A=react.useCallback(S=>{if(!i||!n.current)return;let Y=n.current.getBoundingClientRect(),de=(S.clientX-Y.left-k.x)/h,he=(S.clientY-Y.top-k.y)/h;d(Ie=>Ie.map(Le=>Le.id===i?{...Le,x:de,y:he,fx:de,fy:he}:Le));},[i,h,k]),C=react.useCallback(()=>{u(null);},[]),W=react.useCallback((S,H)=>{H.stopPropagation(),c?.({type:"node-click",node:S,position:{x:H.clientX,y:H.clientY}});},[c]),D=react.useCallback((S,H)=>{H.stopPropagation(),c?.({type:"edge-click",edge:S,position:{x:H.clientX,y:H.clientY}});},[c]),y=react.useCallback(S=>{let H=m.find(Y=>Y.id===S);return H?{x:H.x,y:H.y}:{x:0,y:0}},[m]),M=react.useCallback(S=>{if(S.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return S.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let H=S.card.priority;return H==="URGENT"?"#ef4444":H==="HIGH"?"#f59e0b":H==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return S.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:w("relationships-graph-empty",p),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:w("relationships-graph",p),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:l.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:l.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(S=>Math.min(S+.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:()=>f(S=>Math.max(S-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),T({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(S=>S.type))).map(S=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:pi(S)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[sc(S)," ",mi(S)]})]},S))}),jsxRuntime.jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:A,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(S=>{let H=y(typeof S.source=="string"?S.source:S.source.id),Y=y(typeof S.target=="string"?S.target:S.target.id),de=ic(S.type),he=g===S.id,Ie=S.onCriticalPath;return jsxRuntime.jsxs("g",{className:w("relationships-graph-edge",he&&"hovered",Ie&&"critical"),onMouseEnter:()=>x(S.id),onMouseLeave:()=>x(null),onClick:Le=>D(S,Le),children:[jsxRuntime.jsx("line",{x1:H.x,y1:H.y,x2:Y.x,y2:Y.y,stroke:pi(S.type),strokeWidth:Ie?a.edgeWidth*2:a.edgeWidth,strokeOpacity:he?1:.6,markerEnd:de?"url(#arrowhead)":void 0}),a.showEdgeLabels&&he&&jsxRuntime.jsx("text",{x:(H.x+Y.x)/2,y:(H.y+Y.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:mi(S.type)})]},S.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(S=>{let H=v===S.id,Y=S.onCriticalPath;return jsxRuntime.jsxs("g",{className:w("relationships-graph-node",H&&"hovered",Y&&"critical"),transform:`translate(${S.x}, ${S.y})`,onMouseDown:de=>N(S.id,de),onMouseEnter:()=>b(S.id),onMouseLeave:()=>b(null),onClick:de=>W(S,de),children:[jsxRuntime.jsx("circle",{r:Y?a.nodeSize*1.2:a.nodeSize,fill:M(S),stroke:Y?"#fbbf24":"#ffffff",strokeWidth:Y?3:2,opacity:H?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:S.card.title.length>20?S.card.title.substring(0,20)+"...":S.card.title})]},S.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 pc({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,l]=react.useState(""),[c,p]=react.useState(false),[n,m]=react.useState(null),[d,i]=react.useState(null),u=react.useRef(null),v=c||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&!v&&b();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,v]);let b=()=>{v||(l(""),m(null),i(null),t());},g=async()=>{if(!(!s.trim()||v)){p(true),m(null),i(null);try{let h=await r(s.trim());i(h);}catch(h){m(h instanceof Error?h.message:"Failed to generate plan");}finally{p(false);}}},x=()=>{d&&(a(d),b());};return e?jsxRuntime.jsxs(at,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),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:b,disabled:v,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((h,f)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},f))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((h,f)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children: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})]})},f)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:u,value:s,onChange:h=>l(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:v}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),n&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:n}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,f)=>jsxRuntime.jsx("button",{onClick:()=>l(h),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},f))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:v&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:b,disabled:v,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:g,disabled:!s.trim()||v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var ui={"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 ah={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},rh={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 oh(e,t,a){let r=ui[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Co(e){return `$${e.toFixed(4)}`}var gi=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=oh(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,i)=>d+i.cost,0),s=a.reduce((d,i)=>d+i.inputTokens,0),l=a.reduce((d,i)=>d+i.outputTokens,0),c=a.filter(d=>d.success),p=a.reduce((d,i)=>d+i.duration,0),n={},m={};return a.forEach(d=>{n[d.feature]=(n[d.feature]||0)+1,m[d.feature]=(m[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:l,operationsByFeature:n,costsByFeature:m,averageDuration:r>0?p/r:0,successRate:r>0?c.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,l=new Date;a==="month"?l.setMonth(s.getMonth()-1):l.setDate(s.getDate()-1);let c=this.operations.filter(m=>m.timestamp>=l).length,p=Math.max(0,o-c),n=c/o*100;return {used:c,limit:o,remaining:p,percentUsed:n,isExceeded:c>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Cr=new gi;function gc({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Cr.getStats()),[s,l]=react.useState(Cr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(Cr.getStats()),l(Cr.checkLimit(a));},1e3);return ()=>clearInterval(p)},[e,a]),react.useEffect(()=>{let p=n=>{n.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),!e)return null;let c=Cr.getRecentOperations(5);return jsxRuntime.jsxs(at,{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:p=>p.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:Co(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(([p,n])=>{let m=r.costsByFeature[p]||0,d=r.totalOperations>0?n/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:p.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[n," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Co(m)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},p)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(p=>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:p.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(p.timestamp).toLocaleTimeString()," \u2022"," ",p.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[p.inputTokens+p.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Co(p.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${p.success?"bg-green-400":"bg-red-400"}`})]})]},p.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 bc({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[l,c]=react.useState(""),[p,n]=react.useState(""),[m,d]=react.useState(""),[i,u]=react.useState(false),[v,b]=react.useState(null),[g,x]=react.useState(null),[h,f]=react.useState(null),k=react.useRef(null),T=i||o;react.useEffect(()=>{e&&k.current&&k.current.focus();},[e]),react.useEffect(()=>{let D=y=>{y.key==="Escape"&&!T&&N();};if(e)return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[e,T]);let N=()=>{T||(c(""),n(""),d(""),b(null),x(null),f(null),t());},A=async()=>{if(!(!l.trim()||T)){u(true),b(null),x(null),f(null);try{let D=await r({prompt:l.trim(),projectName:s||"Mi Proyecto",startDate:p||void 0,endDate:m||void 0});x(D.tasks.tasks),f({from_cache:D.from_cache,tokens_used:D.tokens_used,mock_mode:D.mock_mode,similarity:D.similarity,tokens_saved:D.tokens_saved});}catch(D){b(D instanceof Error?D.message:"Failed to generate tasks");}finally{u(false);}}},C=()=>{g&&(a(g),N());};if(!e)return null;let W=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(at,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:N}),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:D=>D.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:N,disabled:T,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:g?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[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 (",W,"% 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((D,y)=>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:["#",y+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:D.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"})]}),D.start," \u2192 ",D.end]}),jsxRuntime.jsxs("span",{children:[D.duration," days"]}),D.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",D.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${D.priority==="high"?"bg-red-500/20 text-red-400":D.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:D.priority})]})},D.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:l,onChange:D=>c(D.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:T}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:D=>n(D.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:T})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:D=>d(D.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:T})]})]}),v&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),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((D,y)=>jsxRuntime.jsx("button",{onClick:()=>c(D),disabled:T,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:D},y))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:T&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:N,disabled:T,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?jsxRuntime.jsx("button",{onClick: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:A,disabled:!l.trim()||T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:T?"Generating...":"Generate Tasks"})]})]})]})})]})}function En({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(g=>{t&&Lo(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(x,h,f)=>{console.warn(`Retry attempt ${h} after ${f}ms: ${x.message}`);}}).then(x=>{x.success||console.error(`Failed to persist board after ${x.attempts} attempts:`,x.error);});},[t]),s=react.useCallback(async(g,x,h)=>{r(f=>{let k=f.cards.find(D=>D.id===g);if(!k)return f;let T=k.columnId,N={...k,columnId:x,position:h},A=f.cards.map(D=>D.id===g?N:D),C=f.columns.map(D=>{if(D.id===T)return {...D,cardIds:D.cardIds.filter(y=>y!==g)};if(D.id===x){let y=A.filter(M=>M.columnId===x).sort((M,S)=>M.position-S.position);return {...D,cardIds:y.map(M=>M.id)}}return D}),W={...f,cards:A,columns:C};return o(W),W});},[o]),l=react.useCallback(async(g,x)=>{r(h=>{let f=h.cards.map(T=>T.id===g?{...T,...x}:T),k={...h,cards:f};return o(k),k});},[o]),c=react.useCallback(async g=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let f={...g,id:x},k=h.columns.map(N=>N.id===g.columnId?{...N,cardIds:[...N.cardIds,x]}:N),T={...h,cards:[...h.cards,f],columns:k};return o(T),T});},[o]),p=react.useCallback(async g=>{r(x=>{let h=x.cards.find(N=>N.id===g);if(!h)return x;let f=x.cards.filter(N=>N.id!==g),k=x.columns.map(N=>N.id===h.columnId?{...N,cardIds:N.cardIds.filter(A=>A!==g)}:N),T={...x,cards:f,columns:k};return o(T),T});},[o]),n=react.useCallback(async g=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let f={...g,id:x,cardIds:[]},k={...h,columns:[...h.columns,f]};return o(k),k});},[o]),m=react.useCallback(async(g,x)=>{r(h=>{let f=h.columns.map(T=>T.id===g?{...T,...x}:T),k={...h,columns:f};return o(k),k});},[o]),d=react.useCallback(async g=>{r(x=>{let h=x.cards.filter(T=>T.columnId!==g),f=x.columns.filter(T=>T.id!==g),k={...x,cards:h,columns:f};return o(k),k});},[o]),i=react.useCallback(g=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(g),x},[c]),u=react.useCallback(g=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(g),x},[n]),v=react.useCallback(()=>{r(g=>{let x={...g,cards:[],columns:[]};return o(x),x});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:l,onCardCreate:c,onCardDelete:p,onColumnCreate:n,onColumnUpdate:m,onColumnDelete:d},setBoard:r,helpers:{addCard:i,addColumn:u,deleteCard:p,deleteColumn:d,clearBoard:v}}}function vc({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=En({initialBoard:e,onPersist:a}),l=react.useMemo(()=>({addCard:(p,n,m={})=>{s.addCard({title:n,columnId:p,position:r.cards.filter(d=>d.columnId===p).length,...m});},addColumn:(p,n)=>{let m=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:p,position:n??m+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:l}}var To={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},kc={by:"none",order:"asc"};function wc({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...To,...e}),[s,l]=react.useState({...kc,...t}),c=react.useCallback(b=>{o(g=>({...g,...b}));},[]),p=react.useCallback(b=>{l(g=>({...g,...b}));},[]),n=react.useCallback(()=>{o(To),l(kc);},[]),m=react.useCallback(()=>{a&&o({...To,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...To,dateFilter:"overdue"});},[]),i=react.useCallback(()=>{o({...To,priorities:["HIGH","URGENT"]});},[]),u=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),v=react.useCallback(b=>{let g=[...b];if(r.search){let x=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(x)||h.description?.toLowerCase().includes(x));}if(r.dateFilter!=="all"){let x=new Date,h=x.getFullYear(),f=String(x.getMonth()+1).padStart(2,"0"),k=String(x.getDate()).padStart(2,"0"),T=`${h}-${f}-${k}`;g=g.filter(N=>{if(!N.endDate&&!N.dueDate)return false;let A=N.endDate||N.dueDate;if(!A)return false;let C;if(typeof A=="string")C=A.split("T")[0]||A;else {let W=A.getUTCFullYear(),D=String(A.getUTCMonth()+1).padStart(2,"0"),y=String(A.getUTCDate()).padStart(2,"0");C=`${W}-${D}-${y}`;}switch(r.dateFilter){case "overdue":return C<T;case "today":return C===T;case "this-week":let W=new Date(T+"T00:00:00"),D=new Date(C+"T00:00:00"),y=new Date(W);return y.setDate(y.getDate()+7),D>=W&&D<=y;case "custom":if(r.dateRange){let M=typeof A=="string"?new Date(A):A;return M>=r.dateRange.start&&M<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(x=>x.priority&&r.priorities.includes(x.priority))),r.assignees.length>0&&(g=g.filter(x=>(x.assignedUserIds||(x.assigneeId?[x.assigneeId]:[])).some(f=>r.assignees.includes(f)))),r.labels.length>0&&(g=g.filter(x=>x.labels&&x.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(x=>r.columns.includes(x.columnId))),s.by!=="none"&&g.sort((x,h)=>{let f=0;switch(s.by){case "created":let k=x.createdAt?new Date(x.createdAt).getTime():0,T=h.createdAt?new Date(h.createdAt).getTime():0;f=k-T;break;case "priority":let N={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},A=N[x.priority||"LOW"],C=N[h.priority||"LOW"];f=A-C;break;case "dueDate":let W=x.endDate||x.dueDate,D=h.endDate||h.dueDate;if(!W)return 1;if(!D)return -1;let y=typeof W=="string"?new Date(W).getTime():W.getTime(),M=typeof D=="string"?new Date(D).getTime():D.getTime();f=y-M;break;case "title":f=x.title.localeCompare(h.title);break;case "estimate":let S=x.estimatedTime||0,H=h.estimatedTime||0;f=S-H;break;default:f=0;}return s.order==="asc"?f:-f}),g},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:p,resetFilters:n,filterMyTasks:m,filterOverdue:d,filterHighPriority:i,applyFilters:v,hasActiveFilters:u}}var Tc,Dc;if(typeof window<"u")try{let e=Mo("ai");Tc=e.generateObject,Dc=e.generateText;}catch{}function Nc(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Tc&&Dc&&e.apiKey),l=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(i){let u=i instanceof Error?i:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(i){let u=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[s]),p=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(i){let u=i instanceof Error?i:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[s]),n=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(i){let u=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[s]),m=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(i){let u=i instanceof Error?i:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[s]);return {onGeneratePlan:l,onSuggestAssignee:c,onPredictRisks:p,onGenerateSubtasks:n,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function hi(){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 Sc(e){let{cards:t}=e,[a,r]=hi(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,i)=>{if(!i){r({selectedCardIds:[d],lastSelectedCardId:d});return}let u=i.ctrlKey||i.metaKey,v=i.shiftKey;if(u)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(b=>b!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(v&&a.lastSelectedCardId){let b=t.find(x=>x.id===d),g=t.find(x=>x.id===a.lastSelectedCardId);if(b&&g&&b.columnId===g.columnId){let x=t.filter(C=>C.columnId===b.columnId).sort((C,W)=>C.position-W.position),h=x.findIndex(C=>C.id===a.lastSelectedCardId),f=x.findIndex(C=>C.id===d),[k,T]=h<f?[h,f]:[f,h],N=x.slice(k,T+1).map(C=>C.id),A=Array.from(new Set([...a.selectedCardIds,...N]));r({selectedCardIds:A,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),l=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),n=react.useCallback(d=>{a.selectedCardIds.includes(d)?l(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,l,r]),m=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:l,clearSelection:c,selectAll:p,toggleCard:n,getSelectedCards:m}}var Ec={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Pc(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Ec,...a}),[a]),[s,l]=react.useState([]),c=react.useCallback((b,g,x,h,f)=>{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:b,cardIds:g,columnId:x,strategy:h,color:f,isExpanded:true,position:s.filter(T=>T.columnId===x).length,createdAt:new Date};l(T=>[...T,k]);},[o.minCardsPerStack,s]),p=react.useCallback(b=>{l(g=>g.filter(x=>x.id!==b));},[]),n=react.useCallback(b=>{l(g=>g.map(x=>x.id===b?{...x,isExpanded:!x.isExpanded}:x));},[]),m=react.useCallback((b,g)=>{l(x=>x.map(h=>h.id===b&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),d=react.useCallback((b,g)=>{l(x=>x.map(h=>{if(h.id===b){let f=h.cardIds.filter(k=>k!==g);return f.length<o.minCardsPerStack?null:{...h,cardIds:f}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),i=react.useCallback(b=>s.filter(g=>g.columnId===b).sort((g,x)=>g.position-x.position),[s]),u=react.useCallback(async b=>{let g=t.filter(T=>T.columnId===b);if(g.length<o.minCardsPerStack*2)return [];let x=[],h=new Map;g.forEach(T=>{T.labels&&T.labels.length>0&&T.labels.forEach(N=>{h.has(N)||h.set(N,[]),h.get(N).push(T);});}),h.forEach((T,N)=>{T.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F4CC} ${N}`,cardIds:T.map(A=>A.id),columnId:b,strategy:"labels",color:"#3b82f6"},reason:`${T.length} cards with label "${N}"`,confidence:.85});});let f=new Map;g.forEach(T=>{T.assignedUserIds&&T.assignedUserIds.length>0&&T.assignedUserIds.forEach(N=>{f.has(N)||f.set(N,[]),f.get(N).push(T);});}),f.forEach((T,N)=>{T.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F464} Assigned to user-${N.slice(-4)}`,cardIds:T.map(A=>A.id),columnId:b,strategy:"assignee",color:"#8b5cf6"},reason:`${T.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(g.forEach(T=>{T.priority&&(k.has(T.priority)||k.set(T.priority,[]),k.get(T.priority).push(T));}),k.forEach((T,N)=>{if(T.length>=o.minCardsPerStack){let A={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[N.toLowerCase()]||"\u26AA";x.push({stack:{title:`${A} ${N} Priority`,cardIds:T.map(C=>C.id),columnId:b,strategy:"priority",color:N==="high"||N==="urgent"?"#ef4444":"#10b981"},reason:`${T.length} cards with ${N} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let T of g){let A=(await r.findSimilar(T,g)).filter(C=>C.similarity>=o.autoStackConfidenceThreshold);if(A.length>=o.minCardsPerStack-1){let C=[T.id,...A.map(D=>D.card.id)],W=A.reduce((D,y)=>D+y.similarity,0)/A.length;x.push({stack:{title:`\u2728 Similar to "${T.title.substring(0,30)}${T.title.length>30?"...":""}"`,cardIds:C,columnId:b,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${A.length+1} similar tasks`,confidence:W});}}return x.filter(T=>T.confidence>=o.autoStackConfidenceThreshold).sort((T,N)=>N.confidence-T.confidence).slice(0,5)},[t,o,r]),v=react.useCallback(b=>{c(b.stack.title,b.stack.cardIds,b.stack.columnId,b.stack.strategy,b.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let x=await u(g),h=x[0];x.length>0&&h&&h.confidence>=.9&&v(h);});},[]),{stacks:s,createStack:c,deleteStack:p,toggleStack:n,addToStack:m,removeFromStack:d,getStacksForColumn:i,getSuggestions:u,applySuggestion:v,config:o}}var Mc=react.createContext(null);function Ac({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,l=new Map;t?.columns?.forEach(p=>{let{Column:n}=Mo("@libxai/core");s.set(p.id,new n(p));}),t?.cards?.forEach(p=>{let{Card:n}=Mo("@libxai/core");l.set(p.id,new n(p));});let c=null;if(t?.board){let{Board:p}=Mo("@libxai/core");c=new p(t.board);}r.current=new core.BoardStore({board:c,columns:s,cards:l});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Mc.Provider,{value:{store:o},children:e})}function Pn(){let e=react.useContext(Mc);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function No(){let e=Pn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,l]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),l(e.getAllCards());}),[e]);let c=react.useCallback(h=>{e.updateBoard(h);},[e]),p=react.useCallback(h=>{e.addColumn(h);},[e]),n=react.useCallback((h,f)=>{e.updateColumn(h,f);},[e]),m=react.useCallback(h=>{e.deleteColumn(h);},[e]),d=react.useCallback(h=>e.getColumn(h),[e]),i=react.useCallback(h=>{e.addCard(h);},[e]),u=react.useCallback((h,f)=>{e.updateCard(h,f);},[e]),v=react.useCallback(h=>{e.deleteCard(h);},[e]),b=react.useCallback((h,f,k)=>{e.moveCard(h,f,k);},[e]),g=react.useCallback(h=>e.getCard(h),[e]),x=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:p,updateColumn:n,deleteColumn:m,getColumn:d,addCard:i,updateCard:u,deleteCard:v,moveCard:b,getCard:g,getCardsByColumn:x}}function Lc(e){let{cards:t}=No();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 Fc(e="position",t="asc"){let{cards:a}=No();return react.useMemo(()=>[...a].sort((o,s)=>{let l=0;switch(e){case "title":l=o.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},p=o.priority?c[o.priority]:0,n=s.priority?c[s.priority]:0;l=p-n;break}case "createdAt":l=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":l=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":l=o.position-s.position;break}return t==="asc"?l:-l}),[a,e,t])}var Mn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Ui.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let l=s[t];if(typeof l=="function")try{let c=await Promise.resolve(l.apply(s,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(l=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,l,{plugin:o.id,hook:t});}));}await Promise.all(r);}},kh=new Mn;function Rc({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:l=false,gap:c=0,getItemKey:p}){let n=react.useRef(null),m=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>a,overscan:s,horizontal:l,gap:c}),d=m.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=l?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:n,style:i,className:o,children:jsxRuntime.jsx("div",{style:u,children:d.map(v=>{let b=e[v.index];if(!b)return null;let g=p?p(b,v.index):v.index,x={position:"absolute",top:l?0:v.start,left:l?v.start:0,width:l?v.size:"100%",height:l?"100%":v.size};return jsxRuntime.jsx("div",{style:x,"data-index":v.index,children:r(b,v.index)},g)})})})}function Oc(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 zc({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:l=3,gap:c=16,getItemKey:p,horizontal:n=true}){let m=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:l,gap:c}),i=d.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:m,style:u,className:s,children:jsxRuntime.jsx("div",{style:v,children:i.map(b=>{let g=e[b.index];if(!g)return null;let x=p?p(g,b.index):b.index,h={position:"absolute",top:0,left:b.start,width:b.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":b.index,children:o(g,b.index)},x)})})})}function Uc(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 Wc(e,t=10){return e>t}var xi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ki={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},wi={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Ci={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ti={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Di={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Ni={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Si={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)"},Ei={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)"},Pi={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Mi={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}},Ai={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}},An={spacing:xi,borderRadius:ki,fontSize:wi,fontWeight:Ci,lineHeight:Ti,zIndex:Di,duration:Ni,easing:Si,shadows:Ei,opacity:Pi,kanban:Mi,gantt:Ai};function Hc(e,t,a){return e[t]??a}function Ii(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)?Ii(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Th(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Li(e="asakaa"){let t=Ii(An),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,l=Th(o);a.push(` ${s}: ${l};`);}return `:root {
324
324
  ${a.join(`
325
325
  `)}
326
- }`}function No(e,t="asakaa"){let a=[],r=Ii(e);for(let[o,s]of Object.entries(r)){let l=`--${t}-color-${o}`;a.push(` ${l}: ${s};`);}return `:root {
326
+ }`}function So(e,t="asakaa"){let a=[],r=Ii(e);for(let[o,s]of Object.entries(r)){let l=`--${t}-color-${o}`;a.push(` ${l}: ${s};`);}return `:root {
327
327
  ${a.join(`
328
328
  `)}
329
- }`}var In={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},Fi={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},Bi={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function Ri(e=In,t="asakaa"){let a=Li(t),r=No(e,t);return `${a}
329
+ }`}var In={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},Fi={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},Bi={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function Ri(e=In,t="asakaa"){let a=Li(t),r=So(e,t);return `${a}
330
330
 
331
- ${r}`}function _c(){return `/**
331
+ ${r}`}function Gc(){return `/**
332
332
  * ASAKAA Design Tokens
333
333
  * Auto-generated from design-tokens.ts
334
334
  * Do not edit this file directly
@@ -338,17 +338,17 @@ ${Ri(In)}
338
338
 
339
339
  /* Light theme */
340
340
  [data-theme="light"] {
341
- ${No(Fi,"asakaa").split(`
341
+ ${So(Fi,"asakaa").split(`
342
342
  `).slice(1,-1).join(`
343
343
  `)}
344
344
  }
345
345
 
346
346
  /* Neutral theme */
347
347
  [data-theme="neutral"] {
348
- ${No(Bi,"asakaa").split(`
348
+ ${So(Bi,"asakaa").split(`
349
349
  `).slice(1,-1).join(`
350
350
  `)}
351
351
  }
352
- `}var Th=({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 Vc({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=$r();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([l,c])=>{let p=l,n=p===r;return jsxRuntime.jsxs("button",{onClick:()=>o(p),className:`theme-switcher__button ${n?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":n,title:c.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Th,{theme:p})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:c.displayName})]},p)})})}
353
- 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=fc;exports.AI_FEATURES=ah;exports.AI_MODELS=ui;exports.AddCardButton=Xn;exports.AddColumnButton=qn;exports.AttachmentUploader=za;exports.BoardProvider=Ic;exports.BulkOperationsToolbar=jo;exports.BurnDownChart=ds;exports.CalendarBoard=Qd;exports.Card=Ga;exports.CardDetailModal=ts;exports.CardDetailModalV2=ss;exports.CardHistoryReplay=sc;exports.CardHistoryTimeline=oc;exports.CardRelationshipsGraph=dc;exports.CardStack=Kf;exports.CardTemplateSelector=hs;exports.CircuitBreaker=Bn;exports.Column=Lr;exports.ColumnManager=Zo;exports.CommandPalette=Qn;exports.ConfigMenu=xs;exports.ContextMenu=Hr;exports.DEFAULT_SHORTCUTS=co;exports.DEFAULT_TEMPLATES=fs;exports.DateRangePicker=Zr;exports.DependenciesSelector=eo;exports.DependencyLine=nn;exports.DistributionCharts=cs;exports.EditableColumnTitle=Gn;exports.ErrorBoundary=Fr;exports.ExportImportModal=ys;exports.FilterBar=vs;exports.GANTT_AI_SYSTEM_PROMPT=Ld;exports.GanttAIAssistant=un;exports.GanttBoard=Id;exports.GanttI18nContext=Wr;exports.GanttMilestone=ln;exports.GanttToolbar=Jo;exports.GenerateGanttTasksDialog=yc;exports.GeneratePlanModal=mc;exports.GroupBySelector=us;exports.KanbanBoard=Qa;exports.KanbanToolbar=Kn;exports.KanbanViewAdapter=no;exports.KeyboardShortcutsHelp=gs;exports.ListView=Vd;exports.MenuIcons=kt;exports.PluginManager=Mn;exports.PrioritySelector=cr;exports.RATE_LIMITS=th;exports.SwimlaneBoardView=ps;exports.TagBadge=os;exports.TagList=Ml;exports.TagPicker=Rr;exports.TaskBar=an;exports.TaskFormModal=mn;exports.TaskGrid=tn;exports.ThemeModal=Ts;exports.ThemeProvider=jl;exports.ThemeSwitcher=Vc;exports.Timeline=cn;exports.UserAssignmentSelector=mr;exports.VelocityChart=ls;exports.VirtualGrid=Uc;exports.VirtualList=Oc;exports.aiUsageTracker=Cr;exports.borderRadius=ki;exports.calculatePosition=Ao;exports.calendarDarkTheme=li;exports.calendarEnTranslations=ti;exports.calendarEsTranslations=ai;exports.calendarLightTheme=di;exports.calendarNeutralTheme=ci;exports.calendarThemes=Dn;exports.calendarTranslations=xn;exports.cardToGanttTask=fn;exports.cardsToGanttTasks=Ud;exports.cn=w;exports.createKanbanView=Dl;exports.createRetryWrapper=lp;exports.darkTheme=ks;exports.darkTokenTheme=In;exports.defaultTheme=Yo;exports.designTokens=An;exports.duration=Ni;exports.easing=Si;exports.exportTokensToCSS=_c;exports.findTaskByName=Ka;exports.fontSize=wi;exports.fontWeight=Ci;exports.formatCost=wo;exports.ganttEnTranslations=Xo;exports.ganttEsTranslations=Yl;exports.ganttTaskToCardUpdate=$d;exports.ganttThemes=Ge;exports.ganttTokens=Ai;exports.ganttTranslations=Ds;exports.ganttUtils=ne;exports.generateCSSVariables=Li;exports.generateCompleteCSS=Ri;exports.generateInitialPositions=op;exports.generateTasksContext=Fd;exports.generateThemeVariables=No;exports.getCalendarTheme=ec;exports.getCalendarTranslations=vo;exports.getListViewTheme=jd;exports.getListViewTranslations=Js;exports.getMonthNames=Kd;exports.getToken=Gc;exports.getTranslations=ql;exports.getWeekdayNames=Yd;exports.kanbanTokens=Mi;exports.lightTheme=ws;exports.lightTokenTheme=Fi;exports.lineHeight=Ti;exports.listViewDarkTheme=Zs;exports.listViewEnTranslations=qs;exports.listViewEsTranslations=Xs;exports.listViewLightTheme=Qs;exports.listViewNeutralTheme=ei;exports.listViewThemes=vn;exports.listViewTranslations=hn;exports.mergeCalendarTranslations=kn;exports.mergeListViewTranslations=bn;exports.mergeTranslations=Ns;exports.neutralTheme=Cs;exports.neutralTokenTheme=Bi;exports.opacity=Pi;exports.parseLocalCommand=Od;exports.parseNaturalDate=js;exports.parseNaturalDuration=Ks;exports.parseProgress=Ys;exports.parseStatus=Rd;exports.pluginManager=xh;exports.retrySyncOperation=ip;exports.retryWithBackoff=Io;exports.shadows=Ei;exports.shouldVirtualizeGrid=Hc;exports.spacing=xi;exports.themes=hr;exports.useAI=Sc;exports.useBoard=xc;exports.useBoardCore=Do;exports.useBoardStore=Pn;exports.useCardStacking=Mc;exports.useDragState=Vn;exports.useFilteredCards=Fc;exports.useFilters=Cc;exports.useGanttI18n=po;exports.useKanbanState=En;exports.useKeyboardShortcuts=Gl;exports.useMultiSelect=Ec;exports.useSelectionState=hi;exports.useSortedCards=Bc;exports.useTheme=$r;exports.useVirtualGrid=Wc;exports.useVirtualList=zc;exports.validateAIResponse=zd;exports.withErrorBoundary=Jn;exports.wouldCreateCircularDependency=Fo;exports.zIndex=Di;//# sourceMappingURL=index.cjs.map
352
+ `}var Dh=({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 _c({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Ur();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([l,c])=>{let p=l,n=p===r;return jsxRuntime.jsxs("button",{onClick:()=>o(p),className:`theme-switcher__button ${n?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":n,title:c.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Dh,{theme:p})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:c.displayName})]},p)})})}
353
+ 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=gc;exports.AI_FEATURES=rh;exports.AI_MODELS=ui;exports.AddCardButton=Xn;exports.AddColumnButton=qn;exports.AttachmentUploader=$a;exports.BoardProvider=Ac;exports.BulkOperationsToolbar=jo;exports.BurnDownChart=ds;exports.CalendarBoard=Zd;exports.Card=Ga;exports.CardDetailModal=ts;exports.CardDetailModalV2=ss;exports.CardHistoryReplay=nc;exports.CardHistoryTimeline=rc;exports.CardRelationshipsGraph=lc;exports.CardStack=Yf;exports.CardTemplateSelector=hs;exports.CircuitBreaker=Bn;exports.Column=Lr;exports.ColumnManager=Zo;exports.CommandPalette=Qn;exports.ConfigMenu=xs;exports.ContextMenu=Gr;exports.DEFAULT_SHORTCUTS=po;exports.DEFAULT_TEMPLATES=fs;exports.DateRangePicker=Qr;exports.DependenciesSelector=to;exports.DependencyLine=nn;exports.DistributionCharts=cs;exports.EditableColumnTitle=Gn;exports.ErrorBoundary=Fr;exports.ExportImportModal=ys;exports.FilterBar=vs;exports.GANTT_AI_SYSTEM_PROMPT=Id;exports.GanttAIAssistant=un;exports.GanttBoard=Ad;exports.GanttI18nContext=Hr;exports.GanttMilestone=ln;exports.GanttToolbar=Jo;exports.GenerateGanttTasksDialog=bc;exports.GeneratePlanModal=pc;exports.GroupBySelector=us;exports.KanbanBoard=Qa;exports.KanbanToolbar=Kn;exports.KanbanViewAdapter=so;exports.KeyboardShortcutsHelp=gs;exports.ListView=_d;exports.MenuIcons=kt;exports.PluginManager=Mn;exports.PrioritySelector=cr;exports.RATE_LIMITS=ah;exports.SwimlaneBoardView=ps;exports.TagBadge=os;exports.TagList=Pl;exports.TagPicker=Or;exports.TaskBar=an;exports.TaskFormModal=mn;exports.TaskGrid=tn;exports.ThemeModal=Ts;exports.ThemeProvider=Vl;exports.ThemeSwitcher=_c;exports.Timeline=cn;exports.UserAssignmentSelector=mr;exports.VelocityChart=ls;exports.VirtualGrid=zc;exports.VirtualList=Rc;exports.aiUsageTracker=Cr;exports.borderRadius=ki;exports.calculatePosition=Io;exports.calendarDarkTheme=li;exports.calendarEnTranslations=ti;exports.calendarEsTranslations=ai;exports.calendarLightTheme=di;exports.calendarNeutralTheme=ci;exports.calendarThemes=Dn;exports.calendarTranslations=xn;exports.cardToGanttTask=fn;exports.cardsToGanttTasks=zd;exports.cn=w;exports.createKanbanView=Dl;exports.createRetryWrapper=ip;exports.darkTheme=ks;exports.darkTokenTheme=In;exports.defaultTheme=Yo;exports.designTokens=An;exports.duration=Ni;exports.easing=Si;exports.exportTokensToCSS=Gc;exports.findTaskByName=Ka;exports.fontSize=wi;exports.fontWeight=Ci;exports.formatCost=Co;exports.ganttEnTranslations=Xo;exports.ganttEsTranslations=Kl;exports.ganttTaskToCardUpdate=$d;exports.ganttThemes=Ge;exports.ganttTokens=Ai;exports.ganttTranslations=Ds;exports.ganttUtils=ne;exports.generateCSSVariables=Li;exports.generateCompleteCSS=Ri;exports.generateInitialPositions=rp;exports.generateTasksContext=Ld;exports.generateThemeVariables=So;exports.getCalendarTheme=Qd;exports.getCalendarTranslations=xo;exports.getListViewTheme=Vd;exports.getListViewTranslations=Js;exports.getMonthNames=jd;exports.getToken=Hc;exports.getTranslations=Yl;exports.getWeekdayNames=Kd;exports.kanbanTokens=Mi;exports.lightTheme=ws;exports.lightTokenTheme=Fi;exports.lineHeight=Ti;exports.listViewDarkTheme=Zs;exports.listViewEnTranslations=qs;exports.listViewEsTranslations=Xs;exports.listViewLightTheme=Qs;exports.listViewNeutralTheme=ei;exports.listViewThemes=vn;exports.listViewTranslations=hn;exports.mergeCalendarTranslations=kn;exports.mergeListViewTranslations=bn;exports.mergeTranslations=Ns;exports.neutralTheme=Cs;exports.neutralTokenTheme=Bi;exports.opacity=Pi;exports.parseLocalCommand=Rd;exports.parseNaturalDate=js;exports.parseNaturalDuration=Ks;exports.parseProgress=Ys;exports.parseStatus=Bd;exports.pluginManager=kh;exports.retrySyncOperation=sp;exports.retryWithBackoff=Lo;exports.shadows=Ei;exports.shouldVirtualizeGrid=Wc;exports.spacing=xi;exports.themes=hr;exports.useAI=Nc;exports.useBoard=vc;exports.useBoardCore=No;exports.useBoardStore=Pn;exports.useCardStacking=Pc;exports.useDragState=Vn;exports.useFilteredCards=Lc;exports.useFilters=wc;exports.useGanttI18n=mo;exports.useKanbanState=En;exports.useKeyboardShortcuts=Hl;exports.useMultiSelect=Sc;exports.useSelectionState=hi;exports.useSortedCards=Fc;exports.useTheme=Ur;exports.useVirtualGrid=Uc;exports.useVirtualList=Oc;exports.validateAIResponse=Od;exports.withErrorBoundary=Jn;exports.wouldCreateCircularDependency=Bo;exports.zIndex=Di;//# sourceMappingURL=index.cjs.map
354
354
  //# sourceMappingURL=index.cjs.map